简体   繁体   中英

OpenCV: normalization is too slow or I am doing it in a wrong way?

I am trying to normalize one matrix in OpenCV, I am doing it like this:

cv::Mat matrix = cv::Mat::zeros ( 3, 480000, CV_8UC1 );
cv::Mat matrix_norm = cv::Mat::zeros ( 3, 480000, CV_8UC1 );
...  // give values to matrix

I read the documentation for "normalize" function, but couldn't fully understand how to give values for "alpha" and "beta". So from the example:

http://docs.opencv.org/doc/tutorials/features2d/trackingmotion/harris_detector/harris_detector.html

I did it like:

cv::normalize ( matrix, matrix_norm, 0, 255, NORM_MINMAX, CV_8UC1, Mat() );

But it crashed here, which I don't surprise. I think the matrix size is too big, right? Or am I doing the normalization incorrectly here?

And is there any way to speed up the normalization?

It's always useful if you normalize your matrix by writing your own code. Using Histogram for normalising your matrix values help you customise the function.It is even faster than the normal noramlisation function provided by OpenCV.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM