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:
Alexander Smorkalov 2012-11-20 12:59:42 +04:00
parent 6cd70c83fb
commit aa4e6a8a83
14 changed files with 23 additions and 13 deletions

0
3rdparty/lib/armeabi-v7a/libnative_camera_r2.3.3.so vendored Normal file → Executable file
View File

0
3rdparty/lib/armeabi-v7a/libnative_camera_r4.1.1.so vendored Normal file → Executable file
View File

Binary file not shown.

0
3rdparty/lib/armeabi/libnative_camera_r4.1.1.so vendored Normal file → Executable file
View File

Binary file not shown.

0
3rdparty/lib/mips/libnative_camera_r4.0.3.so vendored Normal file → Executable file
View 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

Binary file not shown.

0
3rdparty/lib/x86/libnative_camera_r4.1.1.so vendored Normal file → Executable file
View File

BIN
3rdparty/lib/x86/libnative_camera_r4.2.0.so vendored Executable file

Binary file not shown.

View File

@ -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; 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; 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; 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

View File

@ -33,20 +33,27 @@ for s in ConfFile.readlines():
continue continue
shutil.rmtree(os.path.join(AndroidTreeRoot, "out", "target", "product", "generic", "system"), ignore_errors=True) 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"): 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"): elif (Arch == "mips"):
shutil.copytree(os.path.join(AndroidTreeRoot, "bin_mips", "system"), os.path.join(AndroidTreeRoot, "out", "target", "product", "generic", "system")) LinkerLibs = os.path.join(AndroidTreeRoot, "bin_mips", "system")
else:
shutil.copytree(os.path.join(AndroidTreeRoot, "bin_arm", "system"), os.path.join(AndroidTreeRoot, "out", "target", "product", "generic", "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) os.chdir(BuildDir)
BuildLog = os.path.join(BuildDir, "build.log") 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) 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); MakeCmdLine = "make %s >> \"%s\" 2>&1" % (MakeTarget, BuildLog);
print(CmakeCmdLine) #print(CmakeCmdLine)
os.system(CmakeCmdLine) os.system(CmakeCmdLine)
print(MakeCmdLine) #print(MakeCmdLine)
os.system(MakeCmdLine) os.system(MakeCmdLine)
os.chdir(HomeDir) os.chdir(HomeDir)
CameraLib = os.path.join(BuildDir, "lib", Arch, "lib" + MakeTarget + ".so") CameraLib = os.path.join(BuildDir, "lib", Arch, "lib" + MakeTarget + ".so")

View File

@ -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. # 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 #endif
@ -18,7 +18,7 @@
# define MAGIC_OPENCV_TEXTURE_ID (0x10) # define MAGIC_OPENCV_TEXTURE_ID (0x10)
#else // defined(ANDROID_r3_0_1) || defined(ANDROID_r4_0_0) || defined(ANDROID_r4_0_3) #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 //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/ISurface.h>
#include <gui/BufferQueue.h> #include <gui/BufferQueue.h>
#else #else
@ -60,7 +60,7 @@ using namespace android;
void debugShowFPS(); void debugShowFPS();
#if defined(ANDROID_r4_1_1) #if defined(ANDROID_r4_1_1) || defined(ANDROID_r4_2_0)
class ConsumerListenerStub: public BufferQueue::ConsumerListener class ConsumerListenerStub: public BufferQueue::ConsumerListener
{ {
public: public:
@ -280,7 +280,7 @@ public:
} }
virtual void postData(int32_t msgType, const sp<IMemory>& dataPtr 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* ,camera_frame_metadata_t*
#endif #endif
) )
@ -526,7 +526,7 @@ CameraHandler* CameraHandler::initCameraConnect(const CameraCallback& callback,
pdstatus = camera->setPreviewTexture(surfaceTexture); pdstatus = camera->setPreviewTexture(surfaceTexture);
if (pdstatus != 0) if (pdstatus != 0)
LOGE("initCameraConnect: failed setPreviewTexture call; camera migth not work correctly"); 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> bufferQueue = new BufferQueue();
sp<BufferQueue::ConsumerListener> queueListener = new ConsumerListenerStub(); sp<BufferQueue::ConsumerListener> queueListener = new ConsumerListenerStub();
bufferQueue->consumerConnect(queueListener); bufferQueue->consumerConnect(queueListener);

View File

@ -427,7 +427,6 @@ void CameraActivity::applyProperties()
int CameraActivity::getFrameWidth() int CameraActivity::getFrameWidth()
{ {
LOGD("CameraActivity::getFrameWidth()");
if (frameWidth <= 0) if (frameWidth <= 0)
frameWidth = getProperty(ANDROID_CAMERA_PROPERTY_FRAMEWIDTH); frameWidth = getProperty(ANDROID_CAMERA_PROPERTY_FRAMEWIDTH);
return frameWidth; return frameWidth;
@ -435,7 +434,6 @@ int CameraActivity::getFrameWidth()
int CameraActivity::getFrameHeight() int CameraActivity::getFrameHeight()
{ {
LOGD("CameraActivity::getFrameHeight()");
if (frameHeight <= 0) if (frameHeight <= 0)
frameHeight = getProperty(ANDROID_CAMERA_PROPERTY_FRAMEHEIGHT); frameHeight = getProperty(ANDROID_CAMERA_PROPERTY_FRAMEHEIGHT);
return frameHeight; return frameHeight;