fir image overlay rotation

I was playing around with the MLX90621 overlay. I want the overlay to be rotated 90 degrees since I physically rotated the sensor the same.

I did what I thought was logical to achieve this in code and it works but for only a single frame. The second frame causes a size mismatch error. What am I missing? Here is the example code with 2 lines modified at *** marks:

# MLX90621 Overlay Demo
# This example shows off how to overlay a heatmap onto your OpenMV Cam's
# live video output from the main camera.

import sensor, image, time, fir

ALT_OVERLAY = True # Set to True to allocate a second ir image.

sensor.skip_frames(time = 2000)

# Initialize the thermal sensor
fir.init(type=fir.FIR_MLX90621, refresh=2)

# Allocate another frame buffer for smoother video.
extra_fb = sensor.alloc_extra_fb(sensor.height(), sensor.width(), sensor.RGB565)

# FPS clock
clock = time.clock()

while (True):

    # Capture an image
    img = sensor.snapshot()

    # Capture FIR data
    #   ta: Ambient temperature
    #   ir: Object temperatures (IR array)
    #   to_min: Minimum object temperature
    #   to_max: Maximum object temperature
    ta, ir, to_min, to_max = fir.read_ir()

    if not ALT_OVERLAY:
        # Scale the image and belnd it with the framebuffer
        fir.draw_ir(img, ir)
        # Create a secondary image and then blend into the frame buffer.
        fir.draw_ir(extra_fb, ir, alpha=256)
	extra_fb.replace(vflip=True, hmirror=False, transpose=True)
        img.blend(extra_fb, alpha=128)

    # Draw ambient, min and max temperatures.
    img.draw_string(8, 0, "Ta: %0.2f C" % ta, color = (255, 0, 0), mono_space = False)
    img.draw_string(8, 8, "To min: %0.2f C" % to_min, color = (255, 0, 0), mono_space = False)
    img.draw_string(8, 16, "To max: %0.2f C"% to_max, color = (255, 0, 0), mono_space = False)

    # Force high quality streaming...

    # Print FPS.

The error is: OSError: Images not equal!

I was able to make it work, but I had to rotate the image twice which is pretty slow. Be nice if the fir library could set a rotatation with draw_ir.

        fir.draw_ir(extra_fb, ir, alpha=256)
        img.replace(vflip=True, hmirror=False, transpose=True)
        img.blend(extra_fb, alpha=128)
        img.replace(vflip=False, hmirror=True, transpose=True)

We will have a new whole draw image pipeline on the next release which supports nearest neighbor, bilinear, and bicubic scaling for all image drawing, resize, etc operations under the hood. This will image our image quality for all thermal imaging applications and anything that remaps pixels.