Open iandobbie opened 1 year ago
An example of a tall thin ROI on a simulated camera saved and then reopened with file:open. The left is the stretched image the right is the original snap, both are tall and thin but the reopened image is obviously extended in the y direction.
Trying to trace this and not totally got to the bottom of it but it something to do with how the viewport is scaled across the canvas. If I create a square canvas by changing the imageSequenceViewer code to make size (around line 87)
size = (max(self.images.shape[-1], self.images.shape[-2]),
max(self.images.shape[-1], self.images.shape[-2])+ 40) )
This totally solves the problem. So I assume that the openGL drawing code I assume something in the viewCanvas code onPaint function about line 890
glViewport(0, 0, self.w, self.h)
glMatrixMode (GL_PROJECTION)
glPushMatrix()
glLoadIdentity ()
glOrtho (0, self.w, 0, self.h, 1., -1.)
The previous code made a canvas that was shaped to the image. I think either the viewport or the ortho projection code effectively scales the pixels again to stretch the individual pixels to the same aspect ratio as the image as a whole, rather than leaving them square. If the canvas is square (with the hack above) the self.w and self.h are equal and the pixels are square.
I have pushed the fix above that creates a square canvas. Fixes the issue but in an ugly way.
The view last image function brings up the image viewer and non-square images are stretched oddly.
The data is correct and hovering the mouse returns the correct pixel locations but it is as though the image is rectangular, but the pixel themselves are stretch to be rectangular so the non-square aspect is effectively doubled. All a bit strange.