当前位置:网站首页>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;
}

边栏推荐
- It took me only 3 months to jump out of the comfort zone and become an automated test engineer for 5 years
- Suggestions on settlement solution of u standard contract position explosion
- Where can I buy cancer insurance? Which product is better?
- Get started with Aurora 8b/10b IP core in one day (5) -- learn from the official routine of framing interface
- The second game of the 11th provincial single chip microcomputer competition of the Blue Bridge Cup
- 【直播回顾】战码先锋首期8节直播完美落幕,下期敬请期待!
- Qt插件之Qt Designer插件实现
- Imageai installation
- Oracle 查看被锁的表和解锁
- [mv-3d] - multi view 3D target detection network
猜你喜欢

Fourier series

【人员密度检测】基于形态学处理和GRNN网络的人员密度检测matlab仿真

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

滴滴开源DELTA:AI开发者可轻松训练自然语言模型

Lost a few hairs, and finally learned - graph traversal -dfs and BFS

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

蓝桥杯单片机省赛第八届
![[wireless image transmission] FPGA based simple wireless image transmission system Verilog development, matlab assisted verification](/img/77/4df7a1439ff1a53f94d409a19a47d6.png)
[wireless image transmission] FPGA based simple wireless image transmission system Verilog development, matlab assisted verification

Haute performance et faible puissance Cortex - A53 Core Board | i.mx8m mini

0基础如何学习自动化测试?按照这7步一步一步来学习就成功了
随机推荐
Wpviewpdf Delphi and Net PDF viewing component
Xlwings drawing
Get started with Aurora 8b/10b IP core in one day (5) -- learn from the official routine of framing interface
Introduction to Robotics II. Forward kinematics, MDH method
Basic syntax of unity script (6) - specific folder
《西线无战事》我们才刚开始热爱生活,却不得不对一切开炮
【小技巧】使用matlab GUI以对话框模式读取文件
Network connection mode of QT
一天上手Aurora 8B/10B IP核(5)----从Framing接口的官方例程学起
Unity脚本的基础语法(8)-协同程序与销毁方法
Basic operations of MySQL database (based on tables)
It took me only 3 months to jump out of the comfort zone and become an automated test engineer for 5 years
蓝桥杯单片机省赛第五届
2022-07-01:某公司年会上,大家要玩一食发奖金游戏,一共有n个员工, 每个员工都有建设积分和捣乱积分, 他们需要排成一队,在队伍最前面的一定是老板,老板也有建设积分和捣乱积分, 排好队后,所有
Kotlin basic learning 16
MySQL index, transaction and storage engine
Homework in Chapter 3 of slam course of dark blue vision -- derivative application of T6 common functions
Haute performance et faible puissance Cortex - A53 Core Board | i.mx8m mini
【IBDFE】基于IBDFE的频域均衡matlab仿真
Pandora IOT development board learning (HAL Library) - Experiment 2 buzzer experiment (learning notes)