Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

how to prove subtract value opencv

I need to prove pixle subtract value is right , I'm using this code :

subtract(image1,image2, min); //subtract image1 - image2

cout << endl << endl << "image 1 pixel : " << endl << endl;

for (int y = 0; y < 10; y++)//To loop through all the pixels 10x10
{
    for (int x = 0; x < 10; x++) //4 55
    {
            pix_val = image1.at<uchar>(x, y);
            cout << pix_val << " , ";
    }
    cout << endl;

}

cout << endl << endl << "image 2 pixel : " << endl << endl;

for (int x = 0; x < 10; x++)//To loop through all the pixels 10x10
{
    for (int y = 0; y < 10; y++)
    {
        pix_val = image2.at<uchar>(x, y);
        cout << pix_val << " , ";
    }
    cout << endl;

}


cout <<endl<<endl<< "min pixel : " << endl<<endl;

for (int x = 0; x < 10; x++)//To loop through all the pixels 10x10
{
    for (int y = 0; y < 10; y++)
    {
        pix_val = min.at<uchar>(x, y);
        cout << pix_val <<" , ";
    }
    cout << endl;

}

but the result is different

image description

but not all value match.

Please help me, i need to prove subtract value with number.

Thank you.