Bend overlay image to the curvature of underlay image using displacement map filter
I want to place one image on another image such that it looks realistic suppose i have two images one is logo image and other is shirt image, now i want to place logo over shirt image such that logo adjust to curves and depth of shirt image. Please suggest me links or any source that could help me . thanks current i am using simple placement using image overlay transparency and addWeight Api with region of interest i am adding alpha value to logo image Any suggestions or code snippet would be appreciated.
public void loadLogo(ActionEvent actionEvent) throws IOException, InterruptedException
{
Mat imageROI, croppedImage;
Rect roi;
FileChooser fileChooser = new FileChooser();
File selectedFile = fileChooser.showOpenDialog(null);
if (selectedFile != null)
{
BufferedImage logoImage = ImageIO.read(selectedFile.toURL());
Image logo = logoImage;
Mat backgroundImageMatrics = createMat(img);
Mat logoImageMatrics = createMat(logoImage);
roi = new Rect(100, 200, logoImageMatrics.cols(), logoImageMatrics.rows());
imageROI = backgroundImageMatrics.submat(roi);
Core.addWeighted(imageROI,0.3,logoImageMatrics,1-0.3,0.0,dst);
dst.copyTo(imageROI);
HighGui.imshow("Linear Blend", backgroundImageMatrics);
HighGui.waitKey(0);
CloseApp();
}
}
Here below is what actually i want to achieve
see https://docs.opencv.org/master/d5/dc4...
opencv, being a computer-vision library, does not have any support for alpha blending.
i think, you're (ab)using the wrong lib here.
@berak there is support for alpha blending in opencv please see opencv documentation and here i am attaching link , please go through documentation Opencv alpha blending
^^ that's linear blending, not alpha. and it's about using addWeighted(), again.
ok @break tell me how to achieve the bending of logo on uneven surface i have tried addweight() but its not giving required result, see above images you will get my point
there's remap(), but imho, what you want is impossible with opencv means. maybe you'll have to look into opengl for this, it would allow you to warp things in 3d, also proper alpha based ops.