leswright1977 / PySpectrometer

Raspberry Pi Spectrometer
Apache License 2.0
668 stars 106 forks source link

GStreamer: pipeline have not been created #27

Open jresch opened 2 years ago

jresch commented 2 years ago

Hello!

Great project! I am just having a bit of an issue with openCV and GStreamer. Any suggestions would be much appreciated

[ WARN:0] global ../modules/videoio/src/cap_gstreamer.cpp (1824) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module v4l2src0 reported: Failed to allocate required memory. [ WARN:0] global ../modules/videoio/src/cap_gstreamer.cpp (914) open OpenCV | GStreamer warning: unable to start pipeline [ WARN:0] global ../modules/videoio/src/cap_gstreamer.cpp (501) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created

leswright1977 commented 2 years ago

What OS are you using for this?

Les

On Tuesday, July 19, 2022, jresch @.***> wrote:

Hello!

Great project! I am just having a bit of an issue with openCV and GStreamer. Any suggestions would be much appreciated

[ WARN:0] global ../modules/videoio/src/cap_gstreamer.cpp (1824) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module v4l2src0 reported: Failed to allocate required memory. [ WARN:0] global ../modules/videoio/src/cap_gstreamer.cpp (914) open OpenCV | GStreamer warning: unable to start pipeline [ WARN:0] global ../modules/videoio/src/cap_gstreamer.cpp (501) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created

— Reply to this email directly, view it on GitHub https://github.com/leswright1977/PySpectrometer/issues/27, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG5IEE4TFNAUFOEPCFD4N4LVU3YGNANCNFSM54A52PNA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

jresch commented 2 years ago

Using Raspberry Pi 4 with Raspberry Pi OS (32 bit)
https://www.raspberrypi.com/software/

leswright1977 commented 2 years ago

That explains it. The Software was developed on Raspbian Buster (still available) the latest Pi OS breaks the camera. At some point I will have to recode a section of this, but I am on vacation just now.

Les

On Thu, 21 Jul 2022, 19:36 jresch, @.***> wrote:

raspberry pi OS (32 bit) https://www.raspberrypi.com/software/

— Reply to this email directly, view it on GitHub https://github.com/leswright1977/PySpectrometer/issues/27#issuecomment-1191810328, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG5IEE2A7WTRJ3PHSRGGIITVVGKBBANCNFSM54A52PNA . You are receiving this because you commented.Message ID: @.***>

jresch commented 2 years ago

Well thank you so much for answering while you are on vacation! I will give it a try it with Raspbian Buster.

jresch commented 2 years ago

Have you come across this warning before (this is using Raspbian Buster)

[ WARN:0@1.005] global /tmp/pip-wheel-8c7uejek/opencv-python_88dbbad412c5416b992ae69de26299d6/opencv/modules/videoio/src/cap_v4l.cpp (902) open VIDEOIO(V4L2:/dev/video0): can't open camera by index Traceback (most recent call last): File "pyspectrometer-v3.1.py", line 512, in <module> App(arg_parser().parse_args(), tkinter.Tk(), "PySpectrometer V3.0") File "pyspectrometer-v3.1.py", line 79, in __init__ self.vid = MyVideoCapture(args.calibration or App.DEFAULT_CALIBRATION, self.video_source) File "pyspectrometer-v3.1.py", line 302, in __init__ raise ValueError("Unable to open video source", video_source) ValueError: ('Unable to open video source', 0)

leswright1977 commented 2 years ago

Weird, is the picamera connected, verified and working?

Les

On Monday, July 25, 2022, jresch @.***> wrote:

Have you come across this warning before (this is using Raspbian Buster)

[ @.*** global /tmp/pip-wheel-8c7uejek/opencv-python_ 88dbbad412c5416b992ae69de26299d6/opencv/modules/videoio/src/cap_v4l.cpp (902) open VIDEOIO(V4L2:/dev/video0): can't open camera by index Traceback (most recent call last): File "pyspectrometer-v3.1.py", line 512, in

App(arg_parser().parse_args(), tkinter.Tk(), "PySpectrometer V3.0") File "pyspectrometer-v3.1.py", line 79, in __init__ self.vid = MyVideoCapture(args.calibration or App.DEFAULT_CALIBRATION, self.video_source) File "pyspectrometer-v3.1.py", line 302, in __init__ raise ValueError("Unable to open video source", video_source) ValueError: ('Unable to open video source', 0) — Reply to this email directly, view it on GitHub , or unsubscribe . You are receiving this because you commented.Message ID: ***@***.***>
jresch commented 2 years ago

Yes, yes and yes.

jresch commented 2 years ago

As suggested online, I tried doing the cv2.VideoCapture(1) and cv2.VideoCapture(-1) and the cv2.VideoCapture(cv2.CAP_V4L2). Didn't work

jresch commented 2 years ago

So....I switched out the camera and it worked with Raspbian Buster.

Bra1nsen commented 2 years ago

any updates?

jresch commented 2 years ago

For me at least, not on the newest OS.

swagatk commented 1 year ago

I got similar warning with my picamera when I used cv2.VideoCapture() to open it. However, the following statement fixed these errors (Refer to this link for original source):

import cv2
cap = cv2.VideoCapture(0, cv2.CAP_V4L) 
print(cap.isOpened())

I am using NoIR Camera V2 Raspberry Pi 4B with Raspbian Buster 32bit OS, opencv 4.5.5, python 2.7.16 as well as python 3.7.3. The option cv2.CAP_V4L2 also works for me.

bycmlla commented 1 year ago

I have the same problem, 'pipeline have not been created' but i using the Jetson Nano Developer Kit and the imx219 camera. Someone knows help me?

Petros626 commented 1 year ago

@swagatk for me your suggested method dont work. I'm using Bullseye 64-bit. @bycmlla I've read a lot of Issues and still struggle with the new RPi OS and the OV5647.

swagatk commented 1 year ago

@swagatk for me your suggested method dont work. I'm using Bullseye 64-bit. @bycmlla I've read a lot of Issues and still struggle with the new RPi OS and the OV5647.

Hi, I have only tested this with Buster.

Petros626 commented 1 year ago

Update: I figured out, that with two settings you can run a camera with OpenCV (RPi or other manufacturer), BUT you very likely you will disable the new camera stack "libcamera".

Method 1: sudo nano /boot/config.txt #camera_auto_detect=1 gpu_mem=128 (minimum memory for camera) start_x=1 (enable the camera module) sudo reboot

Method 2: sudo raspi-config Interface Options Enable legay camera options

It's just a workaround and not a solution using cameras with the new Bullseye OS, but I think the guys from OpenCV will need just some time to fix that, so we aren't forced to use that.

SocioPJ commented 4 months ago

Tks @Petros626 !! It worked for me!!