caij
Posts: 13
Joined: Tue May 28, 2019 6:37 am

Problem with video capture

Tue May 28, 2019 8:34 am

when I capture the video then I always get the video like that one? anyone knows what's the problem with camera? the light works 200hz
Camera.jpeg
Camera.jpeg (40.34 KiB) Viewed 966 times

User avatar
HermannSW
Posts: 1502
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: Problem with video capture

Tue May 28, 2019 12:27 pm

Raspberry camera?
If so, v1 or v2?
What is the command [line] you use to capture the video?
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://gitlab.freedesktop.org/HermannSW/gst-template
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

caij
Posts: 13
Joined: Tue May 28, 2019 6:37 am

Re: Problem with video capture

Tue May 28, 2019 1:19 pm

Hi HermannSW,
it's V2. the python code is

Code: Select all

# -*- coding:utf-8-*-
import numpy
import cv2

cap=cv2.VideoCapture(0)

fourcc=cv2.cv.FOURCC(*'XVID')
out=cv2.VideoWriter('/home/pi/Documents/output.avi',fourcc,90,(640,480))

while(cap.isOpened()):
    ret,frame=cap.read()
    if ret==True:
        frame=cv2.flip(frame,0)
        
        out.write(frame)
        
        cv2.imshow('frame',frame)
        if cv2.waitKey(1) & 0xFF == ord('q'):
            break
    else:
        break
cap.release()
out.release()
cv2.destroyAllWindows() 
then use command:

Code: Select all

$ sudo modprobe bem2835-v4l2
$ python2 VideoCapture.py

_______________________________________________________________
today I try just to capture a photo with decreased exposure time:

Code: Select all

$ raspistill  -w 640 -h480 -ISO 100 -ss 1-out2.jpeg
the photo is still with this black streak.
out2.jpeg
out2.jpeg (112.65 KiB) Viewed 926 times

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7305
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Problem with video capture

Tue May 28, 2019 2:05 pm

That looks like corruption from the sensor.

Please run

Code: Select all

raspistill  -w 640 -h480 -ISO 100 -ss 1-out2.jpeg -r
and post the resulting file to somewhere like Dropbox and Google to share it. The file will be 8-11MB as it includes the raw data off the sensor. That enables us to analyse whether it is the sensor or the Pi at fault.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

caij
Posts: 13
Joined: Tue May 28, 2019 6:37 am

Re: Problem with video capture

Tue May 28, 2019 2:33 pm

so I have done this command

Code: Select all

raspistill  -w 640 -h480 -ISO 100 -ss 1-out2.jpeg -r
the result can be downloaded under this link
https://drive.google.com/file/d/1dbCI0F ... sp=sharing

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7305
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Problem with video capture

Tue May 28, 2019 3:44 pm

So the corruption is on the data coming off the sensor. I'd put that down to either a faulty sensor, or interference on the CSI2 bus (the ribbon cable).

I do note that this is an OV5647 5MPix sensor. Raspberry Pi haven't sold that sensor since 2016, so I suspect that it is from some other supplier. Sorry, but you really need to raising this with them.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

caij
Posts: 13
Joined: Tue May 28, 2019 6:37 am

Re: Problem with video capture

Wed May 29, 2019 6:35 am

The problem has been solved. It is not software even hardware problem. What we see on the photo is so called flicker. Cause the light works at 200Hz, is so strong that the exposure time will be set under 5ms based on the automatic focus, then the flicker happened. The solution under this situation is setting the exposure time longer than 5ms, at the same time putting filter on camera to avoid overexposure.

Return to “Camera board”