Open m0-n opened 4 years ago
Uninstalling opencv and reinstalling version 3.4.6.27 interestingly made the error go away but does not provide the desired functionality, the scripts behave in the same way / don't do much.
What do you mean by "does not provide the desired functionality", do you have any debug message from the python script? Can you see the video feed from the camera? Can you control the pan/tilt from the keyboard? Can you show me your hardware setup? Thanks.
Hi Lee,
thanks for your reply. I posted the error message from the Python script above, I think this is the key line:
ImportError: /usr/local/lib/python3.7/dist-packages/cv2/cv2.cpython-37m-arm-linux-gnueabihf.so: undefined symbol: __atomic_fetch_add_8
I can see the video feed from the camera. I can not control pan/tilt/zoom/focus, due to the script error above.
The hardware setup is the Arducam PTZ Pan Tilt Zoom Camera together with the Raspberry Pi4, with 4GB of RAM. No other hardware so far. The software installation was done exactly as in the software user guide.
Thank you again for looking into this!
Please check this discuss with the same problem: https://github.com/EdjeElectronics/TensorFlow-Object-Detection-on-the-Raspberry-Pi/issues/67
Hi Lee,
thank you. I did that already and reinstalled open-cv with an older version (opencv-python==3.4.6.27). However, this does not change the outcome.
When running
python FocuserExample.py
It just shows a visual of what the camera is currently seeing (very blury / not focussed) for one second and then closes without notice. Same with the other scripts in the directory - the GUI does not show up, hence I can not set focus or zoom.
System info:
pi@raspberrypi:~/PlasticMapper/PTZ-Camera-Controller/pyCode $ cat /sys/firmware/devicetree/base/model
**Raspberry Pi 4 Model B Rev 1.1**
pi@raspberrypi:~/PlasticMapper/PTZ-Camera-Controller/pyCode $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
What do you suggest - any further info I can provide?
What is the recommended OS? I currently have a 32 Bit Rasbian ... does it make sense to try one of these experimental 64bit versions?
it should work with standard 32bit Rasbian. But we are now off for Chinese New Year holidays, we have to double check when we come from holidays. The blurry video is common because it is not focused, so please use AutoFocusExample.py first. The FocuserExample.py is for manual control the zoom lens.
I have the same issue I think, also on RPI 4b, Rasbian. When I run Focuser.py a line at a time, it always dies on the line: focuser = Focuser(1). Therefore the focus doesn't operate and pics are very blurry. I get the same results on the other PY scripts on this same line, e.g., FocuserExample.py and AutoFocusExample.py. Help.
This updates my comment above. I started with a new build Raspberry Pi 4 / 4GB. I loaded Raspbian Buster 2019-09-26, with update, upgrade. Python 2.7.16 is installed. Then, I connected the camera as shown in the Hardware section. I followed the software manual to the letter. I installed tightvncserver on RaspPi. I installed Remmina on the desktop client. I connected using VNC. Connected to the remote desktop, I run "python FocuserExample.py" (this runs python 2.7.16) and the script works! I can control the camera pan, tilt, zoom, focus, take a picture, etc. Auto focus doesn't work - it tries, but goes way past focus, tries to repeat, then fails. I'll submit a separate bug report for the Autofocus issue.
Then, I went to the RaspPi itself and ran the FocuserExample there. The image appears for a second (very blurry) then disappears. The python script appears to crash when run locally, but not if run through the remote desktop. This seems to replicate the issue that m0-n reported above.
Of course, I can't see the image on the remote desktop, so it makes it hard to zoom and focus. Then I discovered that I can operate the FocuserExample.py on the remote desktop through the remmina VNC and view the image on the RaspPi monitor. Therefore I can pan, tilt, zoom, focus using the two computers. Not an ideal solution, but maybe it'll help us figure why the FocuserExample.py can't be run locally on the RaspPi.
Any thoughts?
@JimWroten I'm not sure why local pi can't run the python script. The FocuserExample is quite straight forward, just using picamera library and do the preview. You can modify this example and only keep the picamera preview to see if it works. The AutoFocusExample.py example will check the best focus point by try the focus motor from one end to another, if there is no hit it will failed. So I suggest you to zoom out the lens a little bit to make the focus working, the maximum optical zoom might not have a good focus result.
Hi Lee,
I tried SSHing into the Pi, but still the same problem.
Is my hardware set up correctly? Cabling image below:
It seems good to me - basically just followed instructions.
@m0-n It is hard to check from your photo. Did you fix the python issue and run the demo code without any problem. The PTZ control is all based on the I2C bus to the Raspberry pi, so you have to make sure the script is working and I2C connection is correct.
@JimWroten I'm not sure why local pi can't run the python script. The FocuserExample is quite straight forward, just using picamera library and do the preview. You can modify this example and only keep the picamera preview to see if it works. The AutoFocusExample.py example will check the best focus point by try the focus motor from one end to another, if there is no hit it will failed. So I suggest you to zoom out the lens a little bit to make the focus working, the maximum optical zoom might not have a good focus result.
I found that my issue was not running sudo to use the camera. Upon connecting there was a permission error and it quit. I added an error message in the initialization step in case I forget to run sudo again.
Camera focus issue is because the camera cannot focus at all zoom levels, as suggested above. As soon as I zoomed in or out to a medium range (say around 5000), focus was possible. Also, unless you can manually focus (see previous comment), autofocus won't work.
@JimWroten I am glad to hear that you are making progress. The reason why not all zoom levels can do focus is because the lens' back focal length need to be changed to adapt to it. You can slightly change the lens height to the sensor surface to try it out.
Hello, I have this same issue. sudo does nothing for me however. Using Python 2.7.16. I get preview for 1 second then the script terminates. Please advise. Thanks.
I'm using FocuserExample.py. Look at the TRY on line 28. If this fails, it goes to the EXCEPT and exits without any info. Try adding a message before the sys.exit(0) and see what you get. I ended up adding debugging messages every few lines until I found an issue with my install.
I definitely had to use sudo python FocuserExample.py to run it.
Hey, thanks so much for the reply… My problem was silly, I did not have Raspberry Pi Camera and i2c enabled in Raspberry>Preferences>Raspberry Pi Configuration! Should be in the instructions though. One other problem though minor for me, I have a 2K screen and the pi camera preview size is huge and covers the PTZ gui so I can’t access it. I had to comment out camera.start_preview() in main() to see it. For my application I don’t need the preview but I noticed other people having this problem as well. BTW- I am using AR1820HS camera board and it seems to work even without vignetting even though the sensor is larger and requires different code to preview.
From: Jim Wroten notifications@github.com Sent: Monday, May 25, 2020 12:53 PM To: ArduCAM/PTZ-Camera-Controller PTZ-Camera-Controller@noreply.github.com Cc: eikenbery eikenbery@gmail.com; Comment comment@noreply.github.com Subject: Re: [ArduCAM/PTZ-Camera-Controller] PTZ Controller not responsive on RaspberryPi 4 (#3)
I'm using FocuserExample.py. Look at the TRY on line 28. If this fails, it goes to the EXCEPT and exits without any info. Try adding a message before the sys.exit(0) and see what you get. I ended up adding debugging messages every few lines until I found an issue with my install.
I definitely had to use sudo python FocuserExample.py to run it.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ArduCAM/PTZ-Camera-Controller/issues/3#issuecomment-633650946 , or unsubscribe https://github.com/notifications/unsubscribe-auth/APWVDDLZL7QTIK5UGRB3SETRTKO5ZANCNFSM4KJZW7FA . https://github.com/notifications/beacon/APWVDDJGQZTGNLTB2FZUMA3RTKO5ZA5CNFSM4KJZW7FKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEXCL6AQ.gif
Good to know you've sorted this out. By the way, if you need the preview to work, you can supply parameters to get the scale you need. I use: camera.start_preview(fullscreen=False, window = (20, 20, 640, 480))
Hi, Can you help me please? I use a Raspberry Pi 4B with this camera. When I run FocusExample.py, the menu with the camera preview works but when I try to change the values of any function, the error "[Errno 121] Remote I/O error" appears. I installed i2c-tools and python-smbus, i2c is enabled. I tried some solutions that I saw in forums but it does not work. The camera is detected when I do "i2cdetect". I do not understand what happens. Thank you for your help.
Hello Everyone Hope you are good and the stated problem would have solved.. If not then let me share my experience .. I came to this post because i faced same issue stated by m0-n, but the only reason my PTZ-controller was not working is that I2C was not enabled.
Before enabling I2C, and after running FocuserExamply.py, camera was turning on for fraction of second and then turning off and not GUI was appearing as shown in instructions. Then i enabled I2C and run the FocuserExample.py. Still no GUI appeared But i pressed UP/Down keyboard keys and checked the movement of motors, Lucky they are turning right and left. Hope my experience might help someone.
Hi,
we use the controller camera for a research project and encountered an issue:
The camera works, but we can not use the software zoom and focus, resulting in very blury images.
We did everything exactly as described here: https://www.arducam.com/docs/cameras-for-raspberry-pi/ptz-camera/user-guide/
When we run:
pi@raspberrypi:~/new/PTZ-Camera-Controller/pyCode $ python2 AutofocusExample.py
It shows a picture for a second and then closes, without any options. Same for all other scripts in the Github repo.When we run:
pi@raspberrypi:~/new/PTZ-Camera-Controller/pyCode $ python3 AutofocusExample.py
We get an error:The same reproduces with all other scripts in the directory.
We believe our setup is correct:
We use the latest hardware, a RaspberryPi 4 with 4GB Ram and Rasbian Full. I first thought it might be a problem with Python2/3, but seems not quite like it.
If anyone has some ideas, it would be very much appreciated - I can also provide more information, if you tell me what you need. Hope to be proud long-term ArduCAM users :)