Rotate display in server

I am making a bit of progress on the field dissection microscope. Based on the best way to run the ribbon cable the image on the screen is 180 degree rotated from the object in reality. Which seeing as you are moving it by hand, it is pretty confusing.

Is there a way to adjust this setting in the UI (I really need to upgrade) or if not is there a way I can modify the settings by hand?

ping @r.w.bowman?

2 Likes

I don’t think there is a setting in our software, but I’m pretty sure you can tell the camera to flip the image when you set it up. If you edit the PiCameraStreamer class, that’s where the PiCamera object gets initialised, so that would bodge it in for now. If you’re using raspistill/raspivid and friends, I think there’s a command line flag to flip the image.

I I do the streamer class will that also do the live preview on the microscope itself? Focussing by hand it is important to have the live preview

I’m fairly sure PiCamera.hflip and .vflip apply to both the stream and the live preview - flipping happens quite early in the camera’s ISP. I’m assuming here that you’re using the current release, i.e. picamera v1 (though I suspect picamera2 has similar behaviour).

1 Like

I fully second that! :- ) So I beg your pardon to revive such an old thread.

In Raspberry’s “Coding projects for kids and teens” (sic!) I found in Getting started with the Camera Module that it ‘only’ takes one python command to rotate the stream:

camera = PiCamera()
camera.rotation = 180

But looking at the server’s python code in openflexure_microscope/camera/pi.py I couldn’t locate a section where I could patch in this rotation snippet. Obviously it isn’t that simple as I thought.
Unfortunately my python knowledge is by far too limited to be able to do such a task myself…

Line 80 of openflexure_microscope/camera/pi.py

Is where we get the PiCamera object.

You could see what happens if you add

self.picamera.rotation = 180

on line 81. Its pretty hacky, but may get yours working. If it does it should be a possible to add a config option for it at a later date.

3 Likes

That does the trick! - THANKS!

No more confusion :- ))

3 Likes