Flipping the camera in diddyRedWeb.py etc
Forums:
Trying to find where to edit web interface software to flip the camera image as I now have the camera on a pan & tilt head with the camera module mounted upside down and can't change it physically so need to flip the image. Can anyone help?
I have found
camera.hflip = True
camera.vflip = True
in picamera documentation but have no idea how/where in the DiddyBorg software to find and edit this?
piborg
Sun, 06/05/2016 - 12:40
Permalink
Flipping the camera image
This is actually a fairly simple change, the Web UI is already flipping the image :)
On line 113 we use OpenCV to flip the image horizontally and vertically:
flippedArray = cv2.flip(self.stream.array, -1) # Flips X and Y
The value passed tells it which way to flip the image:
0
→ Flip vertically (Y)1
→ Flip horizontally (X)-1
→ Flip vertically and horizontally (X & Y)To get the image without any flipping we can change lines 113 to 115 so that we do not perform the flip:
This will effectively rotate the image by 180°, which I think is probably what you are after.
METTAUK
Mon, 06/06/2016 - 16:04
Permalink
Thanks for your help.
Thanks for your help.
METTAUK
Tue, 06/14/2016 - 21:58
Permalink
Follow the Ball and camera flip
Just been trying to run diddyredfollowball and he seems to turn away as he get closer. Is this something to do with camera flip? As I still have the camera module (v2.1) mounted upside down. See pic
piborg
Wed, 06/15/2016 - 10:29
Permalink
Turning the wrong way
Yes, it is probably that the code is getting confused between left and right.
This line determines the direction to travel towards the ball in the image:
direction = (x - imageCentreX) / imageCentreX
What you want to do is flip the direction around like this:
direction = (imageCentreX - x) / imageCentreX