[JAVA] Bureau: OpenCV Find Transform ECC

Goal
Test OpenCV find transform ECC.

OpenCV_FindTransformECC.java


import org.opencv.core.Core;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.core.TermCriteria;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.imgproc.Imgproc;
import org.opencv.video.Video;


public class OpenCV_FindTransformECC {
    static{ System.loadLibrary(Core.NATIVE_LIBRARY_NAME); }

    public static void main(String[] args) {

        Mat templste = Imgcodecs.imread("D:\\projects\\Java\\OpenCV_Samples\\resource\\imgs\\DSC_0675.jpg ",Imgcodecs.CV_LOAD_IMAGE_GRAYSCALE);
        Mat needToBeAdjusted = Imgcodecs.imread("D:\\projects\\Java\\OpenCV_Samples\\resource\\imgs\\DSC_0663.jpg ",Imgcodecs.CV_LOAD_IMAGE_GRAYSCALE);


        //Définition de la matrice de déformation du modèle de mouvement
        Mat warp_matrix2=Mat.eye(2, 3, CvType.CV_32F);

        int maxIterations=5000;
        Mat mask=new Mat();

        //Arithmétique ECC appliquée. Résultat Matrice de chaîne résiduelle
        Video.findTransformECC(templste, needToBeAdjusted, warp_matrix2,Video.MOTION_EUCLIDEAN,new TermCriteria(TermCriteria.COUNT | TermCriteria.EPS, maxIterations, 1E-10),mask);
        Mat aligned=new Mat();

        //for  Euclidean and Affine
        Imgproc.warpAffine(needToBeAdjusted, aligned, warp_matrix2, templste.size(),Imgproc.INTER_LINEAR+Imgproc.WARP_INVERSE_MAP);
        Imgcodecs.imwrite("D:\\projects\\Java\\OpenCV_Samples\\resource\\imgs\\findTransformECC2.jpg ",aligned);
    }
}
Result
![DSC_0675.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/276243/4d17afd5-c2a7-83ae-ba5b-fe7da3baa318.jpeg) ![DSC_0663.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/276243/8c5f1b76-ff50-f954-ac6f-6909ed66e512.jpeg) ![findTransformECC2.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/276243/3b0222ad-0d19-3105-e5f0-617ee33f808e.jpeg)

Recommended Posts

Bureau: OpenCV Find Transform ECC
Bureau: OpenCV BilateralFilterBlur
Bureau: OpenCV Dilate
Bureau: OpenCV Expand
Bureau: OpenCV Affine
Bureau: OpenCV Emboss
Bureau: OpenCV CLAHE
Bureau: OpenCV Ellipse2Poly
Bureau: OpenCV HDR
Bureau: Polylignes OpenCV
Bureau: OpenCV Denoise
Bureau: netteté OpenCV
Bureau: OpenCV Concat
Bureau: OpenCV OpenCV_SalonUseBlurAddWeighted
Bureau: OpenCV Mosaic
Bureau: OpenCV Erode
Bureau: OpenCV Denoise
Bureau: OpenCV Trouver les coins de l'échiquier par WebCam
Bureau: Rectangle OpenCV
Bureau: OpenCV Watershed
Bureau: Texte OpenCV
Bureau: OpenCV Inpaint
Bureau: OpenCV NormalizeBlur
Bureau: OpenCV StereoSGBM
Bureau: OpenCV Trouver les coins de l'échiquier par WebCam
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: Filtre OpenCV Kirsch
Bureau: Filtre laplacien OpenCV 2
Bureau: Changement d'éclairage OpenCV
Bureau: OpenCV Add WaterMark
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: OpenCV OpticalFlow PyrLK
Bureau: Piano virtuel OpenCV
Bureau: image de fusion OpenCV
Bureau: Filtre OpenCV Scharr
Bureau: aperçu de la webcam Opencv
Bureau: Filtre laplacien 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