Load image from flash memory

OpenMV related project discussion.
naamah75
Posts: 2
Joined: Sun Sep 03, 2017 8:51 am

Load image from flash memory

Postby naamah75 » Sun Sep 03, 2017 9:12 am

I'm sorry for this question.... maybe it can be a stupid question, but I'm newbe to this system,

How I can load an JPG from flash memory?

Code: Select all

import sensor, image, time

sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QQVGA)
sensor.skip_frames(time = 2000)
clock = time.clock()

myImage = image.Image("solar_eclipse.jpg", True)

while(True):
    clock.tick()
    img = sensor.flush()
    # Do machine vision algorithms on the image here.

    print(clock.fps())
    
Where I'm wrong?
User avatar
kwagyeman
Posts: 1601
Joined: Sun May 24, 2015 2:10 pm

Re: Load image from flash memory

Postby kwagyeman » Sun Sep 03, 2017 1:43 pm

Hi,

Code: Select all

myImage = image.Image("solar_eclipse.jpg", copy_to_fb = True)
All keyword arguments need the keyword, e.g. the "copy_to_fb" part. Note that the internal flash drive can't really hold a JPG image. Please store JPG images on the SD card. Finally, what do you plan to do with the JPG image? Machine Vision methods can't operate on JPG images. You can only save and load them.
Nyamekye,
naamah75
Posts: 2
Joined: Sun Sep 03, 2017 8:51 am

Re: Load image from flash memory

Postby naamah75 » Mon Sep 04, 2017 1:12 am

As first step I would want to load JPG and put in the frame buffer (to show in the IDE).
The second step will be take the image from frame buffer and manipulate.
User avatar
kwagyeman
Posts: 1601
Joined: Sun May 24, 2015 2:10 pm

Re: Load image from flash memory

Postby kwagyeman » Mon Sep 04, 2017 1:40 am

Okay, just use a BMP file or PPM/PGM file. Sometimes BMP might not work. However, PGM and PPM should always work. If you have a non-working BMP file please send it to me and I can figure out why.
Nyamekye,

Return to “Project Discussion”

Who is online

Users browsing this forum: No registered users and 2 guests