Hi, I’m trying to create an in memory thermal image from external data (acquired serially from another board) but since the RP2040 doesn’t have a sensor on It I can’t make the base image to use with draw_ir.
Is there any way I can accomplish that?
The image object can be used for this. You can just directly do get/set_pixel on an image buffer.
The sensor module should also be enabled, but you only need the image
module for that, see
https://docs.openmv.io/library/omv.image.html#image.image.Image
Dear kwagyeman and iabdalkader when I try to use sensor module on my RP2040 board I get:
import sensor
>>>RuntimeError: Failed to detect the image sensor or image sensor is detached.
When I try to create an image object from a file on disk on my RP2040 I get:
import image
img = image.Image('a.bmp')
>>>OSError: Image I/O is not supported
By the way, I can’t figure out how to create a in memory image object from the documentation, even on my great four years old OpenMV H7 board:
…Alternatively, you may pass a width, height, and either sensor.BINARY, sensor.GRAYSCALE, or sensor.RGB565 to create new blank image object (initialized to 0 - black).
import sensor
import image
img = image.Image((32,24,sensor.RGB565))
>>>TypeError: can't convert 'tuple' object to str implicitly
Sure this tuple way is not correct, just an example from a novice try by reading the docs.
Any ideas?
I figure out my stupidity on in memory image creation after check the source code.
import image
img = image.Image(32,24,0xc030002)
I found that sensor.RGB565 = 0xc030002 in order to avoid to import sensor module.
Sorry for the misunderstood, closing the topic.
Hey OpenMV team, keep up with your fantastic work!
The image object contains the same defines.
Thanks again kwagyeman.
Here is some sample code for reference:
import image, fir
x = 32
y = 24
scale = 3
img = image.Image(x*scale, y*scale, image.RGB565)
fir.init(fir.FIR_NONE)
ir = [i/10 for i in range(x*y)] #sample data
fir.draw_ir(img, (x, y, ir), x_scale=scale, y_scale=scale)