1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| #include <cv.h>
#include <iostream>
#include <cxcore.h>
#include <highgui.h>
#include <stdio.h>
int main(void)
{
IplImage *imgA,*imgB,*outFA, *outFB = 0;
outFA = cvLoadImage("OpticalFlow0.jpg",1);
imgA= cvCreateImage( cvGetSize(outFA), IPL_DEPTH_8U, 1 );
outFB = cvLoadImage("OpticalFlow1.jpg",CV_LOAD_IMAGE_UNCHANGED);
imgB= cvCreateImage( cvGetSize(outFB), IPL_DEPTH_8U, 1 );
IplImage* result = cvCreateImage( cvGetSize(imgA), IPL_DEPTH_8U, 1 );
cvSmooth( outFA, imgA, CV_GAUSSIAN, 7, 7 );
cvSmooth( outFB, imgB, CV_GAUSSIAN, 7, 7 );
cvSobel(imgA,result,1,0,3);
cvShowImage("Original",imgA);
cvShowImage("gradient X",result);
cvWaitKey();
return 0
} |
Partager