Is drawing in color on top of grayscale / binary possible?

General discussion about topics related to OpenMV.
Orodromeus
Posts: 2
Joined: Sun May 05, 2019 3:18 pm

Is drawing in color on top of grayscale / binary possible?

Postby Orodromeus » Sun May 05, 2019 3:37 pm

Hey guys!

New guy here :)
Recently purchased the whole OpenMV "pack" and I'm extremely excited to unleash its potential, learn and make some amazing things :)
I'm a mechatronics student and the plan is to implement OpenMV into our current project as the brains behind the navigation and object pickup (autonomous line following rover with a robotic gripper arm).
We're also planning on implementing it into a high-level drone in the near future :)

As I'm just a beginner here, please try to excuse me if my questions might come off a bit basic :P

I've searched online, on the forums and combed through the documentation, yet couldn't find an answer to the question in the title.
Is it possible to use the Global Shutter sensor, snap grayscale images and draw shapes & text in color on top of them?
The closest I've gotten was using a bitmap file...But since I want to achieve that on the fly so to speak, it doesn't help me much ;)

I've seen some people taking a grayscale frame and assigning it to a variable, and then taking a new variable and assigning a conversion from Grayscale to RGB of the initial frame to it.
Basically making a copy of the original frame and converting it...using it as an overlay layer.

img = graycale_Frame
Color_Frame = grayscale_Frame.convert-to-RGB
After they've done that it was possible to draw an overlay in color. (I believe that was in openCV)

Anyway, I would really appreciate your assistance / opinion in the matter :)

One extra question if I may - After using the linear regression example and working a bit with find_blobs, I can see how useful they can be for line following.
On the linear regression example though, it was recommended to use find_blobs() if our lines are nicely connected.
Would you still recommend using find_blobs() as opposed to linear regression when it comes to following nice and clear lines? (19mm black electrical tape over a white background)

Any tips or suggestions are welcome :)
I'm doing my best to catch up to everything.

Thanks a lot in advance,
Or Efrima
User avatar
kwagyeman
Posts: 3258
Joined: Sun May 24, 2015 2:10 pm

Re: Is drawing in color on top of grayscale / binary possible?

Postby kwagyeman » Sun May 05, 2019 5:34 pm

Hi, thanks for the details forum post.

Just use the to_rgb565 method to convert the grayscale image to color. The grayscale image will still be in black and white but you can now draw color lines on it. Note that the image size doubles however when you do this (so, VGA and up won't fit in RAM anymore).

As for line following, the find_blobs() example works as long as you are always on the line. get_regression() can handle being off of the line. The get_regression() code is generally more powerful. See the OpenMV examples GitHub for the diy robocar racer.
Nyamekye,
User avatar
kwagyeman
Posts: 3258
Joined: Sun May 24, 2015 2:10 pm

Re: Is drawing in color on top of grayscale / binary possible?

Postby kwagyeman » Sun May 05, 2019 5:37 pm

Note, get_regresion() has two forms robust and least squares. If you have no noise least squares is VERY fast but can't handle even 1 outlier pixel. Robust can handle 25% of the image being full of noise - but, it's very slow when the image is large and full of pixels it has to compute the algorithm on. That said, it can do 30 fps with 160x120.
Nyamekye,
Orodromeus
Posts: 2
Joined: Sun May 05, 2019 3:18 pm

Re: Is drawing in color on top of grayscale / binary possible?

Postby Orodromeus » Tue May 07, 2019 2:16 am

Heya! And thank you so much for the quick and informative reply! I really really appreciate it!
I would also like to apologize for the late reply!

Perfect! I hae just tested it and it worked wonderfully!
I'm quite the visual person and find it useful to have overlays in color while trying to develop something, or going to demonstrate functionality to my team ;)

Thank you so much for making such an awesome product / product line and for being so hand-on with the community! You rock ;)

Wishing a brilliant day!
Or

Return to “General Topics”

Who is online

Users browsing this forum: No registered users and 5 guests