Depth calculation of stereo images
I want to execute program of depth calculation of stereo images.I need to know which version of openCV and Microsoft visual studio supports "Mat" function because all the programs available are mostly written using "Mat",please help soon.
cv::Mat depthImage;
depthImage = cv::imread("coffee_mug_1_1_1_depthcrop.png", CV_LOAD_IMAGE_ANYDEPTH | CV_LOAD_IMAGE_ANYCOLOR ); // Read the file
depthImage.convertTo(depthImage, CV_32F); // convert the image data to float type
namedWindow("window");
float max = 0;
for(int i = 0; i < depthImage.rows; i++){
for(int j = 0; j < depthImage.cols; j++){
if(depthImage.at<float>(i,j) > max){
max = depthImage.at<float>(i,j);
}
}
}
cout << max << endl;
float divisor = max / 255.0;
cout << divisor << endl;
for(int i = 0; i < depthImage.rows; i++){
for(int j = 0; j < depthImage.cols; j++){
cout << depthImage.at<float>(i,j) << ", ";
max = depthImage.at<float>(i,j) /= divisor;
cout << depthImage.at<float>(i,j) << endl;
}
}
imshow("window", depthImage);
waitKey(0);
Can you explain your problem?
btw, please never call anything
max
, since there are already various functions / macros with that name aroundit seems to be impossible to change the title ?
Mat
is not a function but a class. In fact, it is the class, the basic structure to deal with images in OpenCV (from version 2 on). So yep, if you find an OpenCV program that doesn't use Mat in it, throw it away and don't even bother to read it.@berak changed. Although not sure if that is the real problem...