Hi everybody,
I just installed OpenCV 3.4.2 on Windows 8.0 and I am using Visual Studio Express 2012.
For some reason that I did not yet figured out my VC15 redistributables does not include the debug version of VC14 runtime and when i go to Microsoft download center to donload it, it says that the version installed on my system is newer than the one downloadable from them...
So, I am looking for a quick turn around to start asap experimenting with OpenCV! I can compile and run smoothly in "release" (not debug) mode, is there a standard way to link the "release" version of OpenCV in a "debug" application?
Thanks
↧
link release version in dubug application
↧
How does findChessboardCorners() find its corners
I am attempting to detect right-angle corners in an image. I notice that `cv::findChessboardCorners()` does exactly this and really well. So I'm interested to know how it works. I've googled around but cannot seem to find a simple explanation of what steps it takes.
I did find a link to the [code](https://github.com/opencv/opencv/blob/master/modules/calib3d/src/calibinit.cpp) so I can see that it performs some smart thresholding (which I don't quite understand what its doing) but from there its hard to figure out what its doing. Does it use a corner detector at any point? How does it distinguish right-angle corners from any other corner?
Is anyone able to explain simply what algorithms/techniques its using?
↧
↧
Multiple USB camera on a hub question
I am using a powered USB 2.0 hub and I am having problems accessing more than one camera through the hub in my python script.
I don't need simultaneous video feed from each camera. I just need to cycle through each to grab a snapshot.
example:
Activate Cam0
Take picture from Cam0
Disable Cam0
Activate Cam1
Take Picture from Cam1
Disable Cam1
etc.
Do you know how I can fully disconnect from Cam0 so I can access Cam1? Even though I do a release() on Cam0 and Cam1.isOpened() returns true, I get a "can't grab frame. Error: -2147483638" when I try to read() from Cam1.
Thanks in advance.
↧
License discussion around including Intel Reference Engine?
I see from the docs that OpenCV 3.4.2 uses Intel's OpenVino inference engine as the DNN backend by default (if you include it in compilation).
However, when I went to go obtain OpenVino, I found I was drowning in dozens of legal documents trying to figure out exactly how the inference engine and its various components (required redist dependencies and such) are licensed. I even saw scary language about Intel reserving various patent rights.
My question is, where is the developer discussion around including this apparently patent (or at least license) mine-field software? I ask because there must have been some discussion about the licensing nightmare before integrating it into OpenCV, so maybe if I were to see that discussion I might simply discover that I've misunderstood something.
↧
loading tensorflow model without .pbtxt file
Hi, complete DNN newbie here.
I'm loading opencv_face_detector_uint8.pb with its associated opencv_face_detector.pbtxt file. When I omit the second argument to the readNet function, the unconnected output layer vector is different. Why?
Net net = dnn::experimental_dnn_v5::readNetFromTensorflow("opencv_face_detector_uint8.pb", "opencv_face_detector.pbtxt");
vector vi = net.getUnconnectedOutLayers();
vector node_names;
for(int i : vi)
node_names.push_back(net.getLayer(i)->name);
for(auto& s : node_names)
cout << s << " ";
/* outputs "detection_out"*/
Net net = dnn::experimental_dnn_v5::readNetFromTensorflow("opencv_face_detector_uint8.pb");
...
/*outputs: mbox_loc mbox_conf_flatten, i.e. two nodes*/
A side question is: why can't I call
net.forward(node_name); /*node_name is a string containing an output node name*/
on the two nodes I get in the second example?
I hope someone can clarify, thanks.
↧
↧
How do I properly build Android OpenCV from sources?
The end goal is to build opencv with contrib for Android, but i cant seem to get the build_sdk.py script to even work without the --extra_pack flag
I've downloaded build Tools 25.0.3, sdk tools 25.2.5,, ndk 16b and the latest opencv and contrib repos.
Commands:
export ANDROID_SDK=/home/wmmc88/Android/Sdk/
export ANDROID_NDK=/home/wmmc88/Android/android-ndk-r16b/
python3 ../android/build_sdk.py test/ ../../../opencv --no_ccache --config ../android/ndk-16.config.py
Output:
> Args: Namespace(build_doc=False,> config='../android/ndk-16.config.py',> extra_modules_path=None,> extra_pack=None, force_copy=False,> force_opencv_toolchain=False,> ndk_path=None, no_ccache=True,> opencv_dir='../../../opencv',> sdk_path=None, sign_with=None,> work_dir='test/') Package> configuration:> ================================================================================ ABIs = [> ABI("2", "armeabi-v7a", "arm-linux-androideabi-4.9",> cmake_vars=dict(ANDROID_ABI='armeabi-v7a> with NEON')),> ABI("1", "armeabi", "arm-linux-androideabi-4.9",> cmake_vars=dict(WITH_TBB='OFF')),> ABI("3", "arm64-v8a", "aarch64-linux-android-4.9"),> ABI("5", "x86_64", "x86_64-4.9"),> ABI("4", "x86", "x86-4.9"), ]> ================================================================================ Android NDK path:> /home/wmmc88/Android/android-ndk-r16b/> Android SDK path:> /home/wmmc88/Android/Sdk/ Check dir> /home/wmmc88/OpenCVRepo/opencv/platforms/Custom/test> (create: True, clean: False) Check dir> /home/wmmc88/OpenCVRepo/opencv> (create: False, clean: False) Check> dir> /home/wmmc88/OpenCVRepo/opencv/platforms/Custom/test/o4a> (create: True, clean: True) Removing> file:> /home/wmmc88/OpenCVRepo/opencv/platforms/Custom/test/o4a/CMakeCache.txt> Removing dir:> /home/wmmc88/OpenCVRepo/opencv/platforms/Custom/test/o4a/CMakeFiles> Removing dir:> /home/wmmc88/OpenCVRepo/opencv/platforms/Custom/test/o4a/3rdparty> Removing file:> /home/wmmc88/OpenCVRepo/opencv/platforms/Custom/test/o4a/CMakeDownloadLog.txt> Removing dir:> /home/wmmc88/OpenCVRepo/opencv/platforms/Custom/test/o4a/junk> Check dir> /home/wmmc88/OpenCVRepo/opencv/platforms/Custom/test/OpenCV-android-sdk> (create: True, clean: True) Removing> dir:> /home/wmmc88/OpenCVRepo/opencv/platforms/Custom/test/OpenCV-android-sdk/sdk> Check dir> /home/wmmc88/OpenCVRepo/opencv/platforms/Custom/test/OpenCV-android-sdk/sdk/java/javadoc> (create: True, clean: True) Detected> OpenCV version: 4.0.0-pre Detected> Engine version: 3.42 Check dir> /home/wmmc88/OpenCVRepo/opencv/platforms/Custom/test/build_service_armeabi-v7a> (create: True, clean: True)> =====> ===== Building library for armeabi-v7a (arm-linux-androideabi-4.9)> =====>> Executing: ['cmake', '-GNinja',> '-DBUILD_TESTS=ON',> '-DINSTALL_TESTS=ON',> "-DCMAKE_TOOLCHAIN_FILE='/home/wmmc88/Android/android-ndk-r16b/build/cmake/android.toolchain.cmake'",> "-DWITH_OPENCL='OFF'",> "-DWITH_IPP='OFF'", "-DWITH_TBB='ON'",> "-DBUILD_EXAMPLES='OFF'",> "-DBUILD_TESTS='OFF'",> "-DBUILD_PERF_TESTS='OFF'",> "-DBUILD_DOCS='OFF'",> "-DBUILD_ANDROID_EXAMPLES='ON'",> "-DINSTALL_ANDROID_EXAMPLES='ON'",> "-DANDROID_STL='gnustl_static'",> "-DANDROID_ABI='armeabi-v7a with> NEON'",> "-DANDROID_TOOLCHAIN_NAME='arm-linux-androideabi-4.9'",> "-DANDROID_PLATFORM_ID='2'",> '/home/wmmc88/OpenCVRepo/opencv']> Executing: cmake -GNinja> -DBUILD_TESTS=ON -DINSTALL_TESTS=ON -DCMAKE_TOOLCHAIN_FILE='/home/wmmc88/Android/android-ndk-r16b/build/cmake/android.toolchain.cmake'> -DWITH_OPENCL='OFF' -DWITH_IPP='OFF' -DWITH_TBB='ON' -DBUILD_EXAMPLES='OFF' -DBUILD_TESTS='OFF' -DBUILD_PERF_TESTS='OFF' -DBUILD_DOCS='OFF' -DBUILD_ANDROID_EXAMPLES='ON' -DINSTALL_ANDROID_EXAMPLES='ON' -DANDROID_STL='gnustl_static' -DANDROID_ABI='armeabi-v7a with NEON' -DANDROID_TOOLCHAIN_NAME='arm-linux-androideabi-4.9'> -DANDROID_PLATFORM_ID='2' /home/wmmc88/OpenCVRepo/opencv> -- The CXX compiler identification is GNU 4.9.0> -- The C compiler identification is GNU 4.9.0> -- Check for working CXX compiler: /home/wmmc88/Android/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++> -- Check for working CXX compiler: /home/wmmc88/Android/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++> -- works> -- Detecting CXX compiler ABI info> -- Detecting CXX compiler ABI info - done> -- Detecting CXX compile features> -- Detecting CXX compile features - done> -- Check for working C compiler: /home/wmmc88/Android/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc> -- Check for working C compiler: /home/wmmc88/Android/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc> -- works> -- Detecting C compiler ABI info> -- Detecting C compiler ABI info - done> -- Detecting C compile features> -- Detecting C compile features - done> -- Found PythonInterp: /usr/bin/python2.7 (found suitable> version "2.7.15", minimum required is> "2.7") > -- Found PythonInterp: /usr/bin/python3 (found suitable> version "3.6.5", minimum required is> "3.4") > -- Looking for ccache - not found> -- Performing Test HAVE_CXX_FSIGNED_CHAR> -- Performing Test HAVE_CXX_FSIGNED_CHAR - Success> -- Performing Test HAVE_C_FSIGNED_CHAR> -- Performing Test HAVE_C_FSIGNED_CHAR - Success> -- Performing Test HAVE_CXX_W> -- Performing Test HAVE_CXX_W - Success> -- Performing Test HAVE_C_W> -- Performing Test HAVE_C_W - Success> -- Performing Test HAVE_CXX_WALL> -- Performing Test HAVE_CXX_WALL - Success> -- Performing Test HAVE_C_WALL> -- Performing Test HAVE_C_WALL - Success> -- Performing Test HAVE_CXX_WERROR_RETURN_TYPE> -- Performing Test HAVE_CXX_WERROR_RETURN_TYPE - Success> -- Performing Test HAVE_C_WERROR_RETURN_TYPE> -- Performing Test HAVE_C_WERROR_RETURN_TYPE - Success> -- Performing Test HAVE_CXX_WERROR_NON_VIRTUAL_DTOR> -- Performing Test HAVE_CXX_WERROR_NON_VIRTUAL_DTOR -> Success> -- Performing Test HAVE_C_WERROR_NON_VIRTUAL_DTOR> -- Performing Test HAVE_C_WERROR_NON_VIRTUAL_DTOR -> Success> -- Performing Test HAVE_CXX_WERROR_ADDRESS> -- Performing Test HAVE_CXX_WERROR_ADDRESS - Success> -- Performing Test HAVE_C_WERROR_ADDRESS> -- Performing Test HAVE_C_WERROR_ADDRESS - Success> -- Performing Test HAVE_CXX_WERROR_SEQUENCE_POINT> -- Performing Test HAVE_CXX_WERROR_SEQUENCE_POINT -> Success> -- Performing Test HAVE_C_WERROR_SEQUENCE_POINT> -- Performing Test HAVE_C_WERROR_SEQUENCE_POINT - Success> -- Performing Test HAVE_CXX_WFORMAT> -- Performing Test HAVE_CXX_WFORMAT - Success> -- Performing Test HAVE_C_WFORMAT> -- Performing Test HAVE_C_WFORMAT - Success> -- Performing Test HAVE_CXX_WERROR_FORMAT_SECURITY> -- Performing Test HAVE_CXX_WERROR_FORMAT_SECURITY -> Success> -- Performing Test HAVE_C_WERROR_FORMAT_SECURITY> -- Performing Test HAVE_C_WERROR_FORMAT_SECURITY -> Success> -- Performing Test HAVE_CXX_WMISSING_DECLARATIONS> -- Performing Test HAVE_CXX_WMISSING_DECLARATIONS -> Success> -- Performing Test HAVE_C_WMISSING_DECLARATIONS> -- Performing Test HAVE_C_WMISSING_DECLARATIONS - Success> -- Performing Test HAVE_CXX_WMISSING_PROTOTYPES> -- Performing Test HAVE_CXX_WMISSING_PROTOTYPES - Failed> -- Performing Test HAVE_C_WMISSING_PROTOTYPES> -- Performing Test HAVE_C_WMISSING_PROTOTYPES - Success> -- Performing Test HAVE_CXX_WSTRICT_PROTOTYPES> -- Performing Test HAVE_CXX_WSTRICT_PROTOTYPES - Failed> -- Performing Test HAVE_C_WSTRICT_PROTOTYPES> -- Performing Test HAVE_C_WSTRICT_PROTOTYPES - Success> -- Performing Test HAVE_CXX_WUNDEF> -- Performing Test HAVE_CXX_WUNDEF - Success> -- Performing Test HAVE_C_WUNDEF> -- Performing Test HAVE_C_WUNDEF - Success> -- Performing Test HAVE_CXX_WINIT_SELF> -- Performing Test HAVE_CXX_WINIT_SELF - Success> -- Performing Test HAVE_C_WINIT_SELF> -- Performing Test HAVE_C_WINIT_SELF - Success> -- Performing Test HAVE_CXX_WPOINTER_ARITH> -- Performing Test HAVE_CXX_WPOINTER_ARITH - Success> -- Performing Test HAVE_C_WPOINTER_ARITH> -- Performing Test HAVE_C_WPOINTER_ARITH - Success> -- Performing Test HAVE_CXX_WSHADOW> -- Performing Test HAVE_CXX_WSHADOW - Success> -- Performing Test HAVE_C_WSHADOW> -- Performing Test HAVE_C_WSHADOW - Success> -- Performing Test HAVE_CXX_WSIGN_PROMO> -- Performing Test HAVE_CXX_WSIGN_PROMO - Success> -- Performing Test HAVE_C_WSIGN_PROMO> -- Performing Test HAVE_C_WSIGN_PROMO - Failed> -- Performing Test HAVE_CXX_WUNINITIALIZED> -- Performing Test HAVE_CXX_WUNINITIALIZED - Success> -- Performing Test HAVE_C_WUNINITIALIZED> -- Performing Test HAVE_C_WUNINITIALIZED - Success> -- Performing Test HAVE_CXX_WSUGGEST_OVERRIDE> -- Performing Test HAVE_CXX_WSUGGEST_OVERRIDE - Failed> -- Performing Test HAVE_C_WSUGGEST_OVERRIDE> -- Performing Test HAVE_C_WSUGGEST_OVERRIDE - Failed> -- Performing Test HAVE_CXX_WNO_NARROWING> -- Performing Test HAVE_CXX_WNO_NARROWING - Success> -- Performing Test HAVE_C_WNO_NARROWING> -- Performing Test HAVE_C_WNO_NARROWING - Success> -- Performing Test HAVE_CXX_WNO_DELETE_NON_VIRTUAL_DTOR> -- Performing Test HAVE_CXX_WNO_DELETE_NON_VIRTUAL_DTOR -> Success> -- Performing Test HAVE_C_WNO_DELETE_NON_VIRTUAL_DTOR> -- Performing Test HAVE_C_WNO_DELETE_NON_VIRTUAL_DTOR -> Failed> -- Performing Test HAVE_CXX_WNO_UNNAMED_TYPE_TEMPLATE_ARGS> -- Performing Test HAVE_CXX_WNO_UNNAMED_TYPE_TEMPLATE_ARGS> - Failed> -- Performing Test HAVE_C_WNO_UNNAMED_TYPE_TEMPLATE_ARGS> -- Performing Test HAVE_C_WNO_UNNAMED_TYPE_TEMPLATE_ARGS> - Failed> -- Performing Test HAVE_CXX_WNO_COMMENT> -- Performing Test HAVE_CXX_WNO_COMMENT - Success> -- Performing Test HAVE_C_WNO_COMMENT> -- Performing Test HAVE_C_WNO_COMMENT - Success> -- Performing Test HAVE_CXX_FDIAGNOSTICS_SHOW_OPTION> -- Performing Test HAVE_CXX_FDIAGNOSTICS_SHOW_OPTION -> Success> -- Performing Test HAVE_C_FDIAGNOSTICS_SHOW_OPTION> -- Performing Test HAVE_C_FDIAGNOSTICS_SHOW_OPTION -> Success> -- Performing Test HAVE_CXX_FOMIT_FRAME_POINTER> -- Performing Test HAVE_CXX_FOMIT_FRAME_POINTER - Success> -- Performing Test HAVE_C_FOMIT_FRAME_POINTER> -- Performing Test HAVE_C_FOMIT_FRAME_POINTER - Success> -- Performing Test HAVE_CXX_MFPU_VFPV3> -- Performing Test HAVE_CXX_MFPU_VFPV3 - Success> -- Performing Test HAVE_CPU_NEON_SUPPORT (check file:> cmake/checks/cpu_neon.cpp)> -- Performing Test HAVE_CPU_NEON_SUPPORT - Success> -- Performing Test HAVE_CPU_FP16_SUPPORT (check file:> cmake/checks/cpu_fp16.cpp)> -- Performing Test HAVE_CPU_FP16_SUPPORT - Failed> -- Performing Test HAVE_CXX_MFPU_NEON_FP16 (check file:> cmake/checks/cpu_fp16.cpp)> -- Performing Test HAVE_CXX_MFPU_NEON_FP16 - Success> -- Performing Test HAVE_CPU_BASELINE_FLAGS> -- Performing Test HAVE_CPU_BASELINE_FLAGS - Success> -- Performing Test HAVE_CXX_MFP16_FORMAT_IEEE> -- Performing Test HAVE_CXX_MFP16_FORMAT_IEEE - Success> -- Performing Test HAVE_C_MFP16_FORMAT_IEEE> -- Performing Test HAVE_C_MFP16_FORMAT_IEEE - Success> -- Performing Test HAVE_CXX_FVISIBILITY_HIDDEN> -- Performing Test HAVE_CXX_FVISIBILITY_HIDDEN - Success> -- Performing Test HAVE_C_FVISIBILITY_HIDDEN> -- Performing Test HAVE_C_FVISIBILITY_HIDDEN - Success> -- Performing Test HAVE_CXX_FVISIBILITY_INLINES_HIDDEN> -- Performing Test HAVE_CXX_FVISIBILITY_INLINES_HIDDEN -> Success> -- Performing Test HAVE_C_FVISIBILITY_INLINES_HIDDEN> -- Performing Test HAVE_C_FVISIBILITY_INLINES_HIDDEN -> Failed> -- OpenCV disables pkg-config to avoid using of host libraries. Consider> using PKG_CONFIG_LIBDIR to specify> target SYSROOT> -- Looking for pthread.h> -- Looking for pthread.h - found> -- Looking for posix_memalign> -- Looking for posix_memalign - not found> -- Looking for malloc.h> -- Looking for malloc.h - found> -- Looking for memalign> -- Looking for memalign - found> -- Check if the system is big endian> -- Searching 16 bit integer> -- Looking for sys/types.h> -- Looking for sys/types.h - found> -- Looking for stdint.h> -- Looking for stdint.h - found> -- Looking for stddef.h> -- Looking for stddef.h - found> -- Check size of unsigned short> -- Check size of unsigned short - done> -- Using unsigned short> -- Check if the system is big endian - little endian> -- Found ZLIB: /home/wmmc88/Android/android-ndk-r16b/platforms/android-14/arch-arm/usr/lib/libz.so> (found suitable version "1.2.3",> minimum required is "1.2.3") > -- Performing Test HAVE_C_WNO_UNUSED_PARAMETER> -- Performing Test HAVE_C_WNO_UNUSED_PARAMETER - Success> -- Performing Test HAVE_C_WNO_SIGN_COMPARE> -- Performing Test HAVE_C_WNO_SIGN_COMPARE - Success> -- Performing Test HAVE_C_WNO_SHORTEN_64_TO_32> -- Performing Test HAVE_C_WNO_SHORTEN_64_TO_32 - Failed> -- Performing Test HAVE_C_WNO_IMPLICIT_FALLTHROUGH> -- Performing Test HAVE_C_WNO_IMPLICIT_FALLTHROUGH -> Failed> -- libjpeg-turbo: VERSION = 1.5.3, BUILD = opencv-4.0.0-pre-libjpeg-turbo> -- Check size of size_t> -- Check size of size_t - done> -- Looking for assert.h> -- Looking for assert.h - found> -- Looking for dlfcn.h> -- Looking for dlfcn.h - found> -- Looking for fcntl.h> -- Looking for fcntl.h - found> -- Looking for inttypes.h> -- Looking for inttypes.h - found> -- Looking for io.h> -- Looking for io.h - not found> -- Looking for limits.h> -- Looking for limits.h - found> -- Looking for memory.h> -- Looking for memory.h - found> -- Looking for search.h> -- Looking for search.h - found> -- Looking for string.h> -- Looking for string.h - found> -- Looking for strings.h> -- Looking for strings.h - found> -- Looking for sys/time.h> -- Looking for sys/time.h - found> -- Looking for unistd.h> -- Looking for unistd.h - found> -- Performing Test C_HAS_inline> -- Performing Test C_HAS_inline - Success> -- Check size of signed short> -- Check size of signed short - done> -- Check size of unsigned short> -- Check size of unsigned short - done> -- Check size of signed int> -- Check size of signed int - done> -- Check size of unsigned int> -- Check size of unsigned int - done> -- Check size of signed long> -- Check size of signed long - done> -- Check size of unsigned long> -- Check size of unsigned long - done> -- Check size of signed long long> -- Check size of signed long long - done> -- Check size of unsigned long long> -- Check size of unsigned long long - done> -- Check size of unsigned char *> -- Check size of unsigned char * - done> -- Check size of ptrdiff_t> -- Check size of ptrdiff_t - done> -- Check size of INT8> -- Check size of INT8 - failed> -- Check size of INT16> -- Check size of INT16 - failed> -- Check size of INT32> -- Check size of INT32 - failed> -- Looking for floor> -- Looking for floor - found> -- Looking for pow> -- Looking for pow - found> -- Looking for sqrt> -- Looking for sqrt - found> -- Looking for isascii> -- Looking for isascii - found> -- Looking for memset> -- Looking for memset - found> -- Looking for mmap> -- Looking for mmap - found> -- Looking for getopt> -- Looking for getopt - found> -- Looking for memmove> -- Looking for memmove - found> -- Looking for setmode> -- Looking for setmode - not found> -- Looking for strcasecmp> -- Looking for strcasecmp - found> -- Looking for strchr> -- Looking for strchr - found> -- Looking for strrchr> -- Looking for strrchr - found> -- Looking for strstr> -- Looking for strstr - found> -- Looking for strtol> -- Looking for strtol - found> -- Looking for strtol> -- Looking for strtol - found> -- Looking for strtoull> -- Looking for strtoull - found> -- Looking for lfind> -- Looking for lfind - not found> -- Performing Test HAVE_SNPRINTF> -- Performing Test HAVE_SNPRINTF - Success> -- Check if the system is big endian> -- Searching 16 bit integer> -- Using unsigned short> -- Check if the system is big endian - little endian> -- Performing Test HAVE_C_WNO_UNUSED_BUT_SET_VARIABLE> -- Performing Test HAVE_C_WNO_UNUSED_BUT_SET_VARIABLE -> Success> -- Performing Test HAVE_C_WNO_MISSING_PROTOTYPES> -- Performing Test HAVE_C_WNO_MISSING_PROTOTYPES -> Success> -- Performing Test HAVE_C_WNO_MISSING_DECLARATIONS> -- Performing Test HAVE_C_WNO_MISSING_DECLARATIONS -> Success> -- Performing Test HAVE_C_WNO_UNDEF> -- Performing Test HAVE_C_WNO_UNDEF - Success> -- Performing Test HAVE_C_WNO_UNUSED> -- Performing Test HAVE_C_WNO_UNUSED - Success> -- Performing Test HAVE_C_WNO_CAST_ALIGN> -- Performing Test HAVE_C_WNO_CAST_ALIGN - Success> -- Performing Test HAVE_C_WNO_SHADOW> -- Performing Test HAVE_C_WNO_SHADOW - Success> -- Performing Test HAVE_C_WNO_MAYBE_UNINITIALIZED> -- Performing Test HAVE_C_WNO_MAYBE_UNINITIALIZED -> Success> -- Performing Test HAVE_C_WNO_POINTER_TO_INT_CAST> -- Performing Test HAVE_C_WNO_POINTER_TO_INT_CAST -> Success> -- Performing Test HAVE_C_WNO_INT_TO_POINTER_CAST> -- Performing Test HAVE_C_WNO_INT_TO_POINTER_CAST -> Success> -- Performing Test HAVE_C_WNO_MISLEADING_INDENTATION> -- Performing Test HAVE_C_WNO_MISLEADING_INDENTATION -> Failed> -- Performing Test HAVE_CXX_WNO_MISSING_DECLARATIONS> -- Performing Test HAVE_CXX_WNO_MISSING_DECLARATIONS -> Success> -- Performing Test HAVE_CXX_WNO_UNUSED_PARAMETER> -- Performing Test HAVE_CXX_WNO_UNUSED_PARAMETER -> Success> -- Performing Test HAVE_CXX_WNO_UNDEF> -- Performing Test HAVE_CXX_WNO_UNDEF - Success> -- Performing Test HAVE_C_WNO_UNUSED_VARIABLE> -- Performing Test HAVE_C_WNO_UNUSED_VARIABLE - Success> -- Performing Test HAVE_C_WNO_UNUSED_FUNCTION> -- Performing Test HAVE_C_WNO_UNUSED_FUNCTION - Success> -- Performing Test HAVE_C_WNO_IMPLICIT_FUNCTION_DECLARATION> -- Performing Test HAVE_C_WNO_IMPLICIT_FUNCTION_DECLARATION> - Success> -- Performing Test HAVE_C_WNO_UNINITIALIZED> -- Performing Test HAVE_C_WNO_UNINITIALIZED - Success> -- Performing Test HAVE_C_WNO_UNUSED_BUT_SET_PARAMETER> -- Performing Test HAVE_C_WNO_UNUSED_BUT_SET_PARAMETER -> Success> -- Performing Test HAVE_C_WNO_STRICT_OVERFLOW> -- Performing Test HAVE_C_WNO_STRICT_OVERFLOW - Success> -- Performing Test HAVE_C_WNO_POINTER_COMPARE> -- Performing Test HAVE_C_WNO_POINTER_COMPARE - Failed> -- Performing Test HAVE_C_WNO_ABSOLUTE_VALUE> -- Performing Test HAVE_C_WNO_ABSOLUTE_VALUE - Failed> -- Performing Test HAVE_C_WNO_STRICT_PROTOTYPES> -- Performing Test HAVE_C_WNO_STRICT_PROTOTYPES - Success> -- The ASM compiler identification is GNU> -- Found assembler: /home/wmmc88/Android/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc> -- Looking for semaphore.h> -- Looking for semaphore.h - found> -- Performing Test HAVE_CXX_WNO_SHADOW> -- Performing Test HAVE_CXX_WNO_SHADOW - Success> -- Performing Test HAVE_CXX_WNO_UNUSED> -- Performing Test HAVE_CXX_WNO_UNUSED - Success> -- Performing Test HAVE_CXX_WNO_SIGN_COMPARE> -- Performing Test HAVE_CXX_WNO_SIGN_COMPARE - Success> -- Performing Test HAVE_CXX_WNO_UNINITIALIZED> -- Performing Test HAVE_CXX_WNO_UNINITIALIZED - Success> -- Performing Test HAVE_CXX_WNO_SWITCH> -- Performing Test HAVE_CXX_WNO_SWITCH - Success> -- Performing Test HAVE_CXX_WNO_PARENTHESES> -- Performing Test HAVE_CXX_WNO_PARENTHESES - Success> -- Performing Test HAVE_CXX_WNO_ARRAY_BOUNDS> -- Performing Test HAVE_CXX_WNO_ARRAY_BOUNDS - Success> -- Performing Test HAVE_CXX_WNO_EXTRA> -- Performing Test HAVE_CXX_WNO_EXTRA - Success> -- Performing Test HAVE_CXX_WNO_DEPRECATED_DECLARATIONS> -- Performing Test HAVE_CXX_WNO_DEPRECATED_DECLARATIONS -> Success> -- Performing Test HAVE_CXX_WNO_MISLEADING_INDENTATION> -- Performing Test HAVE_CXX_WNO_MISLEADING_INDENTATION -> Failed> -- Performing Test HAVE_CXX_WNO_DEPRECATED> -- Performing Test HAVE_CXX_WNO_DEPRECATED - Success> -- Performing Test HAVE_CXX_WNO_SUGGEST_OVERRIDE> -- Performing Test HAVE_CXX_WNO_SUGGEST_OVERRIDE - Failed> -- Performing Test HAVE_CXX_WNO_INCONSISTENT_MISSING_OVERRIDE> -- Performing Test HAVE_CXX_WNO_INCONSISTENT_MISSING_OVERRIDE - Failed> -- Performing Test HAVE_CXX_WNO_IMPLICIT_FALLTHROUGH> -- Performing Test HAVE_CXX_WNO_IMPLICIT_FALLTHROUGH -> Failed> -- Performing Test HAVE_CXX_WNO_MISSING_PROTOTYPES> -- Performing Test HAVE_CXX_WNO_MISSING_PROTOTYPES -> Failed> -- TBB: Download: 2018_U1.tar.gz> -- Performing Test HAVE_CXX_WNO_UNUSED_LOCAL_TYPEDEFS> -- Performing Test HAVE_CXX_WNO_UNUSED_LOCAL_TYPEDEFS -> Success> -- Performing Test HAVE_CXX_WNO_SIGN_PROMO> -- Performing Test HAVE_CXX_WNO_SIGN_PROMO - Success> -- Performing Test HAVE_CXX_WNO_TAUTOLOGICAL_UNDEFINED_COMPARE> -- Performing Test HAVE_CXX_WNO_TAUTOLOGICAL_UNDEFINED_COMPARE> - Failed> -- Performing Test HAVE_CXX_WNO_IGNORED_QUALIFIERS> -- Performing Test HAVE_CXX_WNO_IGNORED_QUALIFIERS -> Success> -- Performing Test HAVE_CXX_WNO_UNUSED_FUNCTION> -- Performing Test HAVE_CXX_WNO_UNUSED_FUNCTION - Success> -- Performing Test HAVE_CXX_WNO_UNUSED_CONST_VARIABLE> -- Performing Test HAVE_CXX_WNO_UNUSED_CONST_VARIABLE -> Failed> -- Performing Test HAVE_CXX_WNO_SHORTEN_64_TO_32> -- Performing Test HAVE_CXX_WNO_SHORTEN_64_TO_32 - Failed> -- Performing Test HAVE_CXX_WNO_INVALID_OFFSETOF> -- Performing Test HAVE_CXX_WNO_INVALID_OFFSETOF -> Success> -- Performing Test HAVE_CXX_WNO_ENUM_COMPARE_SWITCH> -- Performing Test HAVE_CXX_WNO_ENUM_COMPARE_SWITCH -> Failed> -- Update variable ANDROID_SDK from environment: /home/wmmc88/Android/Sdk> -- Android SDK Tools: ver. 25.2.5> -- Android SDK Build Tools: ver. 25.0.3 (subdir 25.0.3 from 25.0.3) CMake Error at> cmake/android/OpenCVDetectAndroidSDK.cmake:184> (message): Android SDK: Can't build> Android projects as requested by > BUILD_ANDROID_PROJECTS=ON variable.>> Use BUILD_ANDROID_PROJECTS=OFF to> prepare Android project files without > building them Call Stack (most recent> call first): CMakeLists.txt:644> (include)>>> -- Configuring incomplete, errors occurred! See also> "/home/wmmc88/OpenCVRepo/opencv/platforms/Custom/test/o4a/CMakeFiles/CMakeOutput.log".> See also> "/home/wmmc88/OpenCVRepo/opencv/platforms/Custom/test/o4a/CMakeFiles/CMakeError.log".> Traceback (most recent call last): > File "../android/build_sdk.py", line> 368, in > builder.build_library(abi, do_install) File> "../android/build_sdk.py", line 184,> in build_library> execute(cmd) File "../android/build_sdk.py", line 23, in> execute> raise Fail("Child returned: %s" % retcode)> __main__.Fail: Child returned: 1
↧
[HELP] CvException @ Dnn.forward() in Android
I'm trying to implement Gil Levi and Tal Hassner.Age and Gender Classification Using Convolutional Neural Networks to Android app but I'm getting an error on Dnn.forward(). I followed this link:[tutorial](https://docs.opencv.org/3.4.0/d0/d6c/tutorial_dnn_android.html "tutorial") and I get following error:
**CvException [org.opencv.core.CvException: cv::Exception: OpenCV(3.4.2) /build/3_4_pack-android/opencv/modules/dnn/src/layers/convolution_layer.cpp:236: error: (-215:Assertion failed) ngroups > 0 && inpCn % ngroups == 0 && outCn % ngroups == 0 in function 'virtual bool cv::dnn::ConvolutionLayerImpl::getMemoryShapes(const std::vector>&, int, std::vector>&, std::vector>&) const']**
If could somebody help me, I'll be grateful :)
*Code snippet:*
@Override
public Mat onCameraFrame(CameraBridgeViewBase.CvCameraViewFrame inputFrame) {
mRgba = inputFrame.rgba();
mGray = inputFrame.gray();
if (mAbsoluteFaceSize == 0) {
int height = mGray.rows();
if (Math.round(height * mRelativeFaceSize) > 0) {
mAbsoluteFaceSize = Math.round(height * mRelativeFaceSize);
}
}
MatOfRect faces = new MatOfRect();
// Use the classifier to detect faces
if (mFaceDetector != null) {
mFaceDetector.detectMultiScale(mGray, faces, 1.1, 2, 2, new Size(mAbsoluteFaceSize, mAbsoluteFaceSize), new Size());
}else {
Log.e(TAG, "Detection is not selected!");
}
// If there are any faces found, draw a rectangle around it
Rect[] facesArray = faces.toArray();
for (int i = 0; i < facesArray.length; i++) {
Imgproc.rectangle(mRgba, facesArray[i].tl(), facesArray[i].br(), new Scalar(0, 255, 0, 255), 3);
}
if (facesArray.length == 1) {
try {
for (Rect face : facesArray) {
Mat capturedFace = new Mat(mGray, face);
Mat inputBlob = Dnn.blobFromImage(capturedFace, 1.0f, new Size(256, 256), new Scalar(0), false, false);
net.setInput(inputBlob, "data");
Mat detections = net.forward("prob");
int cols = capturedFace.cols();
int rows = capturedFace.rows();
detections = detections.reshape(1, (int) detections.total() / 7);
for (int i = 0; i < detections.rows(); i++) {
double confidence = detections.get(i, 2)[0];
if (confidence > THRESHOLD) {
int classId = (int) detections.get(i, 1)[0];
int xLeftBottom = (int) (detections.get(i, 3)[0] * cols);
int yLeftBottom = (int) (detections.get(i, 4)[0] * rows);
int xRightTop = (int) (detections.get(i, 5)[0] * cols);
int yRightTop = (int) (detections.get(i, 6)[0] * rows);
// Draw rectangle around detected object.
Imgproc.rectangle(capturedFace, new Point(xLeftBottom, yLeftBottom),
new Point(xRightTop, yRightTop),
new Scalar(0, 255, 0));
String label = classId + ": " + confidence;
// Write class name and confidence.
Imgproc.putText(capturedFace, label, new Point(xLeftBottom, yLeftBottom),
Core.FONT_HERSHEY_SIMPLEX, 0.5, new Scalar(0, 0, 0));
}
}
}
} catch (Exception e) {
Log.e(TAG, "Error", e);
}
}
return mRgba;
}
↧
How to use ROC curve class in opencv?
In evaluate.cpp file
computeRecallPrecisionCurve( const std::vector>& matches1to2,
const std::vector>& correctMatches1to2Mask,
std::vector& recallPrecisionCurve )
class is used to calculate ROC curve for feature matching for benchmark estimation. How did it works, How the correctmatches1tomask is calculated.
↧
Link fails when cross compiling OpenCV 3.3.1 for Raspberry Pi Zero even though libraries are present
I've been attempting to build OpenCV 3.3.1 for the Raspberry PI Zero (Raspbian stretch) on a Ubuntu 16.04 machine. I've been following the steps documented here https://github.com/HesselM/rpicross_notes with the major exception that instead of using the tools from https://github.com/raspberrypi/tools which have GCC 4.9.3 I used crosstool-ng to build a GCC 6.3.0 toolchain to match the GCC version shipped with Raspbian stretch. I've installed all the OpenCV prerequistites on a RaspberryPi Zero and then taken a copy of the filesystem to use as the system root for cross-compilation on the host.
CMake confliguration appears to work but the make build fails when linking `libopencv_freetype.so` as the harfbuzz and freetype libraries are not found.
/opt/cross/x-tools/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/6.3.0/../../../../arm-unknown-linux-gnueabihf/bin/ld: cannot find -lfreetype
/opt/cross/x-tools/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/6.3.0/../../../../arm-unknown-linux-gnueabihf/bin/ld: cannot find -lharfbuzz
collect2: error: ld returned 1 exit status
modules/freetype/CMakeFiles/opencv_freetype.dir/build.make:97: recipe for target 'lib/libopencv_freetype.so.3.3.1' failed
These libraries are present in my RaspberryPI system in usr/lib/arm-linux-gnueabihf
-rw-r--r-- 1 dsnowdon dsnowdon 717178 Apr 27 2017 libfreetype.a
-rw-r--r-- 1 dsnowdon dsnowdon 909 Apr 27 2017 libfreetype.la
lrwxrwxrwx 1 dsnowdon dsnowdon 21 Apr 27 2017 libfreetype.so -> libfreetype.so.6.12.3
lrwxrwxrwx 1 dsnowdon dsnowdon 21 Apr 27 2017 libfreetype.so.6 -> libfreetype.so.6.12.3
-rw-r--r-- 1 dsnowdon dsnowdon 567844 Apr 27 2017 libfreetype.so.6.12.3
-rw-r--r-- 1 dsnowdon dsnowdon 739360 Jan 24 2017 libharfbuzz.a
lrwxrwxrwx 1 dsnowdon dsnowdon 24 Jan 24 2017 libharfbuzz.so -> libharfbuzz.so.0.10400.2
lrwxrwxrwx 1 dsnowdon dsnowdon 24 Jan 24 2017 libharfbuzz.so.0 -> libharfbuzz.so.0.10400.2
-rw-r--r-- 1 dsnowdon dsnowdon 551256 Jan 24 2017 libharfbuzz.so.0.10400.2
Building with make VERBOSE=1 shows that the failure occurs when this command is run:
/usr/bin/cmake -E cmake_link_script CMakeFiles/opencv_freetype.dir/link.txt --verbose=1
Which generates this:
/opt/cross/x-tools/arm-unknown-linux-gnueabihf/bin/arm-unknown-linux-gnueabihf-g++ -fPIC -isystem /opt/software/raspberrypi/rpi-cross/rootfs/usr/include/arm-linux-gnueabihf -isystem /opt/software/raspberrypi/rpi-cross/rootfs/usr/include -isystem /opt/software/raspberrypi/rpi-cross/rootfs/usr/local/include -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -mfp16-format=ieee -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG -shared -Wl,-soname,libopencv_freetype.so.3.3 -o ../../lib/libopencv_freetype.so.3.3.1 CMakeFiles/opencv_freetype.dir/src/freetype.cpp.o ../../lib/libopencv_imgproc.so.3.3.1 -ldl -lm -lpthread -lrt ../../3rdparty/lib/libtegra_hal.a -lfreetype -lharfbuzz ../../lib/libopencv_core.so.3.3.1
However if I manually add `-L${RPI_ROOTFS}/usr/lib/arm-linux-gnueabihf` to give the following then the link works:
/opt/cross/x-tools/arm-unknown-linux-gnueabihf/bin/arm-unknown-linux-gnueabihf-g++ -L/opt/software/raspberrypi/rpi-cross/rootfs/usr/lib/arm-linux-gnueabihf -fPIC -isystem /opt/software/raspberrypi/rpi-cross/rootfs/usr/include/arm-linux-gnueabihf -isystem /opt/software/raspberrypi/rpi-cross/rootfs/usr/include -isystem /opt/software/raspberrypi/rpi-cross/rootfs/usr/local/include -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -mfp16-format=ieee -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG -shared -Wl,-soname,libopencv_freetype.so.3.3 -o ../../lib/libopencv_freetype.so.3.3.1 CMakeFiles/opencv_freetype.dir/src/freetype.cpp.o ../../lib/libopencv_imgproc.so.3.3.1 -ldl -lm -lpthread -lrt ../../3rdparty/lib/libtegra_hal.a -lfreetype -lharfbuzz ../../lib/libopencv_core.so.3.3.1
This led me to think that maybe pkg-config was being called in such a way it was not emitting the correct libdir so I wrote a wrapper script for pkg-config to dump all the invocations by CMake and the output of running the command.
Wrapper script:
#! /bin/bash
LOGFILE=/tmp/pkg-config-wrapper.log
basename="`basename "$0"`"
timestamp=$(date)
printf "${timestamp} ${basename} $@\nPKG_CONFIG_DIR=${PKG_CONFIG_DIR}\nPKG_CONFIG_LIBDIR=${PKG_CONFIG_LIBDIR}\nPKG_CONFIG_SYSROOT_DIR=${PKG_CONFIG_SYSROOT_DIR}\n" >> $LOGFILE
result=$(/usr/bin/pkg-config "$@")
printf "pkf-config = ${result}\n" >> $LOGFILE
echo $result
The output of the wrapper script is here: https://gist.github.com/davesnowdon/548c87d735433d73c587210a27995b6c
As far as I can see pkg-config is being invoked correctly for cross-compilation so now I'm at a loss and am not sure what to try next.
I'm invoking CMake as follows:
cmake \
-D RPI_ROOTFS=${RPI_ROOTFS} \
-D BUILD_TESTS=NO \
-D BUILD_PERF_TESTS=NO \
-D BUILD_PYTHON_SUPPORT=ON \
-D OPENCV_EXTRA_MODULES_PATH=${RPI_CROSS_HOME}/src/opencv_contrib-3.3.1/modules \
-D CMAKE_TOOLCHAIN_FILE=${RPI_CROSS_HOME}/src/opencv-3.3.1/platforms/linux/arm.toolchain.cmake \
${RPI_CROSS_HOME}/src/opencv-3.3.1
Most of the changes to the OpenCV Cmake files are in `opencv-3.3.1/cmake/OpenCVMinDepVersions.cmake` as described in https://github.com/HesselM/rpicross_notes
set(MIN_VER_CMAKE 2.8.12.2)
set(MIN_VER_CUDA 6.5)
set(MIN_VER_PYTHON2 2.6)
set(MIN_VER_PYTHON3 3.2)
set(MIN_VER_ZLIB 1.2.3)
set(MIN_VER_GTK 2.18.0)
# install dir
set( CMAKE_INSTALL_PREFIX ${RPI_ROOTFS}/usr/local CACHE STRING "")
set( CMAKE_FIND_ROOT_PATH "${RPI_ROOTFS}" CACHE FILEPATH "")
set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
# compilers
set( CMAKE_C_COMPILER "/opt/cross/x-tools/arm-unknown-linux-gnueabihf/bin/arm-unknown-linux-gnueabihf-gcc" CACHE FILEPATH "")
set( CMAKE_CXX_COMPILER "/opt/cross/x-tools/arm-unknown-linux-gnueabihf/bin/arm-unknown-linux-gnueabihf-g++" CACHE FILEPATH "")
set( CMAKE_AR "/opt/cross/x-tools/arm-unknown-linux-gnueabihf/bin/arm-unknown-linux-gnueabihf-ar" CACHE FILEPATH "")
set( CMAKE_RANLIB "/opt/cross/x-tools/arm-unknown-linux-gnueabihf/bin/arm-unknown-linux-gnueabihf-ranlib" CACHE FILEPATH "")
#Pkg-config settings
set( RPI_PKGCONFIG_LIBDIR "${RPI_PKGCONFIG_LIBDIR}:${RPI_ROOTFS}/usr/lib/arm-linux-gnueabihf/pkgconfig" )
set( RPI_PKGCONFIG_LIBDIR "${RPI_PKGCONFIG_LIBDIR}:${RPI_ROOTFS}/usr/share/pkgconfig" )
set( RPI_PKGCONFIG_LIBDIR "${RPI_PKGCONFIG_LIBDIR}:${RPI_ROOTFS}/opt/vc/lib/pkgconfig" )
#set( PKG_CONFIG_EXECUTABLE "/usr/bin/pkg-config" CACHE FILEPATH "")
set( PKG_CONFIG_EXECUTABLE "/opt/cross/pkg-config-wrapper.sh" CACHE FILEPATH "")
set( ENV{PKG_CONFIG_DIR} "" CACHE FILEPATH "")
set( ENV{PKG_CONFIG_LIBDIR} "${RPI_PKGCONFIG_LIBDIR}" CACHE FILEPATH "")
set( ENV{PKG_CONFIG_SYSROOT_DIR} "${RPI_ROOTFS}" CACHE FILEPATH "")
# setup rpi (target) directories for compiler
set( RPI_INCLUDE_DIR "${RPI_INCLUDE_DIR} -isystem ${RPI_ROOTFS}/usr/include/arm-linux-gnueabihf")
set( RPI_INCLUDE_DIR "${RPI_INCLUDE_DIR} -isystem ${RPI_ROOTFS}/usr/include")
set( RPI_INCLUDE_DIR "${RPI_INCLUDE_DIR} -isystem ${RPI_ROOTFS}/usr/local/include")
set( RPI_LIBRARY_DIR "${RPI_LIBRARY_DIR} -Wl,-rpath ${RPI_ROOTFS}/usr/lib/arm-linux-gnueabihf")
set( RPI_LIBRARY_DIR "${RPI_LIBRARY_DIR} -Wl,-rpath ${RPI_ROOTFS}/lib/arm-linux-gnueabihf")
# Setup C/CXX flags.
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${RPI_INCLUDE_DIR}" CACHE STRING "" FORCE)
set( CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} ${RPI_INCLUDE_DIR}" CACHE STRING "" FORCE)
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${RPI_LIBRARY_DIR}" CACHE STRING "" FORCE)
#Python2.7
set( PYTHON_EXECUTABLE /usr/bin/python2.7 CACHE STRING "")
set( PYTHON_LIBRARY_DEBUG "${RPI_ROOTFS}/usr/lib/arm-linux-gnueabihf/libpython2.7.so" CACHE STRING "")
set( PYTHON_LIBRARY_RELEASE "${RPI_ROOTFS}/usr/lib/arm-linux-gnueabihf/libpython2.7.so" CACHE STRING "")
set( PYTHON_LIBRARY "${RPI_ROOTFS}/usr/lib/arm-linux-gnueabihf/libpython2.7.so" CACHE STRING "")
set( PYTHON_INCLUDE_DIR "${RPI_ROOTFS}/usr/include/python2.7" CACHE STRING "")
set( PYTHON2_NUMPY_INCLUDE_DIRS "${RPI_ROOTFS}/usr/lib/python2.7/dist-packages/numpy/core/include" CACHE STRING "")
set( PYTHON2_PACKAGES_PATH "${RPI_ROOTFS}/usr/local/lib/python2.7/site-packages" CACHE STRING "")
I also changed `opencv-3.3.1/platforms/linux/arm.toolchain.cmake` according to https://github.com/HesselM/rpicross_notes replacing "-mthumb" with "-marm" to give this
if(COMMAND toolchain_save_config)
return() # prevent recursive call
endif()
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_VERSION 1)
if(NOT DEFINED CMAKE_SYSTEM_PROCESSOR)
set(CMAKE_SYSTEM_PROCESSOR arm)
else()
#message("CMAKE_SYSTEM_PROCESSOR=${CMAKE_SYSTEM_PROCESSOR}")
endif()
include("${CMAKE_CURRENT_LIST_DIR}/gnu.toolchain.cmake")
if(CMAKE_SYSTEM_PROCESSOR STREQUAL arm AND NOT ARM_IGNORE_FP)
set(FLOAT_ABI_SUFFIX "")
if(NOT SOFTFP)
set(FLOAT_ABI_SUFFIX "hf")
endif()
endif()
if(NOT "x${GCC_COMPILER_VERSION}" STREQUAL "x")
set(__GCC_VER_SUFFIX "-${GCC_COMPILER_VERSION}")
endif()
if(NOT DEFINED CMAKE_C_COMPILER)
find_program(CMAKE_C_COMPILER NAMES ${GNU_MACHINE}${FLOAT_ABI_SUFFIX}-gcc${__GCC_VER_SUFFIX})
else()
#message(WARNING "CMAKE_C_COMPILER=${CMAKE_C_COMPILER} is defined")
endif()
if(NOT DEFINED CMAKE_CXX_COMPILER)
find_program(CMAKE_CXX_COMPILER NAMES ${GNU_MACHINE}${FLOAT_ABI_SUFFIX}-g++${__GCC_VER_SUFFIX})
else()
#message(WARNING "CMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} is defined")
endif()
if(NOT DEFINED CMAKE_LINKER)
find_program(CMAKE_LINKER NAMES ${GNU_MACHINE}${FLOAT_ABI_SUFFIX}-ld${__GCC_VER_SUFFIX} ${GNU_MACHINE}${FLOAT_ABI_SUFFIX}-ld)
else()
#message(WARNING "CMAKE_LINKER=${CMAKE_LINKER} is defined")
endif()
if(NOT DEFINED CMAKE_AR)
find_program(CMAKE_AR NAMES ${GNU_MACHINE}${FLOAT_ABI_SUFFIX}-ar${__GCC_VER_SUFFIX} ${GNU_MACHINE}${FLOAT_ABI_SUFFIX}-ar)
else()
#message(WARNING "CMAKE_AR=${CMAKE_AR} is defined")
endif()
if(NOT DEFINED ARM_LINUX_SYSROOT AND DEFINED GNU_MACHINE)
set(ARM_LINUX_SYSROOT /usr/${GNU_MACHINE}${FLOAT_ABI_SUFFIX})
endif()
if(NOT DEFINED CMAKE_CXX_FLAGS)
set(CMAKE_CXX_FLAGS "" CACHE INTERAL "")
set(CMAKE_C_FLAGS "" CACHE INTERAL "")
set(CMAKE_SHARED_LINKER_FLAGS "" CACHE INTERAL "")
set(CMAKE_MODULE_LINKER_FLAGS "" CACHE INTERAL "")
set(CMAKE_EXE_LINKER_FLAGS "" CACHE INTERAL "")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdata-sections -Wa,--noexecstack -fsigned-char -Wno-psabi")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fdata-sections -Wa,--noexecstack -fsigned-char -Wno-psabi")
if(CMAKE_SYSTEM_PROCESSOR STREQUAL arm)
set(CMAKE_CXX_FLAGS "-marm ${CMAKE_CXX_FLAGS}")
set(CMAKE_C_FLAGS "-marm ${CMAKE_C_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,nocopyreloc")
endif()
if(CMAKE_SYSTEM_PROCESSOR STREQUAL arm)
set(ARM_LINKER_FLAGS "-Wl,--fix-cortex-a8 -Wl,--no-undefined -Wl,--gc-sections -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now")
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64)
set(ARM_LINKER_FLAGS "-Wl,--no-undefined -Wl,--gc-sections -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now")
endif()
set(CMAKE_SHARED_LINKER_FLAGS "${ARM_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS "${ARM_LINKER_FLAGS} ${CMAKE_MODULE_LINKER_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${ARM_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}")
else()
#message(WARNING "CMAKE_CXX_FLAGS='${CMAKE_CXX_FLAGS}' is defined")
endif()
if(USE_NEON)
message(WARNING "You use obsolete variable USE_NEON to enable NEON instruction set. Use -DENABLE_NEON=ON instead." )
set(ENABLE_NEON TRUE)
elseif(USE_VFPV3)
message(WARNING "You use obsolete variable USE_VFPV3 to enable VFPV3 instruction set. Use -DENABLE_VFPV3=ON instead." )
set(ENABLE_VFPV3 TRUE)
endif()
set(CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH} ${ARM_LINUX_SYSROOT})
if(EXISTS ${CUDA_TOOLKIT_ROOT_DIR})
set(CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH} ${CUDA_TOOLKIT_ROOT_DIR})
endif()
set(TOOLCHAIN_CONFIG_VARS ${TOOLCHAIN_CONFIG_VARS}
ARM_LINUX_SYSROOT
ENABLE_NEON
ENABLE_VFPV3
CUDA_TOOLKIT_ROOT_DIR
)
toolchain_save_config()
The output from CMake is here: https://gist.github.com/davesnowdon/c9904c315c84863ea8840f2752145126
At this point I'm at a loss and don't know what to try next. What could be the problem?
↧
↧
Synchronize video and audio
I am trying to create a system that gets broadcasts from clients, improve the quality of the frames with OpenCV and then rebroadcast to some external servers.
My problem is that I am getting the broadcast from an RTMP, with video and audio, when I want to rebroadcast, how can I synchronize video and audio again ?
I thought of using Ffmpeg to do the audio and OpenCV to do the video but If I get 2 RTMP streaming from clients that is goint to take much more bandwidth from them.
Any suggestions ?
Thank you !
↧
Skeleton algorithms with minimal artifacts
I've seen a couple simple algorithms for deriving the 'skeleton' of a shape (known as a 'fiber' in some image processing texts). Example: http://felix.abecassis.me/2011/09/opencv-morphological-skeleton/
But many exhibit artifacts, small side-threads or similar. You'll see the small diverging lines in the B at the link above. That's very common. Felix's page above is very cool, and the code does what it is supposed to do, so no complaints there. I'm just looking for a function that would minimize this, even at the expense of runtime or coding effort.
Any ideas?
↧
Android Object tracking
I'm building an Android based OpenCV application that needs to track objects. I was reading an article on pyimagesearch that uses various object tracking implementations (KCF, CSRT, MOSSE, etc) that are available in OpenCV 3+. I would love to try these in my android application but I don't see them exposed in the Android SDK. Are these implementations available in the SDK?
↧
OpenCV Java How can I find red lined Rectangles from 12 rectangles.
I am running into a very unique problem statement. I have an image which will have 12 led lights and a few out of them will glow as red. After trying out multiple algorithms, I have reached till this stage (See Image Below ) from an RGB image taken from the camera.

I have reached to this image by applying this algorithms -
Mat detectedEdges = new Mat(ImageMat.rows(), ImageMat.cols(), CvType.CV_8UC1);
//Imgproc.blur(ImageMatNew, detectedEdges, new Size(3,3));
Imgproc.GaussianBlur(ImageMatNew, detectedEdges, new Size(3,3), 7);
Imgproc.Canny(detectedEdges, detectedEdges, 70, 70 * 3, 3, false);
Imgproc.adaptiveThreshold(detectedEdges, detectedEdges, 200,Imgproc.ADAPTIVE_THRESH_GAUSSIAN_C , Imgproc.THRESH_BINARY_INV,3, 7);
Imgproc.Canny(detectedEdges, detectedEdges, 10, 10 * 7, 7, true);
Now From here, I am completely lost. I have searched all over places and tried multiple approaches. So My problem state goes like this;
In this Image, there will be always 12 rectangles. Few rectangles will be red single lined eclosed and others will be black double lined eclosed rectangles. I have to find these single lined red enclosed rectangles and their number from top to bottom or bottom to top between 1-12.
I was trying with contours but I don't think contours are going to solve my any problem. Because I tried with Contour Area but here I can match the area or even can't approximate the area so that I can iterate from top to bottom.
I am stuck in this problem since a week. any slight hint or approach will help me Thanks in Advance.
↧
↧
Help with: Active Canny: Edge Detection and Recovery with Open Active Contour Models. Confused and stuck
This looks to be a promising article for the implementation of joining the broken edges of an image.
[Active Canny: Edge Detection and Recovery with Open Active Contour Models](https://arxiv.org/pdf/1609.03415.pdf)

Major steps.
1. Find Gradient Magnitude from Color or Grayscale image.
2. Non Maxima Suppression of the gradient Magnitude.
3. Similar to Canny Higher Threshold and Lower Threshold, Select pixels with higher threshold as seed pixels.
4. From seed pixels, initiate snakelets in decreasing order of gradient magnitude.
5. Two unidirectional snakelets are initiated from a seed and they grow in opposite directions.
6. The initial snakelets grow to a specific initial length, e.g., 10 − 15. The GVF is computer over the nonmaximum suppressed gradient magnitude image with 3 − 5 initial
iterations
7. If a seed pixel is already covered by a previous snakelet, it is discarded. This way, we obtain a set of short snakelets over the strong gradients.
8. The snakelets grow and split recursively until they reach an existing snakelet or they cannot grow anymore (gradient lower than TL)
9. When a snakelet reaches maximum growing length, e.g., 40, it stops growing; a new short snakelet is initiated at the end of it to continue growing.
This is what the article says at the end. The growing force is proportional to the gradient magnitude at the end of the snakelet. This recursive growing of snakelets is analogous to the hysteresis thresholding and edge linking of Canny edge detection. However, a snakelet grows in one direction, while edge pixels are linked in all directions in Canny.
Steps 1,2,3 are done.
Step 4 is something that is very confusing how do I initiate snakelets in decreasing order of gradient magnitude?
↧
solvePnP object pose for Omnidirectional model
I'm interested in pose estimation using slightly different sensors called omnidirectional camera, they are based on `Unified Omnidirectional Model` to project 3D points into image plane.
`Opencv` has a function called `solvePnP` to find the pose of an object using couple of 2D-3D points for standard cameras.
My question is if there is a similar function for those particular cameras? in `opencv` or any other library.
↧
How to read multiple images from a path in c++?
I have to extract HOG features of 37 images from a folder(RGB images), hence i wrote the following code. But when i run this ,the program breaks in 'if (!img.data)' . >
using namespace cv;
using namespace std;
int main()
{
HOGDescriptor hog;
hog.winSize = Size(32, 48);
for (size_t i = 1; i <= 37; ++i)
{
ostringstream os;
os << " C:/Users/Sam/Desktop/HumanCount/Training Images/Content/ " << "positive\\" << std::setw(4) << std::setfill('0') << i << ".JPG";
Mat img = imread(os.str(), CV_LOAD_IMAGE_GRAYSCALE);
if (!img.data)
{
break;
}
else
{
// obtain feature vector:
vector featureVector;
hog.compute(img, featureVector, Size(8, 8), Size(0, 0));
}
return 0;
}
}
↧
How to filter FREAK+BruteForceMatcher result?
I have 2 questions about FREAK implementation in opencv I really need to know to continue:
1. I cannot get what the 64 values (columns) returned for each keypoint ? FREAK should return binary values as I understand?
2. I used BruteForceMatcher like in FREAK_demo.cpp in opencv samples. however it always give matches that may be wrong .. so I want to filter result ... I want to use the distance variable in the DMatch object returned but I cannot get what it representing in case of Hamming distance?.. should I take the big distances or small ?? what is the expected range for it ? I cannot find in any documentation
↧
↧
opencv trackbar not showing at all
#include
#include
#include
using namespace std;
using namespace cv;
Mat srimg, deimg;
int max_brightness = 100;
int slider_b = (max_brightness / 2);
void on_change_brightness(int, void*)
{
int brightness = slider_b - (max_brightness / 2);
deimg = srimg + Scalar::all(brightness);
imshow("Girl", deimg);
}
int main()
{
srimg = imread("lenna.PNG");
imshow("girl", srimg);
createTrackbar("Track", "Window", &slider_b, max_brightness,on_change_brightness);
waitKey();
return EXIT_SUCCESS;
}
Note:: when i run the code it works well no error but the track bar does not show up, and to my knowledge everything should be fine any help pls .. Thanks in advance
↧
OpenCV Cuda alphaComp, blending a 0 image repeatedly makes it darker
I am experiencing strange behavior with alpha compositing using OpenCV 3.4.1 and Cuda.
When I blend an all-black image with an all-zero alpha channel to another image, and repeat this process recursively, the image becomes darker, settling at around 50% brightness.
Is this some kind of bug, or am I misunderstanding something fundamental about alpha compositing? The documentation on the different blend modes is sparse.
I have written a short example code illustrating what happens. When run once, the rectangle seems to stay green. However, putting this in a loop makes the rectangle slowly fade out until it becomes dark-green.


#include
#include
#include
#include
#include
#include
#include
using namespace std;
using namespace cv;
int main(int argc, char *argv[])
{
Mat frame(1080, 1920, CV_8UC4, Scalar(0, 0, 0, 255));
namedWindow("test", CV_WINDOW_OPENGL);
// Drawing a green rectangle with 100% opacity
rectangle(frame, Rect(10, 10, 200, 200), Scalar(0, 255, 0, 255), CV_FILLED);
cuda::GpuMat gpuFrame(frame);
while(true){
// Creating an all-black image with 0% opacity
cuda::GpuMat gpuBlank(1080, 1920, CV_8UC4, Scalar(0, 0, 0, 0));
// Alpha-compositing them together should keep the image untouched..?
cuda::alphaComp(gpuFrame, gpuBlank, gpuFrame, cuda::ALPHA_OVER);
// Splitting the image into 4 mats, to remove any resulting opacity from the image
// Hopefully coming out with another 100% opacity image to blend again
vector frameChannels;
cuda::split(gpuFrame, frameChannels);
cuda::GpuMat fullAlpha(1080, 1920, CV_8UC1, Scalar(255));
if (gpuFrame.channels() > 3) {
frameChannels.pop_back();
}
frameChannels.push_back(fullAlpha);
cuda::merge(frameChannels, gpuFrame);
imshow("test", gpuFrame);
waitKey(1);
}
while(1) {
waitKey(1);
}
}
↧
opencv-3.4.1 build error: source code error(not sure)?
.
/public/home/lijingsk/deng/opencv-3.4.1/modules/imgcodecs/src/grfmt_tiff.cpp:132:12: error: 'tmsize_t' does not name a type; did you mean 'ssize_t'?
static tmsize_t read( thandle_t handle, void* buffer, tmsize_t n )
^~~~~~~~
ssize_t
/public/home/lijingsk/deng/opencv-3.4.1/modules/imgcodecs/src/grfmt_tiff.cpp:147:12: error: 'tmsize_t' does not name a type; did you mean 'ssize_t'?
static tmsize_t write( thandle_t /*handle*/, void* /*buffer*/, tmsize_t /*n*/ )
^~~~~~~~
ssize_t
/public/home/lijingsk/deng/opencv-3.4.1/modules/imgcodecs/src/grfmt_tiff.cpp: In member function 'virtual bool cv::TiffDecoder::readHeader()':
/public/home/lijingsk/deng/opencv-3.4.1/modules/imgcodecs/src/grfmt_tiff.cpp:213:108: error: 'read' is not a member of 'cv::TiffDecoderBufHelper'
tif = TIFFClientOpen( "", "r", reinterpret_cast(buf_helper), &TiffDecoderBufHelper::read,
^~~~
/public/home/lijingsk/deng/opencv-3.4.1/modules/imgcodecs/src/grfmt_tiff.cpp:214:58: error: 'write' is not a member of 'cv::TiffDecoderBufHelper'
&TiffDecoderBufHelper::write, &TiffDecoderBufHelper::seek,
^~~~~
/public/home/lijingsk/deng/opencv-3.4.1/modules/imgcodecs/src/grfmt_tiff.cpp: At global scope:
my compiler's version is gcc (GCC) 7.3.0, centos version is 6.8
↧