In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
The editor today takes you to understand how to carry out image pixel value statistics in C++ OpenCV. The knowledge points in the article are introduced in great detail. Friends who think it is helpful can browse the content of the article with the editor, hoping to help more friends who want to solve this problem to find the answer to the problem. Now follow the editor to learn in depth the knowledge of "how to carry out image pixel value statistics in C++ OpenCV".
Preface
Opencv knowledge points:
Image Pixel Min / Max-minMaxLoc
Image pixel mean / standard deviation-meanStdDev
1. Commonly used pixel value statistics
In image analysis, we often need to count the pixels of a single-channel image. The following four are commonly used.
Minimum (min)
Maximum (max)
Average (mean)
Standard deviation (standard deviation)
To require these four kinds of statistics, we need to use the following two API
MinMaxLoc
MeanStdDev
These two API are very useful and will be used in many places in the future.
two。 Statistical calculation of pixel value
Next, let's apply two API to get four pixel value statistics.
The first is the minimum value and the maximum value.
/ / function definition void pixel_statistics_demo (Mat& image); / / function implementation void QuickDemo::pixel_statistics_demo (Mat& image) {double minv, maxv; Point minLoc, maxLoc; std::vector mvt; split (image, mvt) / * minMaxLoc calculates the minimum pixel value of a single-channel image The maximum value is a total of 6 parameters, the first parameter input single channel image, the second parameter output minimum value, the third parameter output maximum value, the fourth parameter output minimum point coordinates, the fifth parameter output maximum point coordinates The sixth parameter inputs a subarray of the image (sometimes we find the minimum / maximum value of the ROI region The mask image will be passed in) (the subarray here is an image mask that can add things / buttons) * / for (int I = 0) I < mvt.size ()) {minMaxLoc (mvt [I], & minv, & maxv, & minLoc, & maxLoc); std::cout
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.