반응형
Recent Posts
Recent Comments
관리 메뉴

개발잡부

SIFT 본문

OpneCV

SIFT

닉의네임 2021. 9. 2. 22:39
반응형

-Djava.library.path=libs

 

 

public static void main(String[] args) {
        System.loadLibrary(org.opencv.core.Core.NATIVE_LIBRARY_NAME);
        SIFT sift = SIFT.create();
        String imgPath = "/Users/doo/project/doo/common/src/main/java/com/bbongdoo/doo/images/guin.jpeg";
        Mat img1 = Imgcodecs.imread(imgPath, Imgcodecs.IMREAD_GRAYSCALE);
        MatOfKeyPoint kpts1 = new MatOfKeyPoint();
        Mat desc1 = new Mat();

        sift.detectAndCompute(img1, new Mat(), kpts1, desc1);

        System.out.println("Found n. keypoints: " + kpts1.size());
        KeyPoint[] keyPoints = kpts1.toArray();
        for (int i = 0; i < keyPoints.length; i++) {
            KeyPoint kp = keyPoints[i];
            System.out.println(i + ": pt " + kp.pt
                    + ", size = " + kp.size
                    + ", angle = " + kp.angle
                    + ", octave = " + kp.octave);
        }
    }
반응형

'OpneCV' 카테고리의 다른 글

opencv 텍스트 영역 감지  (0) 2021.01.07
opencv 성인 이미지 검사  (0) 2020.12.31
ubuntu20, openCV450, java14  (0) 2020.12.15
opencv java mac intellij  (0) 2020.10.22
Comments