I am using openmv cam for my project but i am unable to get the image of desired resolution. Can anyone help me in this.
Also if someone have sample code of image capturing and resizing, please share it.
Thanks in advance.
Hi, we don’t have a general purpose image resize but you can set the resolution to qqqvga for a 80x60 image and then you can set the image windowing for 32x32 pixels. See the docs sensor docs on this. It should be possible to do what you need.
Can you please elaborate this windowing algorithm or suggest some manual or tutorial for openmv ide so that i can do my desired task
Set the resolution to qqqvga. The do sensor.set_windowing((32, 32)). This command is documented in the docs under sensor.
ok thanks . i am gonna try this and will get back to you if i need any further assistance.
One more question.When we read image in Matlab then image is in 2D array form.
In open MV “image = sensor.snapshot()” , can you please tell me in which form this image data will be and if its not same as in matlab then also mention the method through which i can convert this data into 2D array form.
Please see the attachment for better understanding of my question.
The OpenMV Cam doesn’t run MatLab code. It has nothing to do with MatLab. Our image data is stored in a 2d array as grayscale 8bit pixel values or rgb565 16bit pixel values.
If you’d like to save an image for use with matab do img.save. See snapshot examples scripts for how to save images.
and that array number starts from zero or 1 ?
The image array is zero indexed. Just do img to access the array. In grayscale each value is 8 bits, 0 to 255. The array is 2d but accessed as a 1d array so you need to manually do row and column indexing. E.g. “(y * w) + x”.
Can you plz elaborate this 1D array access concept and please define these variables. I’ll be very grateful.
X, Y = pixel location.
img[(Y * img.width()) + X]
This is how you access arrays in standard programming and what a 2d array access boils down into…
I highly recommend you read up on 1d and 2d arrays in C and python. Google is your friend.