70

What does the cv::normalize(_src, dst, 0, 255, NORM_MINMAX, CV_8UC1); do in OpenCV?

I went through the documentation and was unable to understand what alpha, beta, NORM_MINMAX and CV_8UC1 actually do. I am aware alpha sets the lower and beta the higher bound. CV_8UC1 stands for an 8-bit unsigned single channel. But what exactly these arguments do to the picture is what I am unable to comprehend.

1

2 Answers 2

75

When the normType is NORM_MINMAX, cv::normalize normalizes _src in such a way that the min value of dst is alpha and max value of dst is beta. cv::normalize does its magic using only scales and shifts (i.e. adding constants and multiplying by constants).

CV_8UC1 says how many channels dst has.

The documentation here is pretty clear: http://docs.opencv.org/modules/core/doc/operations_on_arrays.html#normalize

11
  • What do alpha and beta mean in the image. As far as I know alpha stood for minimum range and beta for max.So if I am converting to grayscale shouldnt alpha be 0 and beta be 1 if I am using a single channel? Aug 19, 2012 at 3:51
  • alpha and beta are the highest and lowest value in the dst image, respectively.
    – carlosdc
    Aug 19, 2012 at 3:53
  • 1
    So when I am using a single channel it should ideally be 0 to 1 right? Or am I mistaken here? Aug 19, 2012 at 3:56
  • 4
    0 to 255 are the physical limits of your array: you can't store anything above 255 or below 0. What values to use it depends on what limits you need: if you use 5 and 20 there won't be anything below 5 or above 20.
    – carlosdc
    Aug 19, 2012 at 4:03
  • 4
    No... single channel use one channel but the signal is between 0 and 255.
    – carlosdc
    Aug 19, 2012 at 4:42
0

There are several types of normalization in Opencv.

Try running samples in the Online OpenCV-Flow tool to better understand each type.

Normalize Sample

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.