Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenCV was not built with OpenGL support #51

Open
mdegans opened this issue Mar 9, 2021 · 4 comments
Open

OpenCV was not built with OpenGL support #51

mdegans opened this issue Mar 9, 2021 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@mdegans
Copy link
Owner

mdegans commented Mar 9, 2021

Which means imshow can't display a GpuMat without a download. Fix is to track down opengl dev packages in ubuntu's repos and add them to the apt-get install stanza.

@mdegans mdegans self-assigned this Mar 9, 2021
@mdegans mdegans added the bug Something isn't working label Mar 9, 2021
@mdegans mdegans changed the title OpenCv was not built with OpenGL support OpenCV was not built with OpenGL support Mar 9, 2021
@ArosPrince
Copy link

Hi, can you please elaborate a bit on the proposed fix? It's not clear to me at all, what should I do in such a case. Is this before running the script or after?

@mdegans
Copy link
Owner Author

mdegans commented Oct 19, 2021

Hi, can you please elaborate a bit on the proposed fix? It's not clear to me at all, what should I do in such a case. Is this before running the script or after?

So, in order to directly imshow a GpuMat without downloading it to a Mat, you need to build OpenCV with OpenGL support or you get this error:

... Library was built without OpenGL support ...

Generally this means tracking down some blablabla-dev package in Canonical's apt repositories and making sure it's installed before build.

To answer your question, you could either install such a package before running the script or add it somewhere in this list here:

libavcodec-dev \

it's likely these packages:
https://askubuntu.com/questions/306703/compile-opengl-program-missing-gl-gl-h#comment1952106_866868

So just adding mesa-common-dev, libglu1-mesa-dev, freeglut3-dev, libglfw3-dev and libgles2-mesa-dev will probably fix it. I don't know exactly which if those OpenCV actually requires. Possibly just the first. Possibly all of them. You can test and see. I haven't had time to recently or to look into exactly what cmake is expecting.

If it works, you should see:

--     OpenGL support:              YES

If you do, and get a GpuMat displaying directly in imshow feel free to submit a PR closing this issue out.

@ArosPrince
Copy link

OK, will try that and submit a PR if that works.

One more question though... Can I just rerun the script after installing the packages, do I somehow have to uninstall it first (I have already built opencv).

@mdegans
Copy link
Owner Author

mdegans commented Oct 19, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants