How to change(down grade) OpenCV referenced - c++

[Ubuntu14.04]
I'm trying to run darknet.
(https://pjreddie.com/darknet/yolov2/)
I have the error caused by that I'm using OpenCV 3.4.2 version.
(terminate called after throwing an instance of 'cv::Exception'
what():
OpenCV(3.4.2)/home/kasamatsu/opencv/modules/core/src/matrix_wrap.cpp:800:
error: (-215:Assertion failed) (flags & FIXED_TYPE) != 0 in function
'type')
I found I can solve the problem by changing the version of OpenCV used.
But I have no ideas about how to change it.
now my
/etc/ld.so.conf.d/opencv.conf
says /usr/local/lib
my /usr/local/libincludes
libopencv_highgui.so.3.2
libopencv_highgui.so.3.2.0
libopencv_highgui.so.3.4
libopencv_highgui.so.3.4.2
・・・and so on.
So I think my environment references only libopencv_highgui.so.3.4.2.
I would like to change this target.
I am a beginner of stack overflow and OpenCV.
Thank you in advance.

Related

Running Error caused by cv::resize() when transitioning opencv from 2.4.13 to 3.3.1

The below code is a sample.
cv::Mat mat = cv::Mat ( 500, 400, CV_32F, cv::Scalar::all ( 2.0 ) );
cv::Mat mat2;
cv::resize(mat, mat2, cv::Size(400,600), 0, 0, cv::INTER_LINEAR);
This give me this error
OpenCV Error: The function/feature is not implemented (Unknown/unsupported array type) in getMat_, file /tmp/binarydeb/ros-kinetic-opencv3-3.3.1/modules/core/src/matrix.cpp, line 1319
terminate called after throwing an instance of 'cv::Exception'
what(): /tmp/binarydeb/ros-kinetic-opencv3-3.3.1/modules/core/src/matrix.cpp:1319: error: (-213) Unknown/unsupported array type in function getMat_
I have installed opencv 2.4.13 in /usr/locl as the default version and opencv 3.3.1 along with the ROS kinetic.
My cmake project A was built upon opencv 2.4.13 and it works properly. Now I need to transition to opencv 3.3.1 because another catkin package B depends on A and opencv 3.3.1. However, the problem occurs as above and I cannot fix it after day's googling.
Note that cv::resize works normally when tested using a single cpp file based project depending on either opencv 2.4.13 or 3.3.1.
It also works normally in project A depending upon opencv 2.4.13.
However, it causes running error in project A depending upon opencv 3.3.1
Any ideas are welcomed
I have also tried to compile both A and B using Opencv 2 and then I use find_package( OpenCV 2 REQUIRED) in my cmakelists.txt file. Another ruuning error caused by resize() was reported as below (may vary):
OpenCV Error: The function/feature is not implemented
Unknown/unsupported array type) in getMat_, file /tmp/binarydeb/ros-kinetic-opencv3-3.3.1/modules/core/src/matrix.cpp, line 1319
terminate called after throwing an instance of 'cv::Exception' what(): /tmp/binarydeb/ros-kinetic-opencv3-3.3.1/modules/core/src/matrix.cpp:1319:
error: (-213) Unknown/unsupported array type in function getMat_
or
OpenCV Error: The function/feature is not implemented (You should explicitly call mapHost/unmapHost methods for ogl::Buffer object) in getMat_,
file /tmp/binarydeb/ros-kinetic-opencv3-3.3.1/modules/core/src/matrix.cpp, line 1299
terminate called after throwing an instance of 'cv::Exception' what(): /tmp/binarydeb/ros-kinetic-opencv3-3.3.1/modules/core/src/matrix.cpp:1299:
error: (-213) You should explicitly call mapHost/unmapHost methods for ogl::Buffer object in function getMat_
crazy( ⊙ o ⊙ )!
Finally, I re-implement those related functions where cv::resize is used in project A in my current project B, then it works.(⊙o⊙)

OpenCV error when Docker container is run on GKE

I get the following error when running OpenCV via nodejs in a Docker container on GKE, but don't experience the issue when running the same container on my Mac.
Is this some sort of memory issue? Only the node process crashes.
OpenCV Error: Bad argument (Invalid cascade pointer) in cvRunHaarClassifierCascadeSum, file /tmp/opencv-2.4.11/modules/objdetect/src/haar.cpp, line 838
OpenCV Error: Bad argument (Invalid cascade pointer) in cvRunHaarClassifierCascadeSum, file /tmp/opencv-2.4.11/modules/objdetect/src/haar.cpp, line 838
OpenCV Error: Null pointer (Hidden cascade has not been created.
Use cvSetImagesForHaarClassifierCascade) in cvRunHaarClassifierCascadeSum, file /tmp/opencv-2.4.11/modules/objdetect/src/haar.cpp, line 843
OpenCV Error: Bad argument (Invalid cascade pointer) in cvRunHaarClassifierCascadeSum, file /tmp/opencv-2.4.11/modules/objdetect/src/haar.cpp, line 838
terminate called after throwing an instance of 'tbb::captured_exception'
what(): /tmp/opencv-2.4.11/modules/objdetect/src/haar.cpp:838: error: (-5) Invalid cascade pointer in function cvRunHaarClassifierCascadeSum
The issue was with the NodeJS library Faced. I used the Node OpenCV library instead.

OpenCV Error with cvCalibrateCamera2

I have some problem running OpenCV programs with cvCalibrateCamera2.
This has been tried with examples from here
and Oreilly "Learning OpenCV" example ch11 ex11 (codes downloadable from here). The error is the same. The codes run through cvFindChessboardCorners, cvDrawChessboardCorners etc. with no problem, and they only fail at cvCalibrateCamera2 with the following information:
OpenCV Error: Assertion failed (_dst.fixedType()) in convertPointsHomogeneous, file /root/opencv-3.1.0/modules/calib3d/src/fundam.cpp, line 1034
terminate called after throwing an instance of 'cv::Exception'
what(): /root/opencv-3.1.0/modules/calib3d/src/fundam.cpp:1034: error: (-215) _dst.fixedType() in function convertPointsHomogeneous
Can you tell what the problem is, or point direction to where it could be?
After investigating into the OpenCV 3.1 source codes, I think the problem is with OpenCV itself, since the error comes from variables created and passed around within the library. I tried a lower version of OpenCV (2.4.13) and that fixed the problem.

Using gperftools with a Jetson TX1 dev kit

I've been recommended gperftools to simply and quickly profile my code. Furthermore, the integration of -lprofiler was already done in the CMAKE of the code I got. Now that I migrated the source code on to the Jetson TX1 and that it worked well, I've tried to use gperftools.
Unfortunately, segmentation faults start to appear as soon as I launch my program with perftools
env CPUPROFILE=./lts.prof /mybin
I've read the documentation and they talk about using the correct libunwind for 64 bit Linux. Unfortunately, the given library (0.99 libunwind, http://download.savannah.gnu.org/releases/libunwind/libunwind-0.99-beta.tar.gz) does not seem to like the Tegra platform.
First of all, there is a problem with the config.guess, that I had to change with the one located in /usr/share/automake*/.
configure: error: cannot guess build type; you must specify one
Then it goes wrong like this :
config.status: error: ./include/libunwind-aarch64.h: file not found
I've tried to use the master tree because they added AARCH64 (which appeared in the error messages), but then I get other messages :
aarch64/is_fpreg.c:31:21: error: 'UNW_AARCH64_V0' undeclared (first use in this function)
return (regnum >= UNW_AARCH64_V0 && regnum <= UNW_AARCH64_V31);
aarch64/is_fpreg.c:31:49: error: 'UNW_AARCH64_V31' undeclared (first use in this function)
return (regnum >= UNW_AARCH64_V0 && regnum <= UNW_AARCH64_V31);
As anyone been able to use gperftools on a Tegra Dev Kit or similar
platform ?
Is the libunwind part of the segfault problem ? Again the
code works without -lprofiler and CPUPROFILER.

Having trouble with stanford 106B in Xcode

I am following stanford 106B online and download the assignment file "Mac os x 10.8 files"here. The download gave me proper xcode projects that can be opened with the current version of xcode(5.1.1) I am using.But while trying to run the project I repeatedly get this error. I'm using OS X 10.9.4
clang: error: unknown argument: '-fstack-check' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1
is there anyone who can help? I'm trying to fix it for long but failed. it's killing me...
PS: I also found another post asking the same question https://stackoverflow.com/questions/24890564/having-trouble-starting-with-stanford-cs106b-course-with-xcode-5-1-1?lq=1