Saved bmp files have incorrect dimensions

Hello! I just got the OpenMV and am starting to use it.
I’m trying to save snapshots from the OpenMV camera as 150x150 pixel size .bmp images. When I check the sizing of the .bmp file in the hex code of its header, it says that the width = 150 pixels , but the height is 106 pixels. I tried saving a snapshot as a .jpg file and then converting it to a .bmp file with an online converter, and the dimensions are 150 x 150 as expected. Is there something wrong with how I’m saving the .bmp file? Using the .jpg → .bmp conversion workaround isn’t ideal because I’d like to be able to send these .bmp files from the OpenMV to a different H7 board down the line.

Here’s the code I’m using:

sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.GRAYSCALE) 
sensor.set_framesize(sensor.VGA) 
# check the sensor resolution width/height
print("Sensor width = ", sensor.width(), "; Sensor height = ", sensor.height())
sensor.set_windowing((120,140,150,150))
sensor.skip_frames(time = 2000) # Let new settings take affect.
pyb.LED(RED_LED_PIN).on()
sensor.skip_frames(time = 3000) # Give the user 3 seconds to get ready.
pyb.LED(RED_LED_PIN).off()
pyb.LED(BLUE_LED_PIN).on()
print("You're on camera!")
sensor.snapshot().save("wo8.bmp") # Save Pic.

I’ve attached 2 images of the hex code. One was saved directly from the openMV code, and the other I converted from jpg to bmp.

Thanks so much for any help!


Which OpenMV is that ? Also please include all the firmware info you see in the IDE when connected to the camera.

Sorry about that! It’s the H7 OpenMV, with the OV7725 and FW version 3.8.0. Please let me know if there’s any other info I should give.

The height is negative:

We save it like this so that it’s vertically flipped. So, the 16-bit height var is negative.

To note: BMP files start from the bottom up, not top down. So, storing the height as negative is common.

FF6A is negative 150.