embeded/i.mx 8m plus2025. 8. 14. 15:07

nxp i.mx8mp 예제를 뜯어 보다가 신기한 걸 발견. 저렇게 해서 성능이 잘 나왔던건가?

            cam_pipeline = cv2.VideoCapture(
                "v4l2src device=" + cam + " ! imxvideoconvert_g2d ! "
                "video/x-raw,format=RGBA,width="
                + str(self.width)
                + ",height="
                + str(self.height)
                + " ! "
                + "videoconvert ! appsink"
            )

        status, org_img = cam_pipeline.read()

[링크 : https://gstreamer.freedesktop.org/documentation/applib/gstappsink.html?gi-language=c]

 


+

i.mx8mp 에서 해보니 비디오 받아오는게 느린게 아니라서 위의 파이프라인을 넣어도 느린건 여전하다.

+

 

cv::VideoCapture::VideoCapture ( const String &  filename, int  apiPreference)

Open video file or a capturing device or a IP video stream for video capturing with API Preference.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
filename it can be:
name of video file (eg. video.avi)
or image sequence (eg. img_%02d.jpg, which will read samples like img_00.jpg, img_01.jpg, img_02.jpg, ...)
or URL of video stream (eg. protocol://host:port/script_name?script_params|auth)
or GStreamer pipeline string in gst-launch tool format in case if GStreamer is used as backend Note that each video stream or IP camera feed has its own URL scheme. Please refer to the documentation of source stream to know the right URL.
apiPreference preferred Capture API backends to use. Can be used to enforce a specific reader implementation if multiple are available: e.g. cv::CAP_FFMPEG or cv::CAP_IMAGES or cv::CAP_DSHOW.

See also
cv::VideoCaptureAPIs

[링크 : https://docs.opencv.org/3.4/d8/dfe/classcv_1_1VideoCapture.html#a949d90b766ba42a6a93fe23a67785951]

 

camSet='v4l2src device=/dev/video0 ! video/x-raw,width=640,height=360 ! nvvidconv flip-method='+str(flip)+' \
        ! video/x-raw(memory:NVMM), format=I420, width=640, height=360 ! nvvidconv ! video/x-raw, format=BGRx ! videoconvert \
        ! video/x-raw, format=BGR enable-max-performance=1 ! appsink '
cam=cv2.VideoCapture(camSet,cv2.CAP_GSTREAMER)

[링크 : https://stackoverflow.com/questions/71816725/streaming-opencv-videocapture-frames-using-gstreamer-in-python-for-webcam]

 

CAP_GSTREAMER 
Python: cv.CAP_GSTREAMER
GStreamer.

[링크 : https://docs.opencv.org/3.4/d4/d15/group__videoio__flags__base.html#gga023786be1ee68a9105bf2e48c700294da38dcac6866f7608675dd35ba0b9c3c07]

 

appsink 예제

[링크 : https://makepluscode.tistory.com/entry/Gstreamer-Python-Appsink-구현하기] python

[링크 : https://ralpioxxcs.github.io/post/gstreamer/1_gst/] cpp

'embeded > i.mx 8m plus' 카테고리의 다른 글

openVX, verisilicon(vivante)  (0) 2025.08.14
nxp eiq 우분투 실행 실패  (0) 2025.07.31
nxp g2d_blit  (0) 2025.04.01
sounddevice on arm i.mx8 evk  (0) 2024.05.14
NXP i.mx8mp LF_v6.1.55-2.2.0 테스트  (0) 2023.12.21
Posted by 구차니