Ask Your Question
0

How do I get the lowest value of all the non zero value pixels?

asked 2017-02-24 04:46:32 -0500

Ankan gravatar image

How do I get the lowest value of all the non zero value pixels?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
1

answered 2017-02-24 05:27:38 -0500

LBerger gravatar image

You can use mask :

    Mat im = imread("f:/lib/opencv/samples/data/lena.jpg", IMREAD_GRAYSCALE);
    Mat mask = im>0;
    double minc[1], maxc[1];

    minMaxLoc(im, minc, maxc,NULL,NULL,mask);
    cout<<minc[0];
edit flag offensive delete link more

Comments

Thanks! I had to use threshhold to create that mask as I'am using Python but it works great,

Ankan gravatar imageAnkan ( 2017-02-24 07:21:23 -0500 )edit
0

answered 2017-02-25 06:45:59 -0500

I think,mast is not a must.

int main( int argc, char** argv )
{

Mat im = imread("e:/template/lena.jpg", IMREAD_GRAYSCALE);
double minc[1], maxc[1];
minMaxLoc(im, minc, maxc,NULL,NULL);
cout<<minc[0];
return 0;
}

it works.

edit flag offensive delete link more

Comments

I think you should read the question : "all the non zero value pixels" : Mat mask = im>0;

LBerger gravatar imageLBerger ( 2017-02-25 07:09:22 -0500 )edit
1

OK,you are right.I miss this point.

jsxyhelu gravatar imagejsxyhelu ( 2017-02-25 07:36:17 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2017-02-24 04:46:32 -0500

Seen: 1,100 times

Last updated: Feb 25 '17