Ask Your Question

viveksb007's profile - activity

2015-09-13 01:26:49 -0600 asked a question compare Mat element-wise

i want to compare element by element of 2 Mat s1,s2 and put smaller value in 3rd Mat salient. i have put Code below Build Succesfull but then still there is error

Mat downs,ups,s1,s2,m,salient;
s1 = ups / downs;
s2 = downs / ups;

    for (int i = 0; i < ups.cols; i++)
    {
        for (int j = 0; j < ups.rows; j++)
        {

            if (s1.at<uchar>(i, j) > s2.at<uchar>(i, j))
            {
                m.at<uchar>(i, j) = s2.at<uchar>(i, j);
            }
            else
            {
                m.at<uchar>(i, j) = s1.at<uchar>(i, j);
            }

            salient.at<uchar>(i, j) = 1 - m.at<uchar>(i, j);
        }
    }