Fwd: Error Releasing VideoCapture in OpenCV Using GStreamer Pipeline
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Fri Nov 15 01:29:07 CET 2024
Hi Gaspar,
On Thu, Nov 14, 2024 at 12:27:41PM +0100, Gaspar Ramôa wrote:
> Hello Laurent Pinchart,
>
>
> Thank you for the quick reply!
>
> As I created the issue 3 months ago and got no reply from you I thought
> that you were no longer active or working in this project, and that is
> why I said it was difficult to get you! But I am glad I was able to
> reach you! :-)
I don't usually keep track of the issues on
https://github.com/raspberrypi/libcamera. That repository is Raspberry
Pi's clone of libcamera (with a few additional changes specific to their
platform that they carry in their tree for early user access, until they
get merged upstream), I focus on libcamera upstream.
> I spent the entire afternoon following your suggestion.
>
> So I was successfully able to install the latest version of libcamera
> and the latest version of the rpicam-apps:
>
> /rpicam-apps build: v1.5.3 50958df98d3c 13-11-2024 (16:55:55)
> rpicam-apps capabilites: egl:1 qt:1 drm:1 libav:1
> libcamera build: v0.3.2+98-75fe515a/
>
> However when trying to run *gst-inspect-1.0 libcamerasrc *the system
> could not find the libcamerasrc. I had to activate some environment
> under /libcamera/build/ with *meson devenv -C build*
>
> After this I was able to start the capture and release it *without any
> errors or warnings*. This is really a great positive step for me!
>
> The frame saved is still weird but I think you probably know what is
> missing here. I know that I still have to use some tunnig-files but the
> horizontal strips I have no idea what they are. I am using *format *=
> BGR and x-raw video on the gstreamer pipeline. Do you have any idea on
> how to convert these to the normal RGB. Like using the *rpicam-still *-o
> test.png gives me this:
>
> And I able getting something like this from the gstreamer pipeline:
>
> Any ideas? Where can I find the documentation of *libcamerasrc *so I can
> have an idea on what I can change/do.
>
>
> My end goal is to just be able to use the benefits of libcamera
> (changing analog gain, exposure, etc) in JAVA.
I see in other e-mails that you managed to solve your issues so I won't
reply here. If you have any additional question, or if there is anything
specific I forgot to answer, please let me know.
> On 13/11/2024 14:35, Laurent Pinchart wrote:
> > On Wed, Nov 13, 2024 at 12:51:11PM +0100, Gaspar Ramôa wrote:
> >> Dear libcamera community,
> >>
> >> Thank you for developing such a helpful library.
> > I'm glad you find it helpful.
> >
> >> I am trying to get frames using opencv. I am actually able to get frames via
> >> cv2.VideoCapture through GStreamer.
> >>
> >> However, when I try to release the capture (for ending the program or maybe
> >> adjusting raw image size): cap.release()
> >> I get the following error:
> >>
> >> [1:39:52.854669803] [1885] ERROR DeviceEnumerator device_enumerator.cpp:172
> >> Removing media device /dev/media4 while still in use
> >> [1:39:52.854709759] [1885] ERROR DeviceEnumerator device_enumerator.cpp:172
> >> Removing media device /dev/media3 while still in use
> >>
> >> I've already published an issue on the raspberry Pi libcamera GitHub repo where
> >> you can get more detail on my problem:https://github.com/raspberrypi/libcamera
> >> /issues/163
> >>
> >> I found the following commit which apparently did to solve the problem I am
> >> having now:https://github.com/raspberrypi/libcamera/commit/
> >> fa63d428aef62bacf0a6ad1622a7965b3ff2ba2f
> > That commit has been merged a long time ago, before v0.0.1, so I expect
> > it is included in the libcamera version you are using. Your problem may
> > have the same symptoms but a different root cause.
> >
> > You mentioned in your bug report that you tried both libcamera v0.0.5
> > and v0.3.0+65-6ddd79b5. v0.0.5 is fairly old. v0.3.0 is better, but I
> > would still recommend trying the latest master branch to see if the
> > issue has been fixed already.
> >
> > If the issue is still present, can you try running the same GStreamer
> > pipeline (likely replacing appsink with some sort of display sink, or
> > even fakesink) from gst-launch, and see if the problem exists there too
> > ?
> >
> >> This commit was done by the userhttps://github.com/pinchartl. But I have no
> >> way of contacting him to help me fix the problem.
> > I'm slightly puzzled by why you had trouble contacting me, given that my
> > e-mail address is listed in the commit you mentioned above. Regardless,
> > it looks like you found a way :-)
> >
> >> Any suggestions? Thanks in advance!
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list