add Y16/GRAY16_LE support to gstreamer#14035
add Y16/GRAY16_LE support to gstreamer#14035jveitchmichaelis wants to merge 1 commit intoopencv:3.4from
Conversation
87e924b to
1003f66
Compare
|
Fixed trailing whitespace |
9f36a8a to
ce389e4
Compare
|
@jveitchmichaelis , could you please add test case here: https://github.com/opencv/opencv/blob/master/modules/videoio/test/test_gstreamer.cpp Is this patch applicable to 3.4 branch too? If yes, please rebase your branch there and change pull request target to 3.4 branch. We will merge it to master later (see https://github.com/opencv/opencv/wiki/Branches). |
ce389e4 to
f73ca31
Compare
|
@mshabunin No problem. I've rebased to 3.4, I'll add some tests too. The main differences I can see were some checks for a particular version of gstreamer that are no longer in master. I added support for writing 16-bit frames with Gstreamer, but perhaps it makes sense to split that into another commit and leave this one only for capture. At a minimum I can add a testcase like: Would that be sufficient? |
I agree.
Yes, at minimum. It would be better to test handling of |
|
@mshabunin I've added two test cases. I also limited the scope of the PR to capture only, as suggested. There is:
One issue that I've noticed is that CAP_GSTREAMER doesn't follow the convention that capture pipelines should return 3-channel 8-bit images by default i.e. convert_rgb is ignored. Most of the outputs here (e.g. GRAY8, and all the YUV variants) return a single channel image and rely on the user to convert to colour. The existing test cases also (incorrectly) enforces this behaviour. I've raised that in #14084
|
15943ca to
d973424
Compare
4f9377d to
2bef72f
Compare
mshabunin
left a comment
There was a problem hiding this comment.
@jveitchmichaelis , sorry for delay.
I think we should remove CONVERT_RGB property from this PR. GStreamer backend is special because it allows to run manual pipelines, where user can specify output format. We have two modes: automatic pipeline - always return 8UC3 or 8UC1 and manual pipeline - return raw format requested by the user. So we just need to add 16-bit format to the list of supported formats for manual pipelines and test it. The test can be modified, so that it would call something like convertScaleAbs before doing cvtColor(GRAY2BGR).
@jveitchmichaelis, we'd be happy to test a patch for writing, please create a PR when you get a chance. We looked at doing it, but it's not obvious how we could automatically determine a pipeline is Y16, seems like we'd need a property. |
|
@mshabunin OK, I'll take a look at this again. I've not had a chance recently. So I'll change it so that 16 bit is only supported for manual pipelines. @joshdoe sure, will do! It will probably be doable based on the output codec. Relatively few formats actually support 16 bit output per channel, so you could infer on that plus the pixel format I think. |
@jveitchmichaelis Great, thanks. I recently added Y16 support to the GStreamer DirectShow source because I was testing a FLIR Boson thermal camera, but in this case we're using a Camera Link source (https://github.com/joshdoe/gst-plugins-vision). |
|
I've modified this to apply against master, as I couldn't easily get the 3.4 branch built. I removed the CONVERT_RGB bits as suggested by @mshabunin , and changed the tests a bit to check depth on all formats, and convert 16->8 for GRAY16_LE. My branch is joshdoe/opencv/y16_gstreamer_master. I also rebased this to 3.4, but haven't been able to test it: joshdoe/opencv/y16_gstreamer_3.4. Note the authorship changed to me, but I added Co-author as @jveitchmichaelis , I'm fine if this is flipped. |
|
@jveitchmichaelis The PR diverged with 3.4. Could you rebase and fix conflicts. |
|
@asmorkalov , I think #18694 is more compact and implements the same feature, so we can close this one. #18535 implements Y16 support in VideoWriter. |
|
Apologies, this feel through the cracks - feel free to go with whichever implementation you feel fits best. |
This pullrequest changes
CAP_PROP_CONVERT_RGBCV_8UC3by default, unlessCAP_PROP_CONVERT_RGBis set to false.Tested with a FLIR Boson