importing a *.bmp file

General discussion about topics related to OpenMV.
pcls1026
Posts: 29
Joined: Tue Aug 22, 2017 1:33 am

importing a *.bmp file

Postby pcls1026 » Sat Feb 10, 2018 2:51 pm

Hi,
I am using the attached code to import a 16KB, BMP image file, into the Image frame frame buffer on an M7.
It gives a syntax error.
What am I doing wrong?
Jim
Attachments
blkandwht.py
(492 Bytes) Downloaded 4 times
User avatar
iabdalkader
Posts: 403
Joined: Sun May 24, 2015 3:53 pm

Re: importing a *.bmp file

Postby iabdalkader » Sat Feb 10, 2018 4:21 pm

Hi, you have to copy the image to the camera's SD card first, the camera can't access files on your PC and then use this path:

Code: Select all

image.image("/blkandwht.bmp")
User avatar
iabdalkader
Posts: 403
Joined: Sun May 24, 2015 3:53 pm

Re: importing a *.bmp file

Postby iabdalkader » Wed Feb 14, 2018 6:46 am

Hi, please post your replies to this topic, don't create a new topic for each reply.

Use the Image class (note the capital I)

Code: Select all

image.Image("image.bmp")
You can't load a 900+KBs image see the memory limits in the documentation.
pcls1026
Posts: 29
Joined: Tue Aug 22, 2017 1:33 am

Re: importing a *.bmp file

Postby pcls1026 » Wed Feb 14, 2018 1:46 pm

Hi,
Sorry about all the posts.
My updated program is attached.
I tried to attach a copy of the image file from the PC, but the following error message ensued "Invalid file extension: blkandwht12.bmp."
I tried to attach a copy of the image file from the K drive, but it did not show there. All of the other k drive files that show up using
windows explorer were there.

I changed to a capital I.
The file is 33KB.
The program runs without errors.
However, the SD card image does not load. Rather, a picture is taken by the camera and loaded.

For your info: Using windows explorer on the PC, I can see that the image file has been copied to drive K. I am assuming that drive K is the cam7 usb port because,
when I pull the cam7 usb connector out of the PC,drive K does not appear in windows explorer.

Thanks,
Jim
Attachments
blkandwht.py
(422 Bytes) Downloaded 1 time
User avatar
kwagyeman
Posts: 1403
Joined: Sun May 24, 2015 2:10 pm

Re: importing a *.bmp file

Postby kwagyeman » Wed Feb 14, 2018 2:01 pm

Hi, the forum may require you to zip up files you post to the website.

Um, so, you put the file on the camera and tried loading it. What's the exact issue again? Sometimes our software has issues loading BMP files. We have much better support for ppm and pgm files which are easier to parse. You can make these via GIMP.
Nyamekye,
User avatar
iabdalkader
Posts: 403
Joined: Sun May 24, 2015 3:53 pm

Re: importing a *.bmp file

Postby iabdalkader » Wed Feb 14, 2018 2:22 pm

I think you just need to add copy_to_fb=True.

Code: Select all

image.Image("file.bmp", copy_to_fb=True)

Return to “General Topics”

Who is online

Users browsing this forum: No registered users and 1 guest