New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
changed order of cap in order to work with jetson orin #25557
Conversation
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; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
format
is std::string
. The order change in if-else-if-else chain does not change logic. I propose to revert it.
@@ -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")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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"));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I submitted PR with alternative solution: #25602
Could you please try it and submit feedback there?
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: ***@***.***>
|
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.