opencv / opencv

Open Source Computer Vision Library
https://opencv.org
Apache License 2.0
76.67k stars 55.65k forks source link

changed order of cap in order to work with jetson orin #25557

Closed Liedermaus closed 1 month ago

Liedermaus commented 1 month ago

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

Liedermaus commented 1 month ago

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.cpphttps://github.com/opencv/opencv/pull/25557#discussion_r1592712955:

  • 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.cpphttps://github.com/opencv/opencv/pull/25557#discussion_r1592715602:

@@ -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 GitHubhttps://github.com/opencv/opencv/pull/25557#pullrequestreview-2043576370, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AB4YPEEW5V7N3UIGLD5CVNTZBD2AHAVCNFSM6AAAAABHLE2BKSVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDANBTGU3TMMZXGA. You are receiving this because you authored the thread.Message ID: @.***>