Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

average value to int

Mat src_size;
src_size = imread("unit.jpg", 1);
cv::Scalar avg;
avg = cv::mean(src_size);

Mat dst_size(Size(256, 256), CV_64F);


for (int i = 0; i < 256; i++) {
    for (int j = 0; j < 256; j++) {
        **dst_size.at<int>(i, j) = avg;**
    }
}
imshow("Hi", dst_size);

How can i convert Scalar to int??

average value to int

Mat src_size;
src_size = imread("unit.jpg", 1);
cv::Scalar avg;
avg = cv::mean(src_size);

Mat dst_size(Size(256, 256), CV_64F);


for (int i = 0; i < 256; i++) {
    for (int j = 0; j < 256; j++) {
        **dst_size.at<int>(i, dst_size.at<int>(i, j) = avg;**
avg;
    }
}
imshow("Hi", dst_size);

How can i convert Scalar to int??