Skip to content

Commit 0a64f9a

Browse files
committed
Add UnevenLightCompensate.cpp
1 parent efa6bf0 commit 0a64f9a

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

UnevenLightCompensate.cpp

+18-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
#include "stdafx.h"
2+
#include <stdio.h>
3+
#include <iostream>
4+
#include <immintrin.h>
5+
#include <opencv2/opencv.hpp>
6+
using namespace cv;
7+
using namespace std;
8+
19
Mat speed_rgb2gray(Mat src) {
210
Mat dst(src.rows, src.cols, CV_8UC1);
311
#pragma omp parallel for num_threads(12)
@@ -45,10 +53,19 @@ Mat unevenLightCompensate(Mat src, int block_Size) {
4553
}
4654
new_img = new_img - average;
4755
Mat new_img2;
48-
resize(new_img, new_img2, Size(row, col), (0, 0), (0, 0), INTER_CUBIC);
56+
resize(new_img, new_img2, Size(col, row), (0, 0), (0, 0), INTER_CUBIC);
4957
Mat new_src;
5058
gray.convertTo(new_src, CV_32FC1);
5159
Mat dst = new_src - new_img2;
5260
dst.convertTo(dst, CV_8UC1);
5361
return dst;
62+
}
63+
64+
int main() {
65+
Mat src = cv::imread("F:\\car.jpg");
66+
Mat dst = unevenLightCompensate(src, 64);
67+
cv::imshow("result", dst);
68+
cv::imwrite("F:\\res.jpg", dst);
69+
cv::waitKey(0);
70+
return 0;
5471
}

0 commit comments

Comments
 (0)