I have responded on this board that the camera and the pi are incapable of a horizontal flip of the camera image. I was wrong. The simple command of "raspivid -hf" will do the trick. My question is: Where can I add this configuration statement for Pi to recognize it and act upon it or do I need to wait for an OAP enhancement that adds the horizontal flip to the rear camera configuration settings?
04-30-2020, 12:16 AM
I personally prefer to use my own camera script rather than the reverse camera functionality built into OAP. This isn't a knock against OAP, it's just that with a script you can customize the set up better to fit your personal use-case.
Here's a link to my script - https://pastebin.com/RfUPw0AZ If you add the script to your rc.local file, it will execute at boot and listen on the GPIO for the reverse feedback (or whatever action you assign to the GPIO to, could be a button). At that point it will run the raspivid command. You can simply edit the raspivid command part of the script to give you the options that work best for your setup. You can see that in my setup I use the -vf argument to do a vertical flip.
04-30-2020, 05:18 PM
(04-30-2020, 12:16 AM)Hisma Wrote: I personally prefer to use my own camera script rather than the reverse camera functionality built into OAP. This isn't a knock against OAP, it's just that with a script you can customize the set up better to fit your personal use-case. Bear with me. This is my first time playing with scripts. I've got it added to /etc/rc.local But the script produces an error ... unable to import ... the line it hangs on is an assignment of "time."
04-30-2020, 06:47 PM
(04-30-2020, 05:18 PM)Frank Wrote:(04-30-2020, 12:16 AM)Hisma Wrote: I personally prefer to use my own camera script rather than the reverse camera functionality built into OAP. This isn't a knock against OAP, it's just that with a script you can customize the set up better to fit your personal use-case. are you sure you have python installed? try testing the script by running the command "python <scriptname>.py" . You might get a more detailed error. time is part of the python standard library, so if its not working it makes me wonder if python is fully installed on your system. You can also try running "apt-get install python3" and update to the latest version. (04-30-2020, 06:47 PM)Hisma Wrote:(04-30-2020, 05:18 PM)Frank Wrote:(04-30-2020, 12:16 AM)Hisma Wrote: I personally prefer to use my own camera script rather than the reverse camera functionality built into OAP. This isn't a knock against OAP, it's just that with a script you can customize the set up better to fit your personal use-case. Been busy ... just now turning back to this. I've got the service part scripted and running. But I am doing something wrong on loading your script to /etc/rc.local. To be expected ... Im a newbie on these scripts. Am I correct that I save the PY file to /home/pi/startupcam.py? ... and put in the rc.local file the command /home/pi/startupcam.py? I need more specifics to accomplish this. Thanks for the help. UPDATE: Fully Solved and Functional I wired my backup camera off of the backup lights. When on, 12 volts pass through a relay switch that outputs 3.3V to the selected GPIO pin on my Pi. This wiring methods required me to change your program in a couple of ways: 1) Changed GPIO.setup command in part to read "pull_up_down=GPIO.PUD_DOWN" (insted of UP) 2) Changed all GPIO.input(RearView_Switch) tests from ==0 to ==1 With these changes, my GPIO pin is always LOW (or 0) except for when the vehicle is in reverse. Then GPIO.input goes HIGH (or 1). SWEET. I now have a backup camera with the horrizontal flipped. Thanks again for your help.
06-29-2020, 07:20 PM
This is fantastic ... I see a possible solution to my problems.
Since I have a little time I will try, although it would be nice if something like this was integrated into OAP. Another great improvement would be that you could increase the fps from 5 to 60.
07-15-2020, 03:44 PM
Is this also working for USB cameras?
07-18-2020, 10:20 AM
01-20-2021, 11:29 PM
(04-30-2020, 12:16 AM)Hisma Wrote: I personally prefer to use my own camera script rather than the reverse camera functionality built into OAP. This isn't a knock against OAP, it's just that with a script you can customize the set up better to fit your personal use-case. A question to anyone with Linux knowhow, how can this script be adapted to run as a service suing systemd? What would the .service file need to include?
02-05-2022, 12:48 PM
(04-30-2020, 12:16 AM)Hisma Wrote: I personally prefer to use my own camera script rather than the reverse camera functionality built into OAP. This isn't a knock against OAP, it's just that with a script you can customize the set up better to fit your personal use-case. Could you detail what exactly you put in rc.local and the path to that please? How does this script work for manual check of the rear camera from the main menu? When testing this on the bench with no GPIO hooked up the script does nothing although the command works a treat that the script is essentially calling. Do we need to configure OAP in any way or does choosing the script option in the dash basically tell OAP to do nothing? I'd really like to be able to bring up the camera manually while driving (to check on a trailer hitch quickly for instance) |
|