Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camera_num option in PiCamera #64

Closed
4 tasks done
deepav-ai opened this issue Nov 2, 2019 · 20 comments
Closed
4 tasks done

Camera_num option in PiCamera #64

deepav-ai opened this issue Nov 2, 2019 · 20 comments
Assignees
Labels
ENHANCEMENT ⚡ New Feature/Addition/Improvement QUESTION ❓ User asked about the working/usage of VidGear APIs. SOLVED 🏁 This issue/PR is resolved now. Goal Achieved!
Milestone

Comments

@deepav-ai
Copy link

Question

I'm using a Raspberry Pi Compute module with two RPI cameras. I'm using the example code for the Raspberry Pi camera and I'm trying to use the camera_num option from here:

class picamera.PiCamera(camera_num=0, stereo_mode='none', stereo_decimate=False, resolution=None, framerate=None, sensor_mode=0, led_pin=None, clock_mode='reset', framerate_range=None)

I tried putting it in

stream = PiGear(camera_num=1, resolution=...

and also in the options string but both times it says
'PiCamera' object has no attribute 'camera_num'.

Is this supported? If I use the PiCamera module directly this works.

Acknowledgment

  • A brief but descriptive Title of your issue.
  • I have searched the issues for my issue and found nothing related or helpful.
  • I have read the FAQ.
  • I have read the Wiki.

Context

I'm trying to synchronize the two Raspberry Pi Cameras. If I use PiCamera library and thread them they are still slightly out of sync. I'm hoping to use this library to simply write a timestamp to a log file for each video and then I'll attempt to sync them offline. The built in stereoscopic option in the PiCamera library doesn't support anything over about 640x480 and I'm looking to record at 1920x1080 on each camera.

Your Environment

  • VidGear version: 0.1.5
  • Branch:
  • Python version: 3.7
  • pip version: 3
  • Operating System and version: Raspbian

Optional

@abhiTronix abhiTronix added ENHANCEMENT ⚡ New Feature/Addition/Improvement EXEMPLARY 🎖️ Exemplary for newcomers labels Nov 2, 2019
@abhiTronix abhiTronix added this to the v0.1.6 milestone Nov 2, 2019
@abhiTronix
Copy link
Owner

abhiTronix commented Nov 2, 2019

I'm using a Raspberry Pi Compute module with two RPI cameras. I'm using the example code for the Raspberry Pi camera and I'm trying to use the camera_num option from here:
class picamera.PiCamera(camera_num=0, stereo_mode='none', stereo_decimate=False, resolution=None, framerate=None, sensor_mode=0, led_pin=None, clock_mode='reset', framerate_range=None)

@deepav-ai Thank you for following the issue template and bringing this idea up, I didn't know about this Picamera feature until now and surely this will be a nice addition to VidGear.

I tried putting it in
stream = PiGear(camera_num=1, resolution=...
and also in the options string but both times it says
'PiCamera' object has no attribute 'camera_num'.
Is this supported? If I use the PiCamera module directly this works.

For now camera_num will not work, As of now PiGear only supports a single Rpi Camera Module. But as you requested, I'll add this feature in the next few days. In the meantime, Can you provide any additional information(like its docs links, API references, code examples etc.) regarding this camera_num option? that will be helpful.

I'm trying to synchronize the two Raspberry Pi Cameras. If I use PiCamera library and thread them they are still slightly out of sync. I'm hoping to use this library to simply write a timestamp to a log file for each video and then I'll attempt to sync them offline. The built in stereoscopic option in the PiCamera library doesn't support anything over about 640x480 and I'm looking to record at 1920x1080 on each camera.

Yes according to my tests, PiGear can work at full 1080p at 60fps as of now, but it will be a bit challenging to extend it to two cameras and sync them but it is certainly possible as it is already done in CamGear API. Kindly wait till I push the next PR related to this feature in the upcoming few days tackling these challenges. Then I'll be asking you to test it. Good luck!

@abhiTronix abhiTronix self-assigned this Nov 2, 2019
@deepav-ai
Copy link
Author

https://picamera.readthedocs.io/en/release-1.13/api_camera.html#picamera

camera_num = 0 or 1.
stereo_mode = 'side-by-side' might be useful to some but as I mentioned the resolution is too limited.

Previously when I created two PiCamera objects and had one as camera_num=0 and the other as camera_num=1 and set both to 1920x1080 30FPS it recorded both with no problem performance wise, just the sync was off when verified by recording a stop watch.

@abhiTronix
Copy link
Owner

Previously when I created two PiCamera objects and had one as camera_num=0 and the other as camera_num=1 and set both to 1920x1080 30FPS it recorded both with no problem performance wise, just the sync was off when verified by recording a stop watch.

I think we need to do syncing at the software side as Raspberry Pi is not powerful enough to make it possible at hardware end due to limited RAM & GPU shared memory. I'm thinking that We can release different camera frames at the same timestamp with VidGear's queue structure currently employed in CamGear API to achieve syncing virtually without any extra overhead. Let's try this approach out and see if it is possible. How much tolerance in timing between two camera frames is acceptable at your end, Or you looking for exact match?

@abhiTronix abhiTronix added WORK IN PROGRESS 🚧 currently been worked on. and removed EXEMPLARY 🎖️ Exemplary for newcomers labels Nov 4, 2019
@abhiTronix
Copy link
Owner

abhiTronix commented Nov 4, 2019

The built in stereoscopic option in the PiCamera library doesn't support anything over about 640x480 and I'm looking to record at 1920x1080 on each camera.

@deepav-ai I think picamera library does support resolution over 640x480, the thing is that the resolution of the final image we get from stereoscopic mode is the same as the given (or default) resolution parameter, and if a regular 4/3 ratio is given, the two images will be halved so that their combination fits into a 4/3 image. For example, to get one stereo image with two full (480x320) images inside, I have to use something like this : camera = picamera.PiCamera(stereo_mode='side-by-side', resolution=(960,320), stereo_decimate=False)

This is described in their docs:

The stereo_mode parameter defaults to 'none' (no stereoscopic mode) but can be set to 'side-by-side' or 'top-bottom' to activate a stereoscopic mode. If the stereo_decimate parameter is True, the resolution of the two cameras will be halved so that the resulting image has the same dimensions as if stereoscopic mode were not being used.

Also you can ONLY preview a stereoscopic image on a stereoscopic display (eg 3D TV). There is currently no option to render it on a standard screen as SBS or TB.

@deepav-ai
Copy link
Author

I'm using the StereoPI (RPI compute module with 2 CSI inputs) from the user in that post. When I try 640x480 it will output a file that is 1280x480 SBS. If I try 1280x720 in each camera to get 2560x720 it doesn't work. Here's a thread I opened on it, realizator/stereopi-tutorial#7

I don't really want SBS, two separate videos is better because this will go through a machine learning workflow as separate feeds.

@deepav-ai
Copy link
Author

For your question on tolerance, I'm not sure yet but this is video footage from a car going highway speeds so it's likely pretty sensitive to sync.

@abhiTronix
Copy link
Owner

abhiTronix commented Nov 5, 2019

When I try 640x480 it will output a file that is 1280x480 SBS. If I try 1280x720 in each camera to get 2560x720 it doesn't work.

@deepav-ai You are interpreting this wrong. In your dual camera setup on your Compute module with Picamera library, You only need to specify your final stereoscopic image size in the resolution parameter such as resolution = (1280,720) to get a 1280x720 final stereoscopic(merged two frames into one) image. But the resulting individual frame dimensions depend upon the value of stereo_mode parameter, for example stereo_mode='side-by-side' means the width will get divided into half and therefore the dimensions of individual frame will be 640x720 each, whereas, if you choose stereo_mode='top-bottom' means the height will get divided into half and therefore dimensions of individual frame will be 1280x360 each. Did you get the idea?

I don't really want SBS, two separate videos is better because this will go through a machine learning workflow as separate feeds.

@deepav-ai Yes I'm working on it and very shortly I'm pushing a PullRequest related to this, Kindly stay tuned and ready to test it.

abhiTronix added a commit that referenced this issue Nov 6, 2019
- added new `camera_num` to support multiple Picameras(#64)
- moved thread exceptions to main thread and then re-raised(#61)
- added new  threaded timeout function to handle any hardware failures/frozen threads(#61)
- PiGear will not exit safely if Picamera ribbon cable is pulled out to save resources
- Minor tweaks for more robust overall error handling.
@abhiTronix
Copy link
Owner

abhiTronix commented Nov 6, 2019

Hello @deepav-ai, Kindly install the related PR(#67) as follows:

git clone https://github.com/abhiTronix/vidgear.git
cd vidgear
git checkout development
sudo pip3 install .
cd

I've added the camera_num parameter to PiGear.

Test syncing:

To test sync between two cameras use following code (:warning: Remember to keep all parameter except camera_num similar in both Cameras streams):

# import required libraries
from vidgear.gears import PiGear
import cv2
import time

#Remember to keep all parameter except `camera_num` similar in both following Cameras streams

# define and start the stream on first source ( For e.g #0 index Picamera)
stream1 = PiGear(camera_num=0, resolution=(640, 480), framerate=30, logging=True).start() 

# define and start the stream on second source ( For e.g #1 index Picamera)
stream2 = PiGear(camera_num=1, resolution=(640, 480), framerate=30, logging=True).start() 

# infinite loop
while True:
	
	frameA = stream1.read()
	# read frames from stream1

	frameB = stream2.read()
	# read frames from stream2

	# check if any of two frame is None
	if frameA is None or frameB is None:
		#if True break the infinite loop
		break
	
	# do something with both frameA and frameB here
	cv2.imshow("Output Frame1", frameA)
	cv2.imshow("Output Frame2", frameB)
	# Show output window of stream1 and stream 2 seperately

	key = cv2.waitKey(1) & 0xFF
	# check for 'q' key-press
	if key == ord("q"):
		#if 'q' key-pressed break out
		break

	if key == ord("w"):
		#if 'w' key-pressed save both frameA and frameB at same time
		cv2.imwrite("Image-1.jpg", frameA)
		cv2.imwrite("Image-2.jpg", frameB)
		#break   #uncomment this line to break out after taking images

cv2.destroyAllWindows()
# close output window

# safely close both video streams
stream1.stop()
stream2.stop()

While running above code, To confirm syncing press w on your keyboard and see if output images (i.e "Image-1.jpg", "Image-2.jpg") are of the same time duration. Kindly Test this example code and revert if you experience any difficulty or improper results.

Also don't forget to go through the PR, to see what has changed. Good luck.

@abhiTronix abhiTronix added WAITING TO TEST ⏲️ Asked user to test the suggested example/binary/solution and removed WORK IN PROGRESS 🚧 currently been worked on. labels Nov 6, 2019
@deepav-ai
Copy link
Author

I ran the exact commands you posted and the code. I then did a fresh reboot.

pi@raspberrypi:~/Documents/Embedded-Python $ python record-stereo2.py
'PiCamera' object has no attribute 'camera_num'
mmal: mmal_vc_port_enable: failed to enable port vc.null_sink:in:0(OPQV): ENOSPC
mmal: mmal_port_enable: failed to enable connected port (vc.null_sink:in:0(OPQV))0x142a3d0 (ENOSPC)
mmal: mmal_connection_enable: output port couldn't be enabled
Traceback (most recent call last):
File "record-stereo2.py", line 9, in
stream2 = PiGear(camera_num=1, logging=True).start()
File "/home/pi/.local/lib/python3.7/site-packages/vidgear/gears/pigear.py", line 87, in init
self.camera = PiCamera()
File "/usr/lib/python3/dist-packages/picamera/camera.py", line 433, in init
self._init_preview()
File "/usr/lib/python3/dist-packages/picamera/camera.py", line 513, in _init_preview
self, self._camera.outputs[self.CAMERA_PREVIEW_PORT])
File "/usr/lib/python3/dist-packages/picamera/renderers.py", line 558, in init
self.renderer.inputs[0].connect(source).enable()
File "/usr/lib/python3/dist-packages/picamera/mmalobj.py", line 2212, in enable
prefix="Failed to enable connection")
File "/usr/lib/python3/dist-packages/picamera/exc.py", line 184, in mmal_check
raise PiCameraMMALError(status, prefix)
picamera.exc.PiCameraMMALError: Failed to enable connection: Out of resources

@abhiTronix
Copy link
Owner

abhiTronix commented Nov 6, 2019

self.camera = PiCamera()

but it should be self.camera = PiCamera(camera_num = camera_num)

@deepav-ai this line means you're still using old vidgear binaries. This happens when you have multiple python version on your machine, Kindly clean reinstall vidgear as follows: (⚠️ Kindly copy-paste these lines to your terminal and do not alter)

makedir - p installdir && cd installdir 
sudo pip uninstall vidgear
git clone https://github.com/abhiTronix/vidgear.git
cd vidgear
git checkout development
sudo python -m pip install .
cd

Traceback (most recent call last):
File "record-stereo2.py", line 9, in
stream2 = PiGear(camera_num=1, logging=True).start()

@deepav-ai This lines Clearly means you're NOT using the exactly the same above code that I provided to test syncing between two cameras. See code in my comment above: stream2 = PiGear(camera_num=1, resolution=(640, 480), framerate=30, logging=True).start() but you are using stream2 = PiGear(camera_num=1, logging=True).start() instead. Kindly copy-paste the above code only.


mmal: mmal_vc_port_enable: failed to enable port vc.null_sink:in:0(OPQV): ENOSPC
mmal: mmal_port_enable: failed to enable connected port (vc.null_sink:in:0(OPQV))0x142a3d0 (ENOSPC)
mmal: mmal_connection_enable: output port couldn't be enabled

Either another python script you used recently using this camera (Can be solved by Restarting your Pi) or it means the CSI port failed to enable since the GPU memory is not enough. Kindly increase you GPU memory by changing gpu_mem=256 or above in /boot/config.txt and then REBOOT your Pi. Also check your both camera connection to your raspberry Pi. If this doesn't work, run sudo service motion stop command and try again:

@deepav-ai
Copy link
Author

pi@raspberrypi:~/Documents/installdir/vidgear $ sudo python -m pip install .
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Processing /home/pi/Documents/installdir/vidgear
Collecting mss (from vidgear==0.1.6.dev0)
Using cached https://files.pythonhosted.org/packages/67/2a/8e26437bcc840e19ca5290897d47f5405e302af27d4a6401e0b0edc39942/mss-4.0.3-py2.py3-none-any.whl
Collecting opencv-contrib-python (from vidgear==0.1.6.dev0)
Could not find a version that satisfies the requirement opencv-contrib-python (from vidgear==0.1.6.dev0) (from versions: )

No matching distribution found for opencv-contrib-python (from vidgear==0.1.6.dev0)
pi@raspberrypi:~/Documents/installdir/vidgear $

@abhiTronix
Copy link
Owner

@deepav-ai paste the output of following command from your Pi terminal:

sudo python -c "import platform; print(platform.python_version())"

and also try running above code for syncing with command python3 record-stereo2.py instead of python record-stereo2.py that you used earlier. Does that makes any difference?

@deepav-ai
Copy link
Author

2.7.16.
That's odd because if I just run python (not python3) at command prompt it shows 3.7.3.
I re-ran the pip install with python3 and it completed without error.

pi@raspberrypi:~/Documents/installdir/vidgear $ python3
Python 3.7.3 (default, Apr  3 2019, 05:39:12) 
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> quit()
pi@raspberrypi:~/Documents/installdir/vidgear $ python
Python 3.7.3 (default, Apr  3 2019, 05:39:12) 
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> quit()
pi@raspberrypi:~/Documents/installdir/vidgear $ sudo python3 -m pip install .
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Processing /home/pi/Documents/installdir/vidgear
Requirement already satisfied: mss in /usr/local/lib/python3.7/dist-packages (from vidgear==0.1.6.dev0) (4.0.3)
Requirement already satisfied: pafy in /usr/local/lib/python3.7/dist-packages (from vidgear==0.1.6.dev0) (0.5.4)
Requirement already satisfied: picamera in /usr/lib/python3/dist-packages (from vidgear==0.1.6.dev0) (1.13)
Requirement already satisfied: pyzmq in /usr/local/lib/python3.7/dist-packages (from vidgear==0.1.6.dev0) (18.1.0)
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (from vidgear==0.1.6.dev0) (2.21.0)
Requirement already satisfied: youtube-dl in /usr/local/lib/python3.7/dist-packages (from vidgear==0.1.6.dev0) (2019.11.5)
Building wheels for collected packages: vidgear
  Running setup.py bdist_wheel for vidgear ... done
  Stored in directory: /tmp/pip-ephem-wheel-cache-tykmd34j/wheels/47/8b/b5/d10a8f0352c650c2d38ec7abdf2112fd23a1e440a2f38f5b59
Successfully built vidgear
Installing collected packages: vidgear
Successfully installed vidgear-0.1.6.dev0

I changed to gpu_mem=256 and rebooted. I've checked the cameras with the standard Picamera script and they work.

sudo service motion stop Failed to stop motion.service: Unit motion.service not loaded.

pi@raspberrypi:~/Documents/Embedded-Python $ python3 record-stereo2.py
'PiCamera' object has no attribute 'camera_num'
mmal: mmal_vc_port_enable: failed to enable port vc.null_sink:in:0(OPQV): ENOSPC
mmal: mmal_port_enable: failed to enable connected port (vc.null_sink:in:0(OPQV))0x1723550 (ENOSPC)
mmal: mmal_connection_enable: output port couldn't be enabled
Traceback (most recent call last):
  File "record-stereo2.py", line 9, in <module>
    stream2 = PiGear(camera_num=1, resolution=(640,480), framerate=30, logging=True).start() 
  File "/home/pi/.local/lib/python3.7/site-packages/vidgear/gears/pigear.py", line 87, in __init__
    self.camera = PiCamera()
  File "/usr/lib/python3/dist-packages/picamera/camera.py", line 433, in __init__
    self._init_preview()
  File "/usr/lib/python3/dist-packages/picamera/camera.py", line 513, in _init_preview
    self, self._camera.outputs[self.CAMERA_PREVIEW_PORT])
  File "/usr/lib/python3/dist-packages/picamera/renderers.py", line 558, in __init__
    self.renderer.inputs[0].connect(source).enable()
  File "/usr/lib/python3/dist-packages/picamera/mmalobj.py", line 2212, in enable
    prefix="Failed to enable connection")
  File "/usr/lib/python3/dist-packages/picamera/exc.py", line 184, in mmal_check
    raise PiCameraMMALError(status, prefix)
picamera.exc.PiCameraMMALError: Failed to enable connection: Out of resources

@abhiTronix
Copy link
Owner

abhiTronix commented Nov 7, 2019

@deepav-ai There's a complete mess with python paths and pip on your Pi. There are surprisingly three different python3 modules directories on your computer, one is newer python 3.7.3(located at "/home/pi/.local/lib/python3.7/site-packages"), second is same python 3.7.3( but located at "/usr/local/lib/python3.7/dist-packages") and other one is legacy python 3(located at "/usr/lib/python3/dist-packages"). Therefore you are installing vidgear in different python3 directory and running it from different python3 version interpreter, hence resulting in these errors.

Kindly paste output of following commands:

which python
which python3
which python37

python -c "import site;print(site.getsitepackages())"
python -c "import site;print(site.getusersitepackages())"
python3 -c "import site;print(site.getsitepackages())"
python3 -c "import site;print(site.getusersitepackages())"
sudo python3 -c "import site;print(site.getsitepackages())"
sudo python3 -c "import site;print(site.getusersitepackages())"

@abhiTronix abhiTronix added the QUESTION ❓ User asked about the working/usage of VidGear APIs. label Nov 7, 2019
@deepav-ai
Copy link
Author

deepav-ai commented Nov 7, 2019

pi@raspberrypi:~/Documents/Embedded-Python $ which python
/usr/bin/python
pi@raspberrypi:~/Documents/Embedded-Python $ which python3
/usr/bin/python3
pi@raspberrypi:~/Documents/Embedded-Python $ which python37
pi@raspberrypi:~/Documents/Embedded-Python $ python -c "import site;print(site.getsitepackages())"
['/usr/local/lib/python3.7/dist-packages', '/usr/lib/python3/dist-packages', '/usr/lib/python3.7/dist-packages']
pi@raspberrypi:~/Documents/Embedded-Python $ python -c "import site;print(site.getusersitepackages())"
/home/pi/.local/lib/python3.7/site-packages
pi@raspberrypi:~/Documents/Embedded-Python $ python3 -c "import site;print(site.getsitepackages())"
['/usr/local/lib/python3.7/dist-packages', '/usr/lib/python3/dist-packages', '/usr/lib/python3.7/dist-packages']
pi@raspberrypi:~/Documents/Embedded-Python $ python3 -c "import site;print(site.getusersitepackages())"
/home/pi/.local/lib/python3.7/site-packages
pi@raspberrypi:~/Documents/Embedded-Python $ sudo python3 -c "import site;print(site.getsitepackages())"
['/usr/local/lib/python3.7/dist-packages', '/usr/lib/python3/dist-packages', '/usr/lib/python3.7/dist-packages']
pi@raspberrypi:~/Documents/Embedded-Python $ sudo python3 -c "import site;print(site.getusersitepackages())"
/root/.local/lib/python3.7/site-packages

Here's what I get if I run these commands
/usr/bin/python - 2.7.16
python - 3.7.3
/usr/bin/python3 - 3.7.3
python3 - 3.7.3

@abhiTronix
Copy link
Owner

abhiTronix commented Nov 8, 2019

@deepav-ai Thanks, Python is working as expected but Pip not. I'll advise to completely remove both distro pip as follows(if present):

sudo apt purge python-pip  
sudo apt purge python3-pip

and then install the official pip as follows:

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
python3 get-pip.py

and then install vidgear as previous:

git clone https://github.com/abhiTronix/vidgear.git
cd vidgear
git checkout development
sudo pip3 install .
cd

and test above given code with python3 record-stereo2.py, it should work.

@abhiTronix

This comment has been minimized.

@abhiTronix
Copy link
Owner

@deepav-ai I'm merging the PR now as it performed as expected at my end, Kindly share your results when you're ready. Good luck!

@abhiTronix abhiTronix added SOLVED 🏁 This issue/PR is resolved now. Goal Achieved! and removed WAITING TO TEST ⏲️ Asked user to test the suggested example/binary/solution labels Nov 9, 2019
abhiTronix added a commit that referenced this issue Nov 9, 2019
Major Updates and BugFixes for PiGear

- added new camera_num to support multiple Picameras(#64)
- moved thread exceptions to the main thread and then re-raised(#61)
- replaced traceback with sys.exc_info.
- added new threaded internal timing function to handle any hardware failures/frozen threads(#61)
- PiGear will not exit safely with SystemError if Picamera ribbon cable is pulled out to save resources.
- added support for new user-defined HWFAILURE_TIMEOUT options attribute to alter timeout.
- Minor tweaks for more robust overall error handling.
@deepav-ai
Copy link
Author

deepav-ai commented Nov 9, 2019

Ran the exact commands you listed above.

pi@raspberrypi:~/Documents/Embedded-Python $ python3 record-stereo2.py
'PiCamera' object has no attribute 'camera_num'
mmal: mmal_vc_port_enable: failed to enable port vc.null_sink:in:0(OPQV): ENOSPC
mmal: mmal_port_enable: failed to enable connected port (vc.null_sink:in:0(OPQV))0xf713a0 (ENOSPC)
mmal: mmal_connection_enable: output port couldn't be enabled
Traceback (most recent call last):
  File "record-stereo2.py", line 9, in <module>
    stream2 = PiGear(camera_num=1, resolution=(640,480), framerate=30, logging=True).start() 
  File "/home/pi/.local/lib/python3.7/site-packages/vidgear/gears/pigear.py", line 87, in __init__
    self.camera = PiCamera()
  File "/usr/lib/python3/dist-packages/picamera/camera.py", line 433, in __init__
    self._init_preview()
  File "/usr/lib/python3/dist-packages/picamera/camera.py", line 513, in _init_preview
    self, self._camera.outputs[self.CAMERA_PREVIEW_PORT])
  File "/usr/lib/python3/dist-packages/picamera/renderers.py", line 558, in __init__
    self.renderer.inputs[0].connect(source).enable()
  File "/usr/lib/python3/dist-packages/picamera/mmalobj.py", line 2212, in enable
    prefix="Failed to enable connection")
  File "/usr/lib/python3/dist-packages/picamera/exc.py", line 184, in mmal_check
    raise PiCameraMMALError(status, prefix)
picamera.exc.PiCameraMMALError: Failed to enable connection: Out of resources

@abhiTronix
Copy link
Owner

abhiTronix commented Nov 10, 2019

'PiCamera' object has no attribute 'camera_num'
File "/home/pi/.local/lib/python3.7/site-packages/vidgear/gears/pigear.py", line 87, in init
self.camera = PiCamera()

Means you're still somehow using the old vidgear library binaries. It's clear the problem of incorrect python packages(pip) paths on your pi and is beyond the scope of issue, Kindly fix this on your own end. If possible, test this library on a Fresh Raspbian Stretch/Buster OS and it must work, if it doesn't then report here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ENHANCEMENT ⚡ New Feature/Addition/Improvement QUESTION ❓ User asked about the working/usage of VidGear APIs. SOLVED 🏁 This issue/PR is resolved now. Goal Achieved!
Projects
None yet
Development

No branches or pull requests

2 participants