ropensci / opencv

R bindings for OpenCV
https://docs.ropensci.org/opencv
Other
133 stars 27 forks source link

ocv_qr_detect() returns incorrect coordinates on Linux #40

Open ihellman opened 7 months ago

ihellman commented 7 months ago

I recently submitted a feature request #39 to return the coordinates of the QR code in the image. The updated version works great on Windows and MacOS but on Linux (where I need it to run), the returned coordinates are the boundaries of the entire image, not the QR code. When draw = TRUE is on, the blue bounding box borders the entire image.

Some info about the system: Ubuntu 22.04.3 LTS R Version: 4.3.2 R Studio Server: 2023.06.0 Build 421

Example Command: library(opencv) img <- opencv::ocv_read("https://scoutek-media.s3.amazonaws.com/photos/76879639-ef2066158d.jpg") opencv::ocv_qr_detect(img, draw = TRUE)

Output from above

opencv::ocv_qr_detect(img, draw = TRUE) <pointer: 0x55c04fb35f50> attr(,"class") [1] "opencv-image" attr(,"value") [1] "top" attr(,"points") [,1] [,2] [1,] 0 0 [2,] 1919 0 [3,] 1919 1079 [4,] 0 1079

jeroen commented 7 months ago

Does it make a difference if you use the WeChat implemation or the other one?

Op do 25 jan. 2024 18:16 schreef Ian Hellman @.***>:

I recently submitted a feature request #39 https://github.com/ropensci/opencv/issues/39 to return the coordinates of the QR code in the image. The updated version works great on Windows and MacOS but on Linux (where I need it to run), the returned coordinates are the boundaries of the entire image, not the QR code. When draw = TRUE is on, the blue bounding box borders the entire image.

Some info about the system: Ubuntu 22.04.3 LTS R Version: 4.3.2 R Studio Server: 2023.06.0 Build 421

Example Command: library(opencv) img <- opencv::ocv_read(" https://scoutek-media.s3.amazonaws.com/photos/76879639-ef2066158d.jpg") opencv::ocv_qr_detect(img, draw = TRUE)

Output from above

opencv::ocv_qr_detect(img, draw = TRUE) <pointer: 0x55c04fb35f50> attr(,"class") [1] "opencv-image" attr(,"value") [1] "top" attr(,"points") [,1] [,2] [1,] 0 0 [2,] 1919 0 [3,] 1919 1079 [4,] 0 1079

— Reply to this email directly, view it on GitHub https://github.com/ropensci/opencv/issues/40, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABUZ73AEQZVO2JTUIPEVTDYQKHNRAVCNFSM6AAAAABCK4GTEKVHI2DSMVQWIX3LMV43ASLTON2WKOZSGEYDAOBTHA3TKNY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

ihellman commented 7 months ago

'quirc' returns NULL on both Windows and Linux.
'wechat' works on Windows but Linux returns the output above.

jeroen commented 7 months ago

Yes I tried it myself as well, very strange. It works fine on other Linux distros like Fedora, but not on Ubuntu.

ihellman commented 7 months ago

Thanks for the insight. I also works for me on Fedora and I was able to move my project over to that.