Ask Your Question

Revision history [back]

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);

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;

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);

waitKey(0);
click to hide/show revision 3
retagged

updated 2015-12-17 01:56:01 -0600

berak gravatar image

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);
click to hide/show revision 4
No.4 Revision

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);