当前位置:网站首页>Program for counting black and white pixel values in pictures
Program for counting black and white pixel values in pictures
2022-06-21 14:31:00 【Modest learning and progress】
Count the number of white pixels in the binary image
// Count the number of white pixels in the binary image
// Input binary image , Returns the number of white pixels
int bSums(Mat src)
{
int counter = 0;
// Iterator access pixels
Mat_<uchar>::iterator it = src.begin<uchar>();
Mat_<uchar>::iterator itend = src.end<uchar>();
for (; it != itend; ++it)
{
if ((*it)>0) counter += 1;// After binarization , The pixels are 0 perhaps 255
}
return counter;
}
Count the number of black pixels in the binary image
// Count the number of white pixels in the binary image
// Input binary image , Returns the number of white pixels
int bSums(Mat src)
{
int counter = 0;
// Iterator access pixels
Mat_<uchar>::iterator it = src.begin<uchar>();
Mat_<uchar>::iterator itend = src.end<uchar>();
for (; it != itend; ++it)
{
if ((*it)==0) counter += 1;// After binarization , The pixels are 0 perhaps 255
}
return counter;
}
original text :https://blog.csdn.net/mao_hui_fei/article/details/80984173
边栏推荐
- What are the log files in MySQL?
- Mr. Ali taught you how to use JMeter for pressure test (detailed drawing)
- Analysis of ROC and AUC
- Explain the design idea and capacity expansion mechanism of ThreadLocal in detail
- Record the processing process of slow response of primary system
- T32 add toolbar button
- The whole process of Netease cloud music API installation and deployment [details of local running projects and remote deployment]
- Never change
- Gensim error attributeerror: type object 'word2vec' has no attribute 'load_ word2vec_ format‘
- Oracle client11 and pl/sql12 installation
猜你喜欢

Configuring MySQL master-slave and implementing semi synchronous replication in docker environment

Read distributed consistency protocols 2pc and 3pc
![NPM package management configuration file [package.json and node\u modules configuration details and how to develop their own packages and publish them on NPM]](/img/ff/2b92de728494542f614d4d5a57d20c.jpg)
NPM package management configuration file [package.json and node\u modules configuration details and how to develop their own packages and publish them on NPM]
![Flex layout --- detailed explanation [Blue Bridge Cup classic dice layout]](/img/9b/bb030e7b4be833051d6bc3974e4184.jpg)
Flex layout --- detailed explanation [Blue Bridge Cup classic dice layout]

Understand the use of protobuf serialization protocol

Declare war on uncivilized code II

kernel GDB
![Cool background shadow effect [second with layered feeling] [picture hover style]](/img/ca/d68f2cf9f9af7b9346032b2a6e120b.jpg)
Cool background shadow effect [second with layered feeling] [picture hover style]

Analysis of ROC and AUC

Design and implementation of object system in redis
随机推荐
Format printout
English accumulation__ annoyance
Using the path module to prompt errors in ts+vite projects
How to write a rotation chart
Declare war on uncivilized code II
流量加密之C2隐藏
Some atom operations
Summary of common libraries in machine learning
Judge password strength - Optimization
C2 hiding of traffic encryption
T32 add toolbar button
C#&. Net to implement a distributed event bus from 0 (1)
Postman testing websocket interface
Application GDB debugging
kernel GDB
Qt-3-basic assembly 2
Read distributed consistency protocols 2pc and 3pc
使用api制作我的足迹地图
Sliding validation tool class
Oracle client11 and pl/sql12 installation