当前位置:网站首页>What is the saturate operation in opencv
What is the saturate operation in opencv
2022-06-13 04:54:00 【Haohong image algorithm】
OpenCV Medium saturate operation ( Saturation operation ) What the hell is going on ?
Just try with two practical examples .
We use it CV_8U Type to try ,CV_8U For the range of 0~255
First example :
//OpenCV edition :3.0.0
//VS edition :2013
// Blogger WeChat /QQ 2487872782
// If you have any questions, you can contact the blogger
// If you need image processing development, please also contact the blogger
// Image processing technology exchange QQ Group 271891601
#include <opencv2/opencv.hpp>
#include <iostream>
using namespace std;
int main()
{
cv::Mat A1(2, 3, CV_8UC1, cv::Scalar(254));
cout << "A1 The data in is :\n" << A1 << endl << endl;
cv::Mat B1(2, 3, CV_8UC1, cv::Scalar(2));
cout << "B1 The data in is :\n" << B1 << endl << endl;
cv::Mat C1;
cv::add(A1, B1, C1);
cout << "C1 The data in is :\n" << C1 << endl << endl;
return(0);
}
The operation results are as follows :
According to the truth , The result should be 256, But because the type of output matrix is also CV_8U, and CV_8U For the range of 0~255, So the value is set to 255.
Second example :
//OpenCV edition :3.0.0
//VS edition :2013
#include <opencv2/opencv.hpp>
#include <iostream>
using namespace std;
int main()
{
cv::Mat A1(2, 3, CV_8UC1, cv::Scalar(254));
cout << "A1 The data in is :\n" << A1 << endl << endl;
cv::Mat B1(2, 3, CV_8UC1, cv::Scalar(2));
cout << "B1 The data in is :\n" << B1 << endl << endl;
cv::Mat C1;
cv::subtract(B1, A1, C1);
cout << "C1 The data in is :\n" << C1 << endl << endl;
return(0);
}
The operation results are as follows :
According to the truth , The result should be -252, But because the type of output matrix is also CV_8U, and CV_8U For the range of 0~255, So the value is set to 0.
Through these two examples , You should understand OpenCV Medium saturate operation ( Saturation operation ) What the hell is going on .
边栏推荐
- Section 6 - pointers
- PowerShell: because running scripts is prohibited on this system, the solution
- 约瑟夫问题
- [leetcode]- binary search
- The differences between the four startup modes of activity and the applicable scenarios and the setting methods of the two startup modes
- Leetcode game 297 (20220612)
- Little C's Notepad
- Promise processing JS multithreads get the same processing result after all the results are obtained
- RuoYi-Cloud启动教程(手把手图文)
- 利用Javeswingjdbc基于mvc设计系统
猜你喜欢
Sampo Lock
C#获取WebService接口的所有可调用方法[WebMethod]
How to use redis
Internet people a few years ago vs Internet people today
Embedded hardware - read schematic
Cesium:CesiumLab制作影像切片与切片加载
前几年的互联网人vs现在的互联网人
The games that you've tasted
SQL notes
Embedded hardware: electronic components (1) resistance capacitance inductance
随机推荐
CMB written test graphical reasoning
利用Javeswingjdbc基於mvc設計系統
Promise processing JS multithreads get the same processing result after all the results are obtained
[untitled]
PowerShell:因为在此系统上禁止运行脚本,解决方法
Solution to sudden font change in word document editing
Kaggle time series tutorial
Internet people a few years ago vs Internet people today
Blockly learning ----2 Code generation, grid, scaling, events, storage
Explain the role of key attribute in V-for
LeetCode第297场周赛(20220612)
Spread your wings and soar
正态分布(高斯分布)
前几年的互联网人vs现在的互联网人
Logical point
Cesium:cesiumlab makes image slices and loads slices
Vercel 使用 HTTP 缓存
Go scheduled task cron package usage
QT realizes message sending and file transmission between client and server
Opencv image storage and reading