i'm new to opencv and i'm trying to run some codes..i need to get a v-disparity map from a disparity map.i 'm using a two rectified image to get stereo matching and after that the dense disparity map.i got the disparity map and when i tryed to tronsform it on v-disparity i got nothing an empty window appeared.i'm refering to the algorithm proposed by :
Raphael Labayrade, Didier Aubert, Jean-Philippe Tarel in their article Real Time Obstacle Detection in Stereovision on
Non Flat Road Geometry Through ”V-disparity”
Representation.
hear is my code :
int main(int argc, char *argv[]){
int nbrepetion ;
Mat img = imread(argv[1],0);
Mat image(img.rows,img.cols, CV_8UC1);
if(img.empty()){
printf("Could not load image file\n");
exit(0);
}
int height = img.rows;
int width = img.cols;
int a = width ;
int k = 0 ;
uchar pos =0 ;
for(int i = 0; i < height; i++){
for(int j = 0; j < width; j++)
for (int k = 0; k < a; k++){
if(img.at<uchar>(i,j) == img.at<uchar>(i,k)) {
nbrepetion ++ ;
}
}
if(nbrepetion == 1){
image.at<uchar>(i,k) = img.at<uchar>(i,k);
} else {
pos = img.at<uchar>(i,k);
image.at<uchar>(pos,k) = nbrepetion;
}
nbrepetion = 0 ;
}
namedWindow("disparityimage", CV_WINDOW_AUTOSIZE);
imshow("disparityimage", image );
waitKey(0);
return 0;
}