'GL_PERSPECTIVE_CORRECTION_HINT' error on Raspberry Pi while installing OpenCV - opencv

I am trying to create a barcode scanner from a usb camera for Raspberry Pi. I used the tutorial on this site to install OpenCV on the Pi:(https://gist.github.com/rodrigobaron/072a85460e46c48e3bee24fe140b9fdb).
After I used the make command (the third to last step of the tutorial), the following error occurred:
error: 'GL_PERSPECTIVE_CORRECTION_HINT' was not declared in this scope
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It is important to note that I used the simple "make" command rather than "make -j4" as the "j4" option allows it to work on all four cores of the raspberry pi, and it is suggested to eliminate "-j4" if an error occurs.
Upon searching for what caused this issue, I have discovered that it may be due to OPEN_GL support not needing to be enabled, or it might also be caused by an error in the header files. I have not determined how to re-write the make file to eliminate OPEN_GL support, nor do I feel comfortable altering the header files without good cause. I would appreciate any advice on fixing the issue as I feel I have exhausted my options. Thank you.

Disabling OPENGL cmake parameters (-DWITH_OPENGL=OFF) should fix the problem. i.e.
cmake -DWITH_QT=ON -DWITH_OPENGL=OFF -DFORCE_VTK=ON -DWITH_TBB=ON -DWITH_GDAL=ON -DWITH_XINE=ON -DBUILD_EXAMPLES=ON

Another option is to go to line 3229 and just comment that line out. It will build then.
This may not be the best method, but it worked for me..my file looks like this.
opencv/modules/highgui/src/window_Qt.cpp
void OpenGlViewPort::initializeGL()
{
//glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
}

Related

std::length error when using PCL Ground_based RGBD detection

I am facing an issue with Ground-based RGBD people detection (https://pcl.readthedocs.io/projects/tutorials/en/latest/ground_based_rgbd_people_detection.html). The error is inconsistent and hence has been pretty difficult to narrow down.
When I am running the detection, sometimes it throws a std::length error, and what() says vector_M_fill_insert.
Initially, I assumed it happened when people were detected (because it ran fine and the moment a person entered the frame, it stopped), and it was probably associated with the clustering, but in a few cases, it threw the error just after I launched the node.
I passed a processed point cloud to it and then passed the direct camera point cloud as well just to try to check if the issue was with the processed point cloud, but in both cases, it threw the error unpredictably.
I am confused as to how to go about debugging the error or what might be causing it. Any help is appreciated thank you!
You need to build your nodes with debug flags enabled and that can be achieved in some ways ...
Adding to your CMakelists.txt
set(CMAKE_BUILD_TYPE Debug)
Or
compiling with -DCMAKE_BUILD_TYPE=Debug.
Then you should attach the gdb debugger to whatever node you want. If you are using VS Code as IDE, there is already an extension for it with tutorials, otherwise, you can also add it to your launch file as described here

How do I remove openCV

I am trying to remove opencv fully from my system. I was trying to learn ROS, while in tutorials I faced an issue. After creating empty workspace I invoke
catkin_make
It gives an common error, I searched and asked around in answers.ros
here is the link of the question
I think I found out the problem was opencv libraries which I had build before installing ROS-Noetic, creating the error, I searched around how to remove opencv, but non of the answers totally remove opencv without removing my opencv names files.
Is there a common solution on how to remove opencv?
Ubuntu 20.04
ROS Noetic
Best way if you installed opencv from source and still have the build directory, simply go there and call make uninstall. Another solution is to delete all opencv related files as you already know and suggested in many other similar questions like this. You could also try to use synaptic package manager if you installed using a package.
I suggest for the future to install development libraries a custom folder, so it will be just a matter of deleting that folder if something goes wrong. In this way you can also have different opencv versions in your system, this is how I do.

Setup of Openpose: opencv2/core.hpp not found

I'm trying to setup Openpose + Pyopenpose following in a container following this gist: https://github.com/christian-lanius/PyOpenPose.
That works fine until the caffe compilation step, during which a opencv2/core.hpp not found exception is thrown (note that the OpenCV installation step terminates successfully). While there are a number of rather similar questions around, I nonetheless couldn't find a viable solution in my context.
I'm assuming I have to somehow link OpenCV so it can be found by other applications - do you guys have any idea how to fix or circumvent this error?
Thanks!

Problems compiling opensips via menuconfig/

I'm beating my head against the wall here. I've tried this on several different boxes and keep getting the same results...
after trying to compile opensips on Debian 8, I'm getting the following make error:
Generating parser
Generating lexer
make: Nothing to be done for 'menuconfig/'.
I'm fairly certain I have the correct dependencies install and am following the documatation to a tee, any advice would be welcome! Thank you!
Try not to hit the Tab key, thus actually typing make menuconfig, rather than make menuconfig/, which the build system currently does not know how to handle.

Converting cpp file that uses opencv to mex file with matlab in ubuntu

I need some help converting a cpp file to a mex file.
I get the error below:
fatal error: opencv2/core/core.hpp: No such file or directory
Compilation terminated
The cpp file is using opencv header files. I'm not sure how to link Matlab with opencv in Ubuntu. I saw this link
http://xanthippi.ceid.upatras.gr/people/evangelidis/matlab_opencv/
but its for Windows and I'm not sure where Ubuntu stores opencv. There are a couple places I found opencv folders
usr/local/include/opencv and
usr/local/include/opencv2 and
usr/local/share/OpenCv
Tried these with OCVROOT but got 'Error: Unexpected Matlab Operator'. Not sure what I'm doing wrong here. Any help would be much appreciated.
Thank you!
Mex needs to be told where the OpenCV header files are. You can either fix it in ~/.matlab/R2013a/mexopts.sh or just put a -I argument on the mex command line. You will find the answer to How to link during Matlab's MEX compilation helpful.
You will have to sort out which of those OpenCV versions you want to use. Might be best to install you own so you know what you are dealing with.
'Error: Unexpected Matlab Operator' would be cause by an error in your matlab code.
matlab_opencv should work fine on Linux, the only windows specific thing about it the instructions, as far as I know.
unless you have a custom mexopts.sh, I don't think setting OCVROOT will hve any affect on Matlab.

Resources