Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

place one image over another using image overlay transparency

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 copyTo and addWeight Api with region of interest Now i have come to the conclusion that it would be possibel using image overlay transparency but i have no idea how to implement it 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);
        logoImageMatrics.copyTo(imageROI);
            imageView.setImage(SwingFXUtils.toFXImage(toBufferImage(backgroundImageMatrics), null));
            return;
           }

  }

But I am getting simple placement like this

Actual result

This required result

image description

place one image over another using image overlay transparency

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. image. Please suggest me links or any source that could help me . thanks current i am using simple placement using copyTo image overlay transparency and addWeight Api with region of interest Now i have come am adding alpha value to the conclusion that it would be possibel using image overlay transparency but i have no idea how to implement it 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);
        logoImageMatrics.copyTo(imageROI);
            imageView.setImage(SwingFXUtils.toFXImage(toBufferImage(backgroundImageMatrics), null));
            return;
        Core.addWeighted(imageROI,0.3,logoImageMatrics,1-0.3,0.0,dst);
                dst.copyTo(imageROI);
                HighGui.imshow("Linear Blend", backgroundImageMatrics);
                HighGui.waitKey(0);
                 CloseApp();
               }

   }

But I am getting simple placement like this

Actual result

image description This required result

image description

place one image over another using image overlay transparency

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();
               }

      }

But I am getting simple placement like thisHere below is what actually i want to achieve

image description This required resultThis is required result

image description

place one image over another using image overlay transparency

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

This is required result image description image description

place one image over another using image overlay transparency

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

This is required result image description image description

place one image over another using image overlay transparency

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

This is required result image description image description

place one image over another using image overlay transparency

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

This is required result image description image description

place one image over another using image Bend overlay transparencyimage to the curvature of underlay image

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

This is required result image description image description

Bend overlay image to the curvature of underlay image

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

This is required result image description image description

Bend overlay image to the curvature of underlay image

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

This is required result image description image description