Merge two images showing brightness
I am trying to blend two images, or you can tell me to put one image on top of another image when I apply blend overlay on an image, or simply merge two images that show me the brightness in it.
here are my two images (the first vignette is empty from the inside, it does not contain the brightness in the center)
and the other is
The code I made is
int main( int argc, char** argv )
{
Mat img=imread("E:\\vig.png",-1);
Mat ch[4];
split(img,ch);
Mat im2 = ch[3]; // here the vignette
im2 = 255 - im2; // eventually cure the inversion
Mat img2 = imread("E:\\ew.jpg");
Mat out2;
blending_overlay3(img2 , im2 , out2);
imshow("image",out2);
imwrite("E:\\image.jpg",out2);
waitKey();}
Show me a result similar to
but i need a result like
EDIT
The first image is blank / blank from the center (vignette), but when I read the image (vignette) with my program then it becomes solid (bright) from the center, its implementation history will be here
There is only one problem and its first reading (vignette) of the image if it is read as it is, blank / blank from center, so that another image we merge / blend / weight with, regardless of its application, t affect central part of the image, don't even show brightness etc. what i want to do
source to share
he told me again :) It seems that you are writing a new photoshop.
As a result, I got:
Code:
#include <iostream>
#include <vector>
#include <stdio.h>
#include <functional>
#include <algorithm>
#include <numeric>
#include <cstddef>
#include "opencv2/opencv.hpp"
#include <iostream>
#include <fstream>
using namespace std;
using namespace cv;
int main( int argc, char** argv )
{
namedWindow("Image");
Mat Img1=imread("Img1.png",-1);
Mat Img2=imread("Img2.png");
cv::resize(Img1,Img1,Img2.size());
Img1.convertTo(Img1,CV_32FC4,1.0/255.0);
Img2.convertTo(Img2,CV_32FC3,1.0/255.0);
vector<Mat> ch;
split(Img1,ch);
Mat mask = ch[3].clone(); // here the vignette
ch.resize(3);
Mat I1,I2,result;
cv::multiply(mask,ch[0],ch[0]);
cv::multiply(mask,ch[1],ch[1]);
cv::multiply(mask,ch[2],ch[2]);
merge(ch,I1);
vector<Mat> ch2(3);
split(Img2,ch2);
cv::multiply(1.0-mask,ch2[0],ch2[0]);
cv::multiply(1.0-mask,ch2[1],ch2[1]);
cv::multiply(1.0-mask,ch2[2],ch2[2]);
merge(ch2,I2);
result=I1+I2;
imshow("Image",result);
waitKey(0);
}
source to share