/*AUTHOR: Ravi Prakash University of Southern California, Los Angeles */ #include #include #include int param1, param2, param3, param4, param5, maxDisp; IplImage *leftIm, *rightIm, *disparityIm; char *imWin="Disparity of Stereo Images"; void showDisp1(int i) { cvFindStereoCorrespondence( leftIm, rightIm, CV_DISPARITY_BIRCHFIELD, disparityIm, maxDisp, param1, param2, param3, param4 , param5 ); cvShowImage(imWin, disparityIm); cvSaveImage("Output.jpg", disparityIm); } void showDisp(int i) { } int main() { int temp; leftIm = cvLoadImage("mview1.png", CV_LOAD_IMAGE_GRAYSCALE); rightIm = cvLoadImage("mview5.png", CV_LOAD_IMAGE_GRAYSCALE); disparityIm= cvCreateImage( cvGetSize(leftIm), IPL_DEPTH_8U, 1); cvNamedWindow(imWin); maxDisp=50; param1=25; param2=5; param3=12; param4=15; param5=25; cvCreateTrackbar("Max Disparity", imWin, &maxDisp, 300, showDisp); cvCreateTrackbar("Occ penalty", imWin, ¶m1, 100, showDisp); cvCreateTrackbar("Match reward", imWin, ¶m2, 100, showDisp); cvCreateTrackbar("High rel reg", imWin, ¶m3, 100, showDisp); cvCreateTrackbar("Mod rel reg", imWin, ¶m4, 100, showDisp); cvCreateTrackbar("Low rel reg", imWin, ¶m5, 100, showDisp); cvCreateTrackbar("Trigger", imWin, &temp, 100, showDisp1); showDisp(0); cvWaitKey(0); cvDestroyWindow(imWin); cvReleaseImage(&leftIm); cvReleaseImage(&rightIm); cvReleaseImage(&disparityIm); }