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

Hey guys!

New guy here :slight_smile:
Recently purchased the whole OpenMV “pack” and I’m extremely excited to unleash its potential, learn and make some amazing things :slight_smile:
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 :slight_smile:

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

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 :wink:

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 :slight_smile:

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 :slight_smile:
I’m doing my best to catch up to everything.

Thanks a lot in advance,
Or Efrima

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.

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.

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 :wink:

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

Wishing a brilliant day!
Or