#include <iostream>
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/imgproc/imgproc.hpp"
#include <stdio.h>
using namespace std;
using namespace cv;
int main()
{
Mat newImg,img;
img=imread("img.jpeg");
cvtColor(img, newImg, CV_BGR2HSV);
imwrite("test.jpg", newImg);
vector<Mat> hsv_planes;
split(newImg, hsv_planes); //geting the color plans of image
int param = -70; // the value that I'm seting for V
for (int y = 0; y < newImg.rows; y++) {
for (int x = 0; x < newImg.cols; x++) {
Vec3b pixel = hsv_planes[2].at<Vec3b>(y, x);
pixel[0] = 0;
pixel[1] = 0;
pixel[2] = param;
hsv_planes[2].at<Vec3b>(y, x) = pixel;
}
}
merge(hsv_planes, newImg);
Mat imagem;
cvtColor(newImg, imagem, CV_HSV2BGR);
imwrite("final.jpg", imagem);
return 0;
}