open other images for analysis

I captured png files using opencv. I converted them in photoshop to jpg (quality level 5) 320x240 rbg and to bmp 16 bit windows format.

When I try to open the jpg I get an out of memory error and when I open the bmp file I get a OsError: file corrupted message. The jpeg image is attached. The forum would not let me attach the bmp.

The code is

import image
img = image.Image("/pathtofile/legos.bmp")

legos.jpg
Is there a better took to use to convert image formats than photoshop? I have windows and mac systems.

Thanks
:slight_smile:
Eric aka DaddyOh

You can’t open such a large image with your OpenMV Cam and store in on the heap. We only have about 20kb for that. Instead, you need to load it I to the frame buffer. Add copy_to_fb=True to the load image command. This loads the image into the frame buffer which has about 360kb versus the general purpose heap.

As for jpeg images, we don’t support decompressing them so you can do anything with them other than save them on the disk. Please load just a bmp file into memory. As for getting a BMP file corrupted error… Mmm, that means I didn’t like the file format. Um, can you save the bmp with MS paint? Also load it with copy_to_fb set to true.

Finally note that the image will not appear immediately in the IDE after loading once you’ve used that command. We transfer whatever image was in the frame buffer to the IDE when snapshot is called. So, you should call snapshot first, then overwrite the image with load, and then call snapshot again to see the image in the IDE. The easiest thing to do is just to add the load command after the snapshot command in a loop and everything will work fine. The requirement to call snapshot currently will be removed in the next firmware version.

Also, there was a bug with load before. Make sure you have the latest firmware flashed.

See Examples → 03-Drawing → copy2fb.py

This is working.

Next is to do color blob locating in the images. May have some questions.

Saved the image as bmp in MS Paint but openMV could not read it.

Used Corel Paint Shop Pro to save image as BMP and that worked. I can read that image from file to the frame buffer and display it.

Thanks

Eric

Another option that works is GIMP, you need to set these settings:

Screenshot from 2017-06-15 22-51-52.png

BMP support is either 24 bit RGB, 16 bit rgb565, or 8 bit grayscale.

Tried RGB565 with GIMP it didn’t work, but maybe I needed to disable color info too.