Skip to content

videoio/gstreamer: Add support for GRAY16_LE.#18694

Merged
alalek merged 3 commits intoopencv:masterfrom
zyp:gstreamer_gray16
Aug 16, 2021
Merged

videoio/gstreamer: Add support for GRAY16_LE.#18694
alalek merged 3 commits intoopencv:masterfrom
zyp:gstreamer_gray16

Conversation

@zyp
Copy link
Copy Markdown
Contributor

@zyp zyp commented Oct 29, 2020

This patch adds 16-bit grayscale support to GStreamerCapture and updates the test with 16-bit support and a 16-bit test case.

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or other license that is incompatible with OpenCV
  • The PR is proposed to proper branch
  • There is reference to original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake
force_builders=Custom
build_image:Custom=gstreamer:16.04
buildworker:Custom=linux-1

@zyp
Copy link
Copy Markdown
Contributor Author

zyp commented Oct 29, 2020

I missed this before I started, but I see now that this is a duplicate of #14035. What would it take to get either of these merged?

@mshabunin
Copy link
Copy Markdown
Contributor

@zyp , the test fails on my machine, looks like only part of frame is returned.

@alalek , do we have a configuration on buildbot with GStreamer enabled?

@zyp
Copy link
Copy Markdown
Contributor Author

zyp commented Nov 26, 2020

Hi, I can look into the test if you can post the log of how it is failing. I'm pretty sure it was passing here, so I'd like to get an idea of what's going on before I spend time trying to reproduce your result.

I looked through the buildbot logs, and GStreamer is disabled in both the Linux x64 and the Linux32 build, and I guess none of the other configs are likely to have it either, so it's a reasonable assumption that buildbot didn't run the relevant test.

@mshabunin
Copy link
Copy Markdown
Contributor

mshabunin commented Nov 26, 2020

@zyp , it is reproducible only in plugin-mode: -DVIDEOIO_PLUGIN_LIST=gstreamer cmake option.

Dynamic plugin-backend assumes frame is 8U:

cv::Mat(cv::Size(width, height), CV_MAKETYPE(CV_8U, cn), (void*)data, step).copyTo(*dst);

@zyp
Copy link
Copy Markdown
Contributor Author

zyp commented Nov 26, 2020

Ah, that makes sense.

How should we go about solving this? Would it suffice to disable the 16-bit test in plugin mode for now and leave that as unsupported, or should I take a look at improving the plugin-backend to support 16-bit?

Actually, at a glance it looks straightforward enough to improve the plugin-backend, so I will make an attempt at that and submit it as a separate PR that should be merged before this PR.

@joshdoe
Copy link
Copy Markdown
Contributor

joshdoe commented Feb 18, 2021

Just mentioning #19320 to link this.

@asenyaev
Copy link
Copy Markdown
Contributor

asenyaev commented Apr 8, 2021

jenkins cn please retry a build

@mshabunin
Copy link
Copy Markdown
Contributor

@zyp, I've updated your PR. If possible please check if it works in your scenarios.

@mshabunin
Copy link
Copy Markdown
Contributor

mshabunin commented Aug 11, 2021

I've also added BGRx format support (resolve #11059, #15999).
@alalek , please take a look.

@mshabunin mshabunin requested a review from alalek August 11, 2021 19:31
Copy link
Copy Markdown
Member

@alalek alalek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 👍

Copy link
Copy Markdown
Member

@alalek alalek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please take a look on GStreamer tests.
Looks like there are several failures due to changed output types



caps.attach(gst_caps_from_string("video/x-raw, format=(string){BGR, GRAY8}; video/x-bayer,format=(string){rggb,bggr,grbg,gbrg}; image/jpeg"));
caps.attach(gst_caps_from_string("video/x-raw, format=(string){BGR, BGRA, RGBA, BGRx, RGBx, GRAY8, GRAY16_LE, GRAY16_BE}; video/x-bayer,format=(string){rggb,bggr,grbg,gbrg}; image/jpeg"));
Copy link
Copy Markdown
Member

@alalek alalek Aug 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps this should be changed for "manual" pipelines only.
Or when passed parameters have CONVERT_RGB=0 (however there is another parameter which limits requested color codes).

@alalek alalek merged commit 8dcec03 into opencv:master Aug 16, 2021
@alalek alalek mentioned this pull request Oct 15, 2021
@mshabunin mshabunin mentioned this pull request Feb 8, 2022
6 tasks
a-sajjad72 pushed a commit to a-sajjad72/opencv that referenced this pull request Mar 30, 2023
* videoio/gstreamer: Add support for GRAY16_LE.

* videoio/gstreamer: added BGRA/BGRx support

Co-authored-by: Maksim Shabunin <maksim.shabunin@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants