How to save OpenCV image keypoints in mysql database using Java?

asked 2016-02-05 01:09:17 -0600

Shoaib Akhtar gravatar image

Using OpenCV in java i am trying to compare two images using their keypoints.i want to store image keypoints in mysql database and then fetch those keypoints to compare if both images are similar or not based on how much(percentage) they differ. Here is my code for keypoint recognition

System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
Mat img_1=Imgcodecs.imread("1.jpg");
Mat img_2=Imgcodecs.imread("2.jpg");

MatOfKeyPoint kp_1 = new MatOfKeyPoint();
MatOfKeyPoint kp_2 = new MatOfKeyPoint();

FeatureDetector fd = FeatureDetector.create(FeatureDetector.FAST);  
fd.detect(img_1, kp_1);
fd.detect(img_2, kp_2);

how can i save these keypoints in mysql database and then retrieve to compare these keypoint to find percentage difference?

edit retag flag offensive close merge delete

Comments

it would make more sense, to store & compare descriptors than keypoints

berak gravatar imageberak ( 2016-02-05 01:19:05 -0600 )edit

got it. then how to compare those descriptor here are my descriptor

Mat descriptors_1 = new Mat(); Mat descriptors_2 = new Mat();

DescriptorExtractor descriptor = DescriptorExtractor.create(DescriptorExtractor.ORB);

    descriptor.compute(img_1,kp_1,descriptors_1);
    descriptor.compute(img_2,kp_2,descriptors_2);
Shoaib Akhtar gravatar imageShoaib Akhtar ( 2016-02-05 04:45:22 -0600 )edit