Skip to content

20250616-udp mpeg_ts와 imshow-심승빈 #6

@bert13069598

Description

@bert13069598

udp mpeg_ts와 imshow

1. 연구 일자

2025-06-16

2. 연구 참여자

  • 심승빈

3. 연구 목표

  • cv2.videocapture 대신 socket과 av로 udp 커스텀 구현

4. 연구 내용 및 수행 과정

  • 라즈베리 rpicam-apps로 카메라 스트리밍을 udp 송신 후 컴퓨터나 보드로 수신

5. 결과 및 분석

  • imshow 직전 showing가지 출력 후 블락됨
  • av와 cv2 display 모듈이 서로 호환되지 않는 것으로 판단

6. 향후 연구 계획

  • cv2.imshow를 하는 동안은 cv2.videocapture를 사용하고 이후 출력 형식이 변경되었을때 커스텀 네트워크를 구현하여 예외처리 진행

7. 첨부 파일/자료 링크

import queue
import threading

import av
import cv2


def show_loop(q):
    while True:
        img = q.get()
        print("showing")
        cv2.imshow("win", img)
        cv2.waitKey(1)
        print("done")

def decode_loop(q):
    container = av.open('udp://@:5000', format='mpegts')
    for packet in container.demux():
        for frame in packet.decode():
            img = frame.to_ndarray(format='bgr24')
            q.put(img)

q=queue.Queue()
t0=threading.Thread(target=decode_loop,args=(q,),daemon=True)
t1=threading.Thread(target=show_loop,args=(q,),daemon=True)
t0.start()
t1.start()

t1.join()
t0.join()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions