27 lines
502 B
C++
27 lines
502 B
C++
|
|
#include "histo.h"
|
||
|
|
#include <opencv2/core.hpp>
|
||
|
|
#include <opencv2/highgui.hpp>
|
||
|
|
#include <opencv2/imgproc.hpp>
|
||
|
|
#include <iostream>
|
||
|
|
|
||
|
|
using namespace cv;
|
||
|
|
|
||
|
|
int main(){
|
||
|
|
Mat img = imread("dark_img.jpg", IMREAD_GRAYSCALE);
|
||
|
|
imshow("img", img);
|
||
|
|
Histo::showHisto(img);
|
||
|
|
|
||
|
|
double ah, fh;
|
||
|
|
minMaxLoc(img, &ah, &fh);
|
||
|
|
|
||
|
|
fh = 30;
|
||
|
|
|
||
|
|
Mat dest = (ah == fh) ? img.clone() : (img-ah) * 255 / (fh-ah);
|
||
|
|
|
||
|
|
imshow("dest", dest);
|
||
|
|
Histo::showHisto(dest, "eredmeny");
|
||
|
|
|
||
|
|
waitKey();
|
||
|
|
return 0;
|
||
|
|
}
|