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

Update open-cv-mobile to support cv::imshow("fb", bgr) for direct framebuffer rendering #189

Closed
pottendo opened this issue Oct 31, 2024 · 4 comments

Comments

@pottendo
Copy link

hello,

I got an ili9341 display working nicely with a little bit of tweaking on
my HW: luckfox pico max + SC3336 camera
A little demo shows nice and bright colors:

image

I also got the yolo5 and luckfox_pico_retinaface_facenet_demo running and showing the live camera stream on the display.
The capture camera pictures are shifted to blue quite intensively - even if cover the lense I get a blue screen instead of black. Not yet understood, what can be the reason for this (see here). This display uses a 16bit color format per pixel BGR565.

The luckfox_pico_retinaface_facenet_demo converts images and memcpys to the framebuffer:

            //LCD Show 
            if( pixel_size == 4 ) 
                cv::cvtColor(bgr, disp, cv::COLOR_BGR2BGRA);
            else if( pixel_size == 2 )
                cv::cvtColor(bgr, disp, cv::COLOR_BGR2BGR565);
            memcpy(framebuffer, disp.data, disp_width * disp_height * pixel_size);

Now I found this: opencv-mobile promises cv::imshow supports Linux framebuffer and Windows

The version of opencv-mobile shipped with the rknn demos won't allow direct rendering to the display using cv::imshow("fb", bgr). This just writes fb.png files (which actually are the cam-pictures in perfect nice colors).

I think the build of opencv-mobile needs just to be refreshed to latest master version of opencv-mobile to enable this feature.
The code seems to be in the master branch: here

I don't know if this is complex or not, and I didn't find an easy way to cross-compile opencv-mobile for the luckfox buildroot target. I can't build on the device itself, as it's not running gcc etc. So I ask here if one could support this. Writing the real-time camera display like suggested by the example linked above would be very elegant and convenient and one wouldn't be bothered with the various framebuffer layouts.

thanks, pottendo

@pottendo
Copy link
Author

pottendo commented Nov 2, 2024

A small update: I found the reason for the wrong blue'ish color shift. It's been a simple BGR vs. RGB twist.
Still the direct rendering into framebuffers would be nice. ;-)

@luckfox-eng33
Copy link
Contributor

I think updating opencv-mobile isn't very difficult when it comes to just replacing libs and cmake

@pottendo
Copy link
Author

pottendo commented Nov 4, 2024

Normally, one wants process the incoming frames, so the the function is probably anyway of limited use - maybe I'll have a look into it (one day). thanks anyway, pottendo

@pottendo pottendo closed this as completed Nov 4, 2024
@pottendo
Copy link
Author

pottendo commented Dec 6, 2024

fyi, I built the open-cv-mobile 4.10.0 for my pico max target and the direct framebuffer rendering ("imshow("bf", ...)) and other opencv functions work as expected. Tested (very loosly) in combination with my touch screen (Ilitek 9341) - see here: #204
have fun, pottendo

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