当前位置:网站首页>Opencv learning example code 3.2.4 LUT
Opencv learning example code 3.2.4 LUT
2022-07-02 03:52:00 【Terror blade】
#include <opencv2/objdetect.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/videoio.hpp>
#include <iostream>
#include <iomanip>
#include <opencv2/opencv.hpp>
#include <vector>
#include <opencv2/imgproc/types_c.h>
using namespace cv;
using namespace std;
int main(int argc, char** argv)
{
uchar lutFirst[256];
for(int i=0;i<256;i++)
{
if(i<=100)
{
lutFirst[i]=0;
}
if(i>100&&i<=200)
{
lutFirst[i]=100;
}
if(i>200)
{
lutFirst[i]=255;
}
}
Mat lutOne(1,256,CV_8UC1,lutFirst);
uchar lutSecond[256];
for(int i=0;i<256;i++)
{
if(i<=100)
{
lutSecond[i]=0;
}
if(i>100&&i<=150)
{
lutSecond[i]=100;
}
if(i>150&&i<=200)
{
lutSecond[i]=150;
}
if(i>200)
{
lutSecond[i]=255;
}
}
Mat lutTwo(1,256,CV_8UC1,lutSecond);
uchar lutThird[256];
for(int i=0;i<256;i++)
{
if(i<100)
{
lutThird[i]=100;
}
if(i>100&&i<=200)
{
lutThird[i]=200;
}
if(i>200)
{
lutThird[i]=255;
}
}
Mat lutThree(1,256,CV_8UC1,lutThird);
vector<Mat> mergeMats;
mergeMats.push_back(lutOne);
mergeMats.push_back(lutTwo);
mergeMats.push_back(lutThree);
Mat LutTree;
merge(mergeMats,LutTree);
Mat img=imread("lena.png");
if(img.empty())
{
cout<<"open faile"<<endl;
return -1;
}
Mat gray,out0,out1,out2;
cvtColor(img,gray,COLOR_BGR2GRAY);
LUT(gray,lutOne,out0);
LUT(img,lutOne,out1);
LUT(img,LutTree,out2);
imshow("out0",out0);
imshow("out1",out1);
imshow("out2",out2);
waitKey(0);
return 0;
}

边栏推荐
- Which is better, industrial intelligent gateway or edge computing gateway? How to choose the right one?
- Finally got byte offer. The 25-year-old inexperienced perception of software testing is written to you who are still confused
- Where can I buy cancer insurance? Which product is better?
- Kotlin basic learning 15
- MD5 of Oracle
- 蓝桥杯单片机数码管技巧
- Cloud service selection of enterprises: comparative analysis of SaaS, PAAS and IAAs
- 初识string+简单用法(二)
- Analyse de 43 cas de réseaux neuronaux MATLAB: Chapitre 42 opérations parallèles et réseaux neuronaux - - opérations parallèles de réseaux neuronaux basées sur CPU / GPU
- Oracle viewing locked tables and unlocking
猜你喜欢
![[untitled] basic operation of raspberry pie (2)](/img/b4/cac22c1691181c1b09fe9d98963dbf.jpg)
[untitled] basic operation of raspberry pie (2)

【小技巧】使用matlab GUI以对话框模式读取文件
![[Li Kou brush questions] 15 Sum of three numbers (double pointer); 17. Letter combination of phone number (recursive backtracking)](/img/5e/81e613370c808c63665c14298f9a39.png)
[Li Kou brush questions] 15 Sum of three numbers (double pointer); 17. Letter combination of phone number (recursive backtracking)
![[designmode] Prototype Pattern](/img/ee/c4e48c2ce8ff66f50f0bf13e5a0418.png)
[designmode] Prototype Pattern

【直播回顾】战码先锋首期8节直播完美落幕,下期敬请期待!

Cloud service selection of enterprises: comparative analysis of SaaS, PAAS and IAAs

【DesignMode】建造者模式(Builder model)

Vite: configure IP access

2022-07-01:某公司年会上,大家要玩一食发奖金游戏,一共有n个员工, 每个员工都有建设积分和捣乱积分, 他们需要排成一队,在队伍最前面的一定是老板,老板也有建设积分和捣乱积分, 排好队后,所有

Jetpack之LiveData扩展MediatorLiveData
随机推荐
JVM knowledge points
VS2010插件NuGet
Haute performance et faible puissance Cortex - A53 Core Board | i.mx8m mini
Wpviewpdf Delphi and Net PDF viewing component
"Analysis of 43 cases of MATLAB neural network": Chapter 41 implementation of customized neural network -- personalized modeling and Simulation of neural network
接口调试工具模拟Post上传文件——ApiPost
Introduction to Robotics II. Forward kinematics, MDH method
SQL Yiwen get window function
0 foundation how to learn automated testing? Follow these seven steps step by step and you will succeed
MD5 of Oracle
It took me only 3 months to jump out of the comfort zone and become an automated test engineer for 5 years
整理了一份ECS夏日省钱秘籍,这次@老用户快来领走
微信小程序中 在xwml 中使用外部引入的 js进行判断计算
5G時代全面到來,淺談移動通信的前世今生
VS2010 plug-in nuget
MySQL index, transaction and storage engine
Welcome the winter vacation multi school league game 2 partial solution (B, C, D, F, G, H)
Unity脚本的基础语法(6)-特定文件夹
【力扣刷题】15.三数之和(双指针);17.电话号码的字母组合(递归回溯)
Object oriented thinking