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

Cannot open image in Ubuntu #56

Open
MendeBadra opened this issue Jan 29, 2025 · 1 comment
Open

Cannot open image in Ubuntu #56

MendeBadra opened this issue Jan 29, 2025 · 1 comment

Comments

@MendeBadra
Copy link

My os: Ubuntu 24.04

import OpenCV; const cv = OpenCV
img = cv.imread("cameraman.tif")
cv.imshow("Cameraman", img)

This code is not working, No Error but it retains the image that was previously on screen on that area. See image for reference:

Image

@mkitti
Copy link
Member

mkitti commented Jan 30, 2025

This code example seems to following from the OpenCV docs:
https://docs.opencv.org/4.x/d8/da4/tutorial_julia.html

To reproduce, first we need a camerman.tif. We can obtain one via TestImages.jl

using TestImages, FileIO
img = testimage("cameraman.tif")
save("cameraman.tif", img)

If I start a new temporary environment as follows, I can reproduce.

using Pkg
Pkg.activate(; temp=true)
Pkg.add(["OpenCV", "ImageView", "ImageCore"])
using OpenCV
img = OpenCV.imread("cameraman.tif")
OpenCV.imshow("Cameraman", img)

Image

However, if I load ImageView.jl, then the issue is resolved.

using Pkg
Pkg.activate(; temp=true)
Pkg.add(["OpenCV", "ImageView", "ImageCore"])
using OpenCV, ImageView
img = OpenCV.imread("cameraman.tif")
OpenCV.imshow("Cameraman", img)

Image

Loading ImageView.jl seems to do some initialization which then allows OpenCV.imshow to work. This is confusing though since ImageView.jl uses GTK while OpenCV.imshow appears to be QT based.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants