Ask Your Question
0

zero center normalization image

asked 2019-01-03 00:09:34 -0600

XTSR gravatar image

Hello, I need to normalize an image using zero center normalization. How to do it in OpenCV?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2019-01-03 00:21:14 -0600

berak gravatar image

updated 2019-01-03 00:33:18 -0600

for a float image:

img.convertTo(img, CV_32F);

you get the mean and stdev:

Scalar m,d;
meanStdDev(img, m, d);

then you subtract the mean, and divide by stdev:

img -= m;
img /= d; // but be careful, don't divide by zero here !
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2019-01-03 00:09:34 -0600

Seen: 1,242 times

Last updated: Jan 03 '19