Issue #2547 Native camera does not work on Google Nexus 7 with Android 4.2 fixed;
Issue #2506 Unnecessary log printouts in OpenCV::camera fixed; Native camera for MIPS Android 4.1.1 added. Build script for camera updated.
This commit is contained in:
		
							
								
								
									
										0
									
								
								3rdparty/lib/armeabi-v7a/libnative_camera_r2.3.3.so
									
									
									
									
										vendored
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										0
									
								
								3rdparty/lib/armeabi-v7a/libnative_camera_r2.3.3.so
									
									
									
									
										vendored
									
									
										
										
										Normal file → Executable file
									
								
							
							
								
								
									
										0
									
								
								3rdparty/lib/armeabi-v7a/libnative_camera_r4.1.1.so
									
									
									
									
										vendored
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										0
									
								
								3rdparty/lib/armeabi-v7a/libnative_camera_r4.1.1.so
									
									
									
									
										vendored
									
									
										
										
										Normal file → Executable file
									
								
							
							
								
								
									
										
											BIN
										
									
								
								3rdparty/lib/armeabi-v7a/libnative_camera_r4.2.0.so
									
									
									
									
										vendored
									
									
										Executable file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								3rdparty/lib/armeabi-v7a/libnative_camera_r4.2.0.so
									
									
									
									
										vendored
									
									
										Executable file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										0
									
								
								3rdparty/lib/armeabi/libnative_camera_r4.1.1.so
									
									
									
									
										vendored
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										0
									
								
								3rdparty/lib/armeabi/libnative_camera_r4.1.1.so
									
									
									
									
										vendored
									
									
										
										
										Normal file → Executable file
									
								
							
							
								
								
									
										
											BIN
										
									
								
								3rdparty/lib/armeabi/libnative_camera_r4.2.0.so
									
									
									
									
										vendored
									
									
										Executable file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								3rdparty/lib/armeabi/libnative_camera_r4.2.0.so
									
									
									
									
										vendored
									
									
										Executable file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										0
									
								
								3rdparty/lib/mips/libnative_camera_r4.0.3.so
									
									
									
									
										vendored
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										0
									
								
								3rdparty/lib/mips/libnative_camera_r4.0.3.so
									
									
									
									
										vendored
									
									
										
										
										Normal file → Executable file
									
								
							
							
								
								
									
										
											BIN
										
									
								
								3rdparty/lib/mips/libnative_camera_r4.1.1.so
									
									
									
									
										vendored
									
									
										Executable file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								3rdparty/lib/mips/libnative_camera_r4.1.1.so
									
									
									
									
										vendored
									
									
										Executable file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								3rdparty/lib/mips/libnative_camera_r4.2.0.so
									
									
									
									
										vendored
									
									
										Executable file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								3rdparty/lib/mips/libnative_camera_r4.2.0.so
									
									
									
									
										vendored
									
									
										Executable file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										0
									
								
								3rdparty/lib/x86/libnative_camera_r4.1.1.so
									
									
									
									
										vendored
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										0
									
								
								3rdparty/lib/x86/libnative_camera_r4.1.1.so
									
									
									
									
										vendored
									
									
										
										
										Normal file → Executable file
									
								
							
							
								
								
									
										
											BIN
										
									
								
								3rdparty/lib/x86/libnative_camera_r4.2.0.so
									
									
									
									
										vendored
									
									
										Executable file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								3rdparty/lib/x86/libnative_camera_r4.2.0.so
									
									
									
									
										vendored
									
									
										Executable file
									
								
							
										
											Binary file not shown.
										
									
								
							@@ -16,3 +16,8 @@ native_camera_r4.0.0; armeabi-v7a; 14; /home/alexander/Projects/AndroidSource/4.
 | 
			
		||||
native_camera_r4.1.1; armeabi;     14; /home/alexander/Projects/AndroidSource/4.1.1
 | 
			
		||||
native_camera_r4.1.1; armeabi-v7a; 14; /home/alexander/Projects/AndroidSource/4.1.1
 | 
			
		||||
native_camera_r4.1.1; x86;         14; /home/alexander/Projects/AndroidSource/4.1.1
 | 
			
		||||
native_camera_r4.1.1; mips;        14; /home/alexander/Projects/AndroidSource/4.1.1_mips
 | 
			
		||||
native_camera_r4.2.0; armeabi-v7a; 14; /home/alexander/Projects/AndroidSource/4.2
 | 
			
		||||
native_camera_r4.2.0; armeabi;     14; /home/alexander/Projects/AndroidSource/4.2
 | 
			
		||||
native_camera_r4.2.0; x86;         14; /home/alexander/Projects/AndroidSource/4.2
 | 
			
		||||
native_camera_r4.2.0; mips;        14; /home/alexander/Projects/AndroidSource/4.2
 | 
			
		||||
 
 | 
			
		||||
@@ -33,20 +33,27 @@ for s in ConfFile.readlines():
 | 
			
		||||
        continue
 | 
			
		||||
 | 
			
		||||
    shutil.rmtree(os.path.join(AndroidTreeRoot, "out", "target", "product", "generic", "system"), ignore_errors=True)
 | 
			
		||||
 | 
			
		||||
    LinkerLibs = os.path.join(AndroidTreeRoot, "bin_arm", "system")
 | 
			
		||||
    if (Arch == "x86"):
 | 
			
		||||
        shutil.copytree(os.path.join(AndroidTreeRoot, "bin_x86", "system"), os.path.join(AndroidTreeRoot, "out", "target", "product", "generic", "system"))
 | 
			
		||||
        LinkerLibs = os.path.join(AndroidTreeRoot, "bin_x86", "system")
 | 
			
		||||
    elif (Arch == "mips"):
 | 
			
		||||
        shutil.copytree(os.path.join(AndroidTreeRoot, "bin_mips", "system"), os.path.join(AndroidTreeRoot, "out", "target", "product", "generic", "system"))
 | 
			
		||||
    else:
 | 
			
		||||
        shutil.copytree(os.path.join(AndroidTreeRoot, "bin_arm", "system"), os.path.join(AndroidTreeRoot, "out", "target", "product", "generic", "system"))
 | 
			
		||||
        LinkerLibs = os.path.join(AndroidTreeRoot, "bin_mips", "system")
 | 
			
		||||
 | 
			
		||||
    if (not os.path.exists(LinkerLibs)):
 | 
			
		||||
        print("Error: Paltform libs for linker in path \"%s\" not found" % LinkerLibs)
 | 
			
		||||
        print("Building %s for %s\t[\033[91mFAILED\033[0m]" % (MakeTarget, Arch))
 | 
			
		||||
        continue
 | 
			
		||||
 | 
			
		||||
    shutil.copytree(LinkerLibs, os.path.join(AndroidTreeRoot, "out", "target", "product", "generic", "system"))
 | 
			
		||||
 | 
			
		||||
    os.chdir(BuildDir)
 | 
			
		||||
    BuildLog = os.path.join(BuildDir, "build.log")
 | 
			
		||||
    CmakeCmdLine = "cmake -DCMAKE_TOOLCHAIN_FILE=../android.toolchain.cmake -DANDROID_SOURCE_TREE=\"%s\" -DANDROID_NATIVE_API_LEVEL=\"%s\" -DANDROID_ABI=\"%s\" -DANDROID_STL=stlport_static ../../ > \"%s\" 2>&1" % (AndroidTreeRoot, NativeApiLevel, Arch, BuildLog)
 | 
			
		||||
    MakeCmdLine = "make %s >> \"%s\" 2>&1" % (MakeTarget, BuildLog);
 | 
			
		||||
    print(CmakeCmdLine)
 | 
			
		||||
    #print(CmakeCmdLine)
 | 
			
		||||
    os.system(CmakeCmdLine)
 | 
			
		||||
    print(MakeCmdLine)
 | 
			
		||||
    #print(MakeCmdLine)
 | 
			
		||||
    os.system(MakeCmdLine)
 | 
			
		||||
    os.chdir(HomeDir)
 | 
			
		||||
    CameraLib = os.path.join(BuildDir, "lib", Arch, "lib" + MakeTarget + ".so")
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
#if !defined(ANDROID_r2_2_0) && !defined(ANDROID_r2_3_3) && !defined(ANDROID_r3_0_1) && !defined(ANDROID_r4_0_0) && !defined(ANDROID_r4_0_3) && !defined(ANDROID_r4_1_1)
 | 
			
		||||
#if !defined(ANDROID_r2_2_0) && !defined(ANDROID_r2_3_3) && !defined(ANDROID_r3_0_1) && !defined(ANDROID_r4_0_0) && !defined(ANDROID_r4_0_3) && !defined(ANDROID_r4_1_1) && !defined(ANDROID_r4_2_0)
 | 
			
		||||
# error Building camera wrapper for your version of Android is not supported by OpenCV. You need to modify OpenCV sources in order to compile camera wrapper for your version of Android.
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
@@ -18,7 +18,7 @@
 | 
			
		||||
# define MAGIC_OPENCV_TEXTURE_ID (0x10)
 | 
			
		||||
#else // defined(ANDROID_r3_0_1) || defined(ANDROID_r4_0_0) || defined(ANDROID_r4_0_3)
 | 
			
		||||
//TODO: This is either 2.2 or 2.3. Include the headers for ISurface.h access
 | 
			
		||||
#if defined(ANDROID_r4_1_1)
 | 
			
		||||
#if defined(ANDROID_r4_1_1) || defined(ANDROID_r4_2_0)
 | 
			
		||||
#include <gui/ISurface.h>
 | 
			
		||||
#include <gui/BufferQueue.h>
 | 
			
		||||
#else
 | 
			
		||||
@@ -60,7 +60,7 @@ using namespace android;
 | 
			
		||||
 | 
			
		||||
void debugShowFPS();
 | 
			
		||||
 | 
			
		||||
#if defined(ANDROID_r4_1_1)
 | 
			
		||||
#if defined(ANDROID_r4_1_1) || defined(ANDROID_r4_2_0)
 | 
			
		||||
class ConsumerListenerStub: public BufferQueue::ConsumerListener
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
@@ -280,7 +280,7 @@ public:
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    virtual void postData(int32_t msgType, const sp<IMemory>& dataPtr
 | 
			
		||||
#if defined(ANDROID_r4_0_0) || defined(ANDROID_r4_0_3) || defined(ANDROID_r4_1_1)
 | 
			
		||||
    #if defined(ANDROID_r4_0_0) || defined(ANDROID_r4_0_3) || defined(ANDROID_r4_1_1) || defined(ANDROID_r4_2_0)
 | 
			
		||||
                          ,camera_frame_metadata_t*
 | 
			
		||||
#endif
 | 
			
		||||
                          )
 | 
			
		||||
@@ -526,7 +526,7 @@ CameraHandler* CameraHandler::initCameraConnect(const CameraCallback& callback,
 | 
			
		||||
    pdstatus = camera->setPreviewTexture(surfaceTexture);
 | 
			
		||||
    if (pdstatus != 0)
 | 
			
		||||
        LOGE("initCameraConnect: failed setPreviewTexture call; camera migth not work correctly");
 | 
			
		||||
#elif defined(ANDROID_r4_1_1)
 | 
			
		||||
#elif defined(ANDROID_r4_1_1) || defined(ANDROID_r4_2_0)
 | 
			
		||||
    sp<BufferQueue> bufferQueue = new BufferQueue();
 | 
			
		||||
    sp<BufferQueue::ConsumerListener> queueListener = new ConsumerListenerStub();
 | 
			
		||||
    bufferQueue->consumerConnect(queueListener);
 | 
			
		||||
 
 | 
			
		||||
@@ -427,7 +427,6 @@ void CameraActivity::applyProperties()
 | 
			
		||||
 | 
			
		||||
int CameraActivity::getFrameWidth()
 | 
			
		||||
{
 | 
			
		||||
    LOGD("CameraActivity::getFrameWidth()");
 | 
			
		||||
    if (frameWidth <= 0)
 | 
			
		||||
    frameWidth = getProperty(ANDROID_CAMERA_PROPERTY_FRAMEWIDTH);
 | 
			
		||||
    return frameWidth;
 | 
			
		||||
@@ -435,7 +434,6 @@ int CameraActivity::getFrameWidth()
 | 
			
		||||
 | 
			
		||||
int CameraActivity::getFrameHeight()
 | 
			
		||||
{
 | 
			
		||||
    LOGD("CameraActivity::getFrameHeight()");
 | 
			
		||||
    if (frameHeight <= 0)
 | 
			
		||||
    frameHeight = getProperty(ANDROID_CAMERA_PROPERTY_FRAMEHEIGHT);
 | 
			
		||||
    return frameHeight;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user