Issues setting up YoloV3 on MacOs - opencv

I am trying to test out object detection on a video I have but ran into this issue
Demo needs OpenCV for webcam images.
So I changed OPENCV=1 in the Makefile but ran into this error now
./src/image_opencv.cpp:5:10: fatal error: 'opencv2/opencv.hpp' file not found
#include "opencv2/opencv.hpp"
^~~~~~~~~~~~~~~~~~~~
1 error generated.
OpenCV works on my laptop for both Xcode and VSCode so I am not sure why this is happening.

The error was fixed by setting the path to the absolute path of the model weights and model configuration files.

Related

OpenCV is preinstalled in google colab but I am unable to add extra modules from opencv contrib. Still getting the same- No such file or directory

I want to add opencv2/cudaimgproc.hpp module from contrib. I followed the instructions in https://github.com/opencv/opencv_contrib to build opencv contrib. I also cloned opencv master because the instructions said so even though I have opencv 4 installed in Google colab. I still get the same error-
fatal error: opencv2/cudaimgproc.hpp: No such file or directory #include
when I run the cpp code with #include . Please help.

Cannot compile GPD in Ubuntu 14.04

I cannot compile gpd in Ubuntu 14.04, I compiled it before but no luck this time. When I tried to compile, I keep getting this error:
In file included from /home/tawfiq/catkin_ws/src/gpd/src/gpd/caffe_classifier.cpp:1:0:
/home/tawfiq/catkin_ws/src/gpd/src/gpd/../../include/gpd/caffe_classifier.h:41:27: fatal error: caffe/caffe.hpp: No such file or directory
#include "caffe/caffe.hpp"
The following lines are already in caffe_classifier.h file:
// Caffe
#include "caffe/caffe.hpp"
#include "caffe/layers/memory_data_layer.hpp"
#include "caffe/util/io.hpp"
In caffe classifier.cpp file which is inside the gpd folder in my catkin_ws src directory, the following line is included:
#include "../../include/gpd/caffe_classifier.h"
The caffe folder is in home, inside caffe folder, there is include folder, then caffe folder, then caffe.hpp in caffe.
It is working fine in others' computers. I installed cuda 7.5. Then caffe and gpd from this link:
https://github.com/atenpas/gpd
and followed what they said. Cuda and caffe successfully compiled. It is so frustrating, I tried updating the bashrc or putting the absolute path in caffe folder, nothing worked.

3d reconstruction using python and opencv with multiple images

I am trying to perform 3D reconstruction from sets of images using OpenCV. Being somewhat new to openCV, I found a useful example that demonstrates the generation of a point cloud from images here:
https://github.com/alyssaq/reconstruction
Unfortunately, when I tried to run the commands which were written on the README.md file, I got the following error.
Error message
As you can see the error is showing the minimum version required for the cmake is 3.5 and claims the version that is being run is 3.0.2.
But as you can see that the cmake version that I am running is 3.9.1.
I tried with removing(uninstalling) the cmake and reinstalled. But issue is still there.
The contents of the $PATH variable are as follows:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin

OpenCV 3.4.1-dev "libv4l2: error set_fmt gave us a different result then try_fmt!"

I am attempting to pull simple video from a USB camera, which I will then export to either .AVI or .PNG, as required.
I have implemented OpenCV, version 3.4.1-dev, in both a Python3 script and
a C++ program. Both the Python3 script and the C++ program run beautifully on Windows, with no errors.
The C++ program compiles just fine on Windows and Ubuntu, but both the Python Script and the C++ program crash with the following errors when run on Ubuntu:
libv4l2: error set_fmt gave us a different result then try_fmt!
OpenCV(3.4.1-dev) Error: Unspecified error (GStreamer: unable to start pipeline
) in cvCaptureFromCAM_GStreamer, file /opt/opencv/modules/videoio/src/cap_gstreamer.cpp, line 890
VIDEOIO(cvCreateCapture_GStreamer(CV_CAP_GSTREAMER_V4L2, reinterpret_cast<char *>(index))): raised OpenCV exception:
OpenCV(3.4.1-dev) /opt/opencv/modules/videoio/src/cap_gstreamer.cpp:890: error: (-2) Unspecified error: GStreamer: unable to start pipeline
in function cvCaptureFromCAM_GStreamer
libpng warning: Image width is zero in IHDR
libpng warning: Image height is zero in IHDR
libpng error: Invalid IHDR data
I experimented with a number of printf() statements and narrowed the issue down to the line "VideoCapture capture(0);". From my limited knowledge, it appears that Ubuntu cannot find the camera at ID 0, where Windows was able to. I also tried a for loop to see if the camera was at a higher ID number, but that did not help; it passed right by the other numbers and still crashed when it hit ID 0.
My every search for help yielded many different issues for earlier versions of OpenCV, and all routed back to the same error message:
libv4l2: error set_fmt gave us a different result then try_fmt!
I do not know how to approach this error.
It seems to be a problem with OpenCV 3.4.1-dev itself. Any advice?
Well, I ran into a similar issue (same error message):
libv4l2: error set_fmt gave us a different result then try_fmt!
It's not an OpenCV issue but rather is a BUG in v4l:
https://bugs.launchpad.net/ubuntu/+source/v4l-utils/+bug/1737063
I upgraded the v4l-utils package to the fix version (1.12.6) indicated by the BUG report, the error message disappeared and the camera started working without issues.

OpenCV SFM Compliation

I am trying to build scene_reconstruction.cpp sample from OpenCV, but I have the following error:
In file included from /usr/local/include/opencv2/sfm.hpp:42:0,
from scene_reconstruction.cpp:1:
/usr/local/include/opencv2/sfm/numeric.hpp:41:22: fatal error: Eigen/Core: No such file or directory
compilation terminated.
But I did install eigen. I tried building opencv with BUILD_EXAMPLE=ON flag, the building using make, will just terminates at 9% Built target opencv_python3
Can anyone please explain to me?

Resources