当前位置:网站首页>Opencv learning log 30 -- histogram equalization

Opencv learning log 30 -- histogram equalization

2022-07-06 15:43:00 @Spring sauce

Preface

This article is mainly about opencv Histogram equalization in image processing algorithm .

One 、 Histogram equalization

// The second question is   Histogram equalization 
#include <opencv2/opencv.hpp>
#include <iostream>
using namespace cv;

float chance[256];
int main()
{
    
	cv::Mat src_color = imread("C://Users//john//Desktop//1.jpg");
	//cv::imshow("src_color",src_color);
	std::vector<cv::Mat> channels;
	cv::split(src_color, channels);
	cv::Mat B = channels.at(0);
	cv::Mat G = channels.at(1);
	cv::Mat R = channels.at(2);
	cv::imshow("redFI", R);
	cv::imshow("blueFI", B);
	cv::imshow("greenFI", G);
	cv::imshow("original MatFI", src_color);
	equalizeHist(B, B);
	equalizeHist(G, G);
	equalizeHist(R, R);
	cv::imshow("red", R);
	cv::imshow("blue", B);
	cv::imshow("green", G);
	cv::imshow("original Mat", src_color);
	waitKey(0);
}

summary

1. The code can run directly , If you don't understand, you can leave a message .
2. Missing material pictures , Follow up, thank you .

原网站

版权声明
本文为[@Spring sauce]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202131317244602.html