Ask Your Question
0

How to display Raw frame from webcam?

asked 2018-11-02 05:04:27 -0600

vivpatel99 gravatar image

updated 2018-11-02 09:24:19 -0600

berak gravatar image

I am using OpenCV 3.4.2 and my camera is QQSJ-8808 in a part of my project, I have to display various result of processes frame. but I can not find the way to display raw frame (direct from camera without any image processing). when I used cv2.imshow(), it shows me the colored frame.

but first, I want to show the raw frame and then I want to show grayscale and then colored.

Please help to solve the issue.

mycode :

  # Start default camera
video = cv2.VideoCapture(0)

while video.isOpened():
    ret, frame = video.read()
    # frame = cv2.cvtColor(frame, cv2.COLOR_BGR2YUYV)
    cv2.imshow("frame", frame)

    key = cv2.waitKey(1) & 0xFF
    # if the `q` key was pressed, break from the loop
    if key == ord("q"):
        break
# Release video
video.release()
cv2.destroyAllWindows()
edit retag flag offensive close merge delete

Comments

how do you get images from that, exactly ? (please show the code, you're using !)

can you show us an output image ?

can you look up the datasheet of your cam ? what does RAW mean, exactly, here ? (it can be anything !)

berak gravatar imageberak ( 2018-11-02 05:14:32 -0600 )edit
1

I already have updated my question with my code, my camera supports the following formats, MJPEG, YUY2.
sorry, I thought YUY2 is a raw image. how can I enable my cam to capture YUY2 formate?

vivpatel99 gravatar imagevivpatel99 ( 2018-11-02 07:00:42 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2018-11-02 07:16:45 -0600

berak gravatar image

updated 2018-11-02 09:23:38 -0600

IF you're using the v4l backend, try:

cap.set(cv2.CAP_PROP_MODE, cv2.CAP_MODE_YUYV)

(it probably only works there)

IF that works, the grayscale image from the YUV is just frame[:,:,0]

edit flag offensive delete link more

Comments

1

thank you for your replay, but, it is throwing error VIDEOIO ERROR: V4L2: setting property #9 is not supported

vivpatel99 gravatar imagevivpatel99 ( 2018-11-02 09:18:14 -0600 )edit

oh, V4L2 vs. V4L ;(

(and i have no idea, which is used when or where, sorry)

berak gravatar imageberak ( 2018-11-02 09:22:55 -0600 )edit

no problem, thanks for the help, but I do not know how, but I run v4l2-ctl --list-formats-ext in ubuntu16_4, it is showing me only one supported formate (MJPEG), but when I run the same command on Debian Jessie ( zybo-7000), it is showing "MJPEG and YUYV" both formats.

vivpatel99 gravatar imagevivpatel99 ( 2018-11-02 09:47:23 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2018-11-02 05:04:27 -0600

Seen: 6,233 times

Last updated: Nov 02 '18