[JAVA] Bureau: OpenCV Merge Two Image

Goal
Test OpenCV to merge two images.

OpenCV_MergeTwoImage.java


import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.core.Rect;
import org.opencv.imgcodecs.Imgcodecs;

public class OpenCV_MergeTwoImage {

    public static void main( String[] args )
    {
        try{
            System.loadLibrary( Core.NATIVE_LIBRARY_NAME );
            Mat source = Imgcodecs.imread("D:\\projects\\Java\\OpenCV_Samples\\resource\\imgs\\ncku.jpg ",Imgcodecs.CV_LOAD_IMAGE_COLOR);
            Mat source1 = Imgcodecs.imread("D:\\projects\\Java\\OpenCV_Samples\\resource\\imgs\\jelly_studio_logo.jpg ",Imgcodecs.CV_LOAD_IMAGE_COLOR);
            Mat destination=source.clone();

            //Imgproc.resize
            Rect roi=new Rect(50,50,90,62);
            Mat destinationROI = source.submat( roi );
            source1.copyTo( destinationROI , source1);

            Imgcodecs.imwrite("D:\\projects\\Java\\OpenCV_Samples\\resource\\imgs\\merge2.jpg ", source);
        }catch (Exception e) {
            System.out.println("error: " + e.getMessage());
        }
    }
}
Result
![merge2.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/276243/de1bce91-dfa2-5b84-350f-1ac13b9a0af1.jpeg)

Recommended Posts

Bureau: OpenCV Merge Two Image
Bureau: image de fusion OpenCV
Bureau: redimensionner l'image OpenCV
Bureau: image OpenCV Flip
Bureau: OpenCV Rotate image
Bureau: OpenCV fusionne deux images de n'importe quelle forme
Bureau: seuil OpenCV
Bureau: OpenCV BilateralFilterBlur
Bureau: OpenCV Dilate
Bureau: OpenCV Affine
Bureau: OpenCV Emboss
Bureau: OpenCV CLAHE
Bureau: OpenCV Ellipse2Poly
Bureau: OpenCV HDR
Bureau: OpenCV Denoise
Bureau: OpenCV Concat
Bureau: OpenCV Mosaic
Bureau: OpenCV Erode
Bureau: OpenCV Denoise
Bureau: Rectangle OpenCV
Bureau: OpenCV Watershed
Bureau: OpenCV Inpaint
Bureau: OpenCV NormalizeBlur
Bureau: OpenCV StereoSGBM
Bureau: OpenCV Spot
Bureau: OpenCV Canny
Bureau: OpenCV Denoise3
Bureau: histogramme OpenCV
Bureau: OpenCV Dft
Bureau: OpenCV Decolor
Bureau: OpenCV FaceDetector
Bureau: OpenCV Denoise2
Bureau: OpenCV StereoBM
Bureau: Changement d'éclairage OpenCV
Bureau: OpenCV Add WaterMark
Bureau: OpenCV Fill ConvexPoly
Bureau: OpenCV Grab Cut
Bureau: OpenCV Sharpness Gui
Bureau: Changement de couleur OpenCV
Bureau: Filtre Freichennel OpenCV
Bureau: seuil adaptatif OpenCV
Bureau: OpenCV Draw Circle
Bureau: OpenCV Fill Poly
Bureau: OpenCV Mean Filter
Bureau: référentiel Java OpenCV
Bureau: OpenCV Sobel Filter2
Bureau: OpenCV pyrMeanShift Filter
Bureau: Piano virtuel OpenCV
Bureau: Filtre OpenCV Scharr
Bureau: aperçu de la webcam Opencv
Bureau: Flou médian OpenCV
Bureau: OpenCV Add Broad
Bureau: OpenCV Robinson Filter
Bureau: enregistrement vidéo OpenCV
Bureau: Aplatissement de la texture OpenCV
Bureau: OpenCV Flood Fill
Bureau: espace colorimétrique OpenCV
Bureau: Filtre OpenCV SqrBox
Bureau: Croquis au crayon OpenCV
Bureau: carte des couleurs OpenCV
Bureau: OpenCV Seamless Clone