当前位置:网站首页>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
边栏推荐
- Chapter 6 - application layer
- LINQ extension methods - any() vs. where() vs. exists() - LINQ extension methods - any() vs. where() vs. exists()
- DP question brushing record
- Qt-2-signal and slot
- Flex layout --- detailed explanation [Blue Bridge Cup classic dice layout]
- Sliding validation tool class
- Viewing tcp/ip network communication from the sending of an email
- How does JMeter implement interface association?
- 2021-2022 recall of the final exam questions of non relational database of Shandong University
- Three versions realize black-and-white theme switching
猜你喜欢

Usage of SED (replacement, deletion of text content, etc.)

Tcp/ip FAQs

Summary of web development technology knowledge

Imitation B station web, app, background

Redis cluster deployment manual that Xiaobai can understand

Using the path module to prompt errors in ts+vite projects

Postman testing websocket interface

Installation of oracle19c under alicloud lightweight application server linux-centos7

Getting started with qt-1-ui
![[font multi line display ellipsis] and [dialog box] implementation ----- case explanation, executable code](/img/f8/9cfaafd0c013823e801beb9d4a946a.jpg)
[font multi line display ellipsis] and [dialog box] implementation ----- case explanation, executable code
随机推荐
Reverse generate the corresponding DTD constraint according to the XML file
Summary of statistical learning methods
[test process and theory - Test Technology System]
Tcp/ip FAQs
Configuring MySQL master-slave and implementing semi synchronous replication in docker environment
"My" C code specification
Chapter 4 - network layer
CSDN is the only one: detailed tutorial teaching on how to connect multiple mobile phones by appium+pytest+allure+jenkins
Configuration of oracle19c under alicloud lightweight application server linux-centos7
Promotion guide for large enterprises: material preparation, PPT writing and on-site defense
Write a code hot deployment
技术分享 | MySQL中一个聚类增量统计 SQL 的需求
Vscade, open a folder or workspace... (file - > open folder) solution
Format printout
Use Matplotlib to draw the first figure
Gensim error attributeerror: type object 'word2vec' has no attribute 'load_ word2vec_ format‘
Installation of oracle19c under alicloud lightweight application server linux-centos7
Declare war on uncivilized code II
Record the troubleshooting process of excessive CPU usage
JS written test question: this