changed order of cap in order to work with jetson orin#25557
Closed
Liedermaus wants to merge 1 commit intoopencv:4.xfrom
Closed
changed order of cap in order to work with jetson orin#25557Liedermaus wants to merge 1 commit intoopencv:4.xfrom
Liedermaus wants to merge 1 commit intoopencv:4.xfrom
Conversation
asmorkalov
requested changes
May 7, 2024
Comment on lines
-1037
to
-1054
| else if (format == "GRAY8") | ||
| { | ||
| CV_CheckEQ((int)n_planes, 1, ""); | ||
| size_t step = GST_VIDEO_FRAME_PLANE_STRIDE(&frame, 0); | ||
| CV_CheckGE(step, (size_t)frame_width, ""); | ||
| Mat src(sz, CV_8UC1, GST_VIDEO_FRAME_PLANE_DATA(&frame, 0), step); | ||
| src.copyTo(dst); | ||
| return true; | ||
| } | ||
| else if (format == "GRAY16_LE" || format == "GRAY16_BE") | ||
| { | ||
| CV_CheckEQ((int)n_planes, 1, ""); | ||
| size_t step = GST_VIDEO_FRAME_PLANE_STRIDE(&frame, 0); | ||
| CV_CheckGE(step, (size_t)frame_width, ""); | ||
| Mat src(sz, CV_16UC1, GST_VIDEO_FRAME_PLANE_DATA(&frame, 0), step); | ||
| src.copyTo(dst); | ||
| return true; | ||
| } |
Contributor
There was a problem hiding this comment.
format is std::string. The order change in if-else-if-else chain does not change logic. I propose to revert it.
| { | ||
| //do not emit signals: all calls will be synchronous and blocking | ||
| gst_app_sink_set_emit_signals (GST_APP_SINK(sink.get()), FALSE); | ||
| caps.attach(gst_caps_from_string("video/x-raw, format=(string){BGR, GRAY8}; video/x-bayer,format=(string){rggb,bggr,grbg,gbrg}; image/jpeg")); |
Contributor
There was a problem hiding this comment.
It breaks grayscale streams. I propose to try:
caps.attach(gst_caps_from_string("video/x-raw, format=(string){BGR, BGRx, GRAY8}; video/x-bayer,format=(string){rggb,bggr,grbg,gbrg}; image/jpeg"));
Author
There was a problem hiding this comment.
Actually I tried that first, but with these caps it will always connect GRAY8. Which is why I changed the order above to GRAY8 behind BGRx ;-)
I will try again next week, I will give an update on the results....
Contributor
There was a problem hiding this comment.
I submitted PR with alternative solution: #25602
Could you please try it and submit feedback there?
Author
|
Dr. Walter Benzing
CEO and Founder
[u_logo-yUm4pNJZfF.png]
irisnet GmbH part of the net-digital group
Office: Niederkasseler Lohweg 175
DE-40547 Düsseldorf
Phone: + 49 (0) 211 545 621 07 | Fax: + 49 (0) 211 545 621 99 | Mobile:
Company HQ: Niederkasseler Lohweg 175, DE-40547 Düsseldorf
Email: ***@***.*** | Website: www.irisnet.de
Registergericht:
Amtsgericht Düsseldorf, HRB 89161
Geschäftsführer:
Dr. Walter Benzing
Thank you for your feedback, the problem I solve with this is that I need the BGR format in my App. The standard caps used by opencv are {BGR, GRAY8} on the Jetson BGR (and all 3 byte formats) are not working, so GRAY8 is chosen. On the Jetson you need 4 byte formats like BGRx. The problem I tried to solve is that GRAY8 was in your code before BGRx , so it always connected GRAY8 first, instead I want it to choose BGRx first, and actually I don’t care about GRAY8.
So I need this change for my caps to work and if from your point of view it does not change your logic then I strongly suggest to keep my changes. By the way your standard pipelines are also not working on the Jetson ;-).
Regards ***@***.***
[16054.png]
HINWEIS: Diese Nachricht (inklusive aller Anhänge) ist vertraulich. Sie darf ausschließlich durch den vorgesehenen Empfänger und Adressaten gelesen, kopiert oder genutzt werden. Sollten Sie diese Nachricht versehentlich erhalten haben, bitten wir, den Absender (durch Antwort-E-Mail) hiervon unverzüglich zu informieren und die Nachricht zu löschen. Jede unerlaubte Nutzung oder Weitergabe des Inhalts dieser Nachricht, sei es vollständig oder teilweise, ist unzulässig. Bitte beachten Sie, dass E-Mail-Nachrichten an den Absender nicht für fristgebundene Mitteilungen geeignet sind. Fristgebundene Mitteilungen sind daher ausschließlich per Post oder per Telefax zu übersenden.
NOTICE: This message (including any attachments) is confidential and may be privileged. It may be read, copied and used only by the intended recipient. If you have received it in error please contact the sender (by return E-Mail) immediately and delete this message. Any unauthorised use or dissemination of this message in whole or in part is strictly prohibited. Please note that, for organisational reasons, the personal E-Mail address of the sender is not available for matters subject to a deadline. Please send, therefore, matters subject to deadline exclusively by mail or by fax.
Am 07.05.2024 um 17:51 schrieb Alexander Smorkalov ***@***.***>:
@asmorkalov requested changes on this pull request.
________________________________
In modules/videoio/src/cap_gstreamer.cpp<#25557 (comment)>:
- else if (format == "GRAY8")
- {
- CV_CheckEQ((int)n_planes, 1, "");
- size_t step = GST_VIDEO_FRAME_PLANE_STRIDE(&frame, 0);
- CV_CheckGE(step, (size_t)frame_width, "");
- Mat src(sz, CV_8UC1, GST_VIDEO_FRAME_PLANE_DATA(&frame, 0), step);
- src.copyTo(dst);
- return true;
- }
- else if (format == "GRAY16_LE" || format == "GRAY16_BE")
- {
- CV_CheckEQ((int)n_planes, 1, "");
- size_t step = GST_VIDEO_FRAME_PLANE_STRIDE(&frame, 0);
- CV_CheckGE(step, (size_t)frame_width, "");
- Mat src(sz, CV_16UC1, GST_VIDEO_FRAME_PLANE_DATA(&frame, 0), step);
- src.copyTo(dst);
- return true;
- }
format is std::string. The order change in if-else-if-else chain does not change logic. I propose to revert it.
________________________________
In modules/videoio/src/cap_gstreamer.cpp<#25557 (comment)>:
@@ -1618,7 +1618,7 @@ bool GStreamerCapture::open(const String &filename_, const cv::VideoCaptureParam
{
//do not emit signals: all calls will be synchronous and blocking
gst_app_sink_set_emit_signals (GST_APP_SINK(sink.get()), FALSE);
- caps.attach(gst_caps_from_string("video/x-raw, format=(string){BGR, GRAY8}; video/x-bayer,format=(string){rggb,bggr,grbg,gbrg}; image/jpeg"));
It breaks grayscale streams. I propose to try:
caps.attach(gst_caps_from_string("video/x-raw, format=(string){BGR, BGRx, GRAY8}; video/x-bayer,format=(string){rggb,bggr,grbg,gbrg}; image/jpeg"));
—
Reply to this email directly, view it on GitHub<#25557 (review)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AB4YPEEW5V7N3UIGLD5CVNTZBD2AHAVCNFSM6AAAAABHLE2BKSVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDANBTGU3TMMZXGA>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Readiness Checklist
Change is necessary for opencv 4.9.x to work on the Jetson Orin devices with streams
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.