Cannot rotate image on lcd shield

I have a lepton 3.5 and a lcd shield both physically rotated -90 degrees and connected to a openmv h7 plus.

The goal is to display on the lcd screen the image unrotated (the sensor and the display in their natural orientation). I managed to do that in the ide, but the lcd driver somehow seems not to do anything about rotations.

The following code seems to do that in ide, but the image on the lcd display remains tilted 90 degrees

sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.LCD)
#sensor.set_framesize(sensor.QVGA)      # Set frame size to QVGA (320x240)
#sensor.set_vflip(True)
#sensor.set_hmirror(False)
#sensor.set_transpose(True)
#sensor.set_windowing((128, 160))
sensor.skip_frames(time=5000)
clock = time.clock()
lcd.init()

while(True):
    clock.tick()
    img = sensor.snapshot().rotation_corr(0,0,-90)
    temp = get_target_temp(70,50,20,20,img)
    lcd.display(img)

It should be rotated… but, the lcd driver is going to try to crop and scale the image to fit the display.

Look at the documentation for the display() method. It has quite a bit of arguments now allowing it to do a lot.

I did, there is no parameters related to rotation.

Yes, but, it’s scaling the image to fit the screen. The image should actually be rotated however. But, it won’t be cropped like you might expect.

cool setup @porten1 could you give more details? It looks like you have 4 interconnected devices, I am not sure whether I understand… I would like to use two H7+ (one with thermal sensor and one with the RGB Omnivision sensor) to detect objects thermally and take an RGB picture with it.

The picture is a sensing part of a cylindrical motion surveillance robot. The bottom openmv cam has a global shutter and it is a ML trained to recognize objects stored on sd card. The middle sensor is a OEM range finder measuring the distance to the target object the bottom camera locked on. The top openmv cam has a lepton 2.5 which measures the temperature of the target object. Each sensor communicates indirectly with a central computer using its serial port.

The bottom sensor, the one finding the target object would provide continuous feedback to the motion control system which in turn move the sensor until the object is in the center of the camera. At that point the temperature and distance measurements are taken.

The system looks like (back, front)


I was initially tried to use a portenta, but the vision shield it comes with it is kind of disappointing

1 Like

Kind of figured it out. It looks that the lcd driver and the ide have a 90 degree difference. If I do

while(True):
    #clock.tick()
    img = sensor.snapshot().rotation_corr(0,0,-90)
    temp = get_target_temp(70,50,20,20,img)
    img.rotation_corr(0,0,-90)
    lcd.display(img)

everything looks good on the lcd. The ide displays the image tilted 90 degrees, but I won’t be using it anyway in the production system.

Okay, keep in mind that rotation correction is expensive compute wise. I’d avoid it if possible. The camera doesn’t care the image orientation for processing purposes.

Oh, we will be updating rotation correction soon to be much better using OpenCV’s preallocation soon. This will fantastically speedup things as the mapping function will not need to be recomputed but once at the start of the application. This update is slated for the end of the year.

Thank you. My system is not fast. It is limited by the mechanical motion.

very cool, thanks