Loading (but not decompressing) jpegs

Discussion related to "under the hood" OpenMV topics.
Stub
Posts: 7
Joined: Mon Dec 23, 2019 8:30 am

Loading (but not decompressing) jpegs

Postby Stub » Wed Aug 12, 2020 1:16 pm

Hi,

I was wondering if there is a way to load a jpeg or mjpeg from SD card and then send that on via the wifi? The image are large as they are recorded in HD so 80-120Kb and thus need to go in the frame buffer or similar.

If you have any suggestions that would be great. Alternatively please can you add it to the todo list, I believe the jpeg decoder is already on the list and this would be a helpful first step.

In the meantime I will use uncompressed images - which will restrict the number of days of data I can store. (and be slower to write!?)

Thanks very much for all the hard work so far. Any pointers would also be gratefully received...
User avatar
iabdalkader
Posts: 1214
Joined: Sun May 24, 2015 3:53 pm

Re: Loading (but not decompressing) jpegs

Postby iabdalkader » Wed Aug 12, 2020 1:33 pm

It's already on the todo list, it's just a lot of work to get JPEG decoding working, but I'll see what I can do.
Stub
Posts: 7
Joined: Mon Dec 23, 2019 8:30 am

Re: Loading (but not decompressing) jpegs

Postby Stub » Wed Aug 12, 2020 2:05 pm

Hi,

Thanks, as I say I only need to be able to load the compressed image again, not actually decompress it. So even a way of loading a file onto the frame buffer would suffice.
User avatar
kwagyeman
Posts: 4458
Joined: Sun May 24, 2015 2:10 pm

Re: Loading (but not decompressing) jpegs

Postby kwagyeman » Wed Aug 12, 2020 2:37 pm

You can already do this:

1. Open the jpeg file and read it into a byte array.
2. Create a extra frame buffer and set the image format type to the byte size of the byte array above.
3. Use the bytearray() arg of an image and assign he byte array the image.

This works for small jpegs. It however doesn't work for large ones (1MB etc). So, we need to add this.
Nyamekye,
User avatar
iabdalkader
Posts: 1214
Joined: Sun May 24, 2015 3:53 pm

Re: Loading (but not decompressing) jpegs

Postby iabdalkader » Wed Aug 12, 2020 2:40 pm

Stub wrote:
Wed Aug 12, 2020 2:05 pm
Hi,

Thanks, as I say I only need to be able to load the compressed image again, not actually decompress it. So even a way of loading a file onto the frame buffer would suffice.
I see, that's a lot easier to implement. Okay please open an issue on github and I'll get right on it.
User avatar
iabdalkader
Posts: 1214
Joined: Sun May 24, 2015 3:53 pm

Re: Loading (but not decompressing) jpegs

Postby iabdalkader » Wed Aug 12, 2020 3:47 pm

Never mind, I already fixed it, you should be able to load jpg images in the next release. So this should work:

Code: Select all

img = image.Image("/test.jpg", copy_to_fb=True)
Stub
Posts: 7
Joined: Mon Dec 23, 2019 8:30 am

Re: Loading (but not decompressing) jpegs

Postby Stub » Thu Aug 13, 2020 5:30 am

Fantastic. That's just what I am after. That's outstanding support! Thankyou

Return to “Technical Discussion”

Who is online

Users browsing this forum: No registered users and 14 guests