Estudiante
Xuan Mo
iPAL Group Meeting
February 11, 2011
Outline
Reading video Writing video Edge Detection Demo: Laplacian edge detection
2/11/2011
iPALGroup Meeting
2
Capturing a frame from a video sequence
Initializing capture from a camera: CvCapture ∗ capture = cvCaptureF romCAM (0); capture from video device 0 Initializing capture from afile: CvCapture ∗ capture = cvCaptureF romAV I(”inf ile.avi”); Capturing a frame: cvGrabF rame(capture); retrieve the captured frame: img = cvRetrieveF rame(capture); Releasing the capture source:cvReleaseCapture(&capture); Don’t forget to release!
2/11/2011
iPAL Group Meeting
3
Get capture device properties
Get capture device properties: cvQueryF rame(capture); this call isnecessary to get correct capture properties cvGetCaptureP roperty(capture, property id, value); property id: CV CAP P ROP F RAM E HEIGHT CV CAP P ROP F RAM E W IDT H CV CAP P ROP F P S CV CAP P ROP F RAM ECOU N T Frame count does not seem to be working properly.
2/11/2011
iPAL Group Meeting
4
Get frame information
Function is the same: cvGetCaptureP roperty(capture, property id,value); property id: CV CAP P ROP P OS M SEC CV CAP P ROP P OS F RAM ES CV CAP P ROP P OS AV I RAT IO(0 − 1) and so on...
Example: f loat posRatio = cvGetCaptureP roperty(capture, CV CAP P ROP P OS AV IRAT IO)
2/11/2011
iPAL Group Meeting
5
Set frame information
Set capture device properties: cvSetCaptureP roperty(capture, property id, value); sets the specified property of camera orAVI. property id: The same as getting frame information Example: cvSetCaptureP roperty (capture, CV CAP P ROP P OS AV I RAT IO, 0.9); start capturing from a relative position of 0.9 of a video file2/11/2011
iPAL Group Meeting
6
Write/save video
First initializing a video writer: CvV ideoW ritercvCreateV ideoW riter (f ilename, f ourcc, f ps, f rame size, is color = 1) fourcc:...
Regístrate para leer el documento completo.