In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the relevant knowledge of "the method of SIFT corner detection in Java OpenCV". The editor shows you the operation process through the actual case. The operation method is simple, fast and practical. I hope this article "the method of SIFT corner detection in Java OpenCV" can help you solve the problem.
Introduction
In some cases, after zooming the image, the corner information may be lost and Harri cannot detect all the corners. SIFT (scale-invariant feature transform) just overcomes this problem, and the detection of image features is not affected by the change of image size as far as possible. Sift does not directly detect key points.
The key points are detected by DOG (Difference of Gaussians) detection (DOG gets the key points by processing the same image with different Gaussian filters). SIFT only uses feature vectors to describe the pixels around feature points.
Sample code package com.xu.opencv;import org.opencv.core.Core;import org.opencv.core.Mat;import org.opencv.core.MatOfKeyPoint;import org.opencv.core.Scalar;import org.opencv.features2d.Features2d;import org.opencv.features2d.SIFT;import org.opencv.highgui.HighGui;import org.opencv.imgcodecs.Imgcodecs;import org.opencv.imgproc.Imgproc / * @ Title: Image.java * @ Description: OpenCV-4.0.0 Test File * @ Package com.xu.Image * @ author: hyacinth * @ date: 12:20 * @ version: Vmur1.0.0 * @ Copyright: 2019 hyacinth * / public class Image {static {System.loadLibrary (Core.NATIVE_LIBRARY_NAME);} public static void main (String [] args) {sift () } / * OpenCV-4.1.0 SIFT corner detection * * @ return void * @ Author: hyacinth * @ Title: harris * @ Description: TODO * @ date: 12:32 * / public static void sift () {Mat src = Imgcodecs.imread ("D:\\ OneDrive\\ Desktop\\ 1.png") Mat gray = new Mat (); Imgproc.cvtColor (src, gray, Imgproc.COLOR_BGR2GRAY); SIFT sift = SIFT.create (8000); MatOfKeyPoint point = new MatOfKeyPoint (); sift.detect (gray, point); Features2d.drawKeypoints (src, point, src, new Scalar (0,0,255), Features2d.DrawMatchesFlags_DRAW_RICH_KEYPOINTS); HighGui.imshow (SIFT Corner Detection, src) HighGui.waitKey (0);}} effect picture
Supplement
Corner detection includes not only SIFT algorithm, but also FAST algorithm.
FAST (Features from Accelerated Segment Test) algorithm draws a circle around pixels, which contains 16 pixels. FAST algorithm compares the pixels in the circle with the pixels in the center of the circle with a threshold. If several consecutive pixels in the circle are brighter or darker than those with a threshold, it can be considered that the center of the circle is the corner. Fast is a very efficient detection algorithm, but it needs to determine the threshold parameters to detect the corner.
BRIEF (Binary Robust Independent Elementary Features) is mainly implemented in OpenCV through detectAndCompute (). This function consists of two parts, detection and calculation, and returns two results. One is the detected key point, and the other is the descriptor. The same is true of sift and SURF. The descriptor of the key point contains the key information of the image, which can be regarded as another form of image representation. When comparing two images, it can be achieved by comparing the feature descriptions of the two images. it can also be used to match image features.
The following will show the sample code for corner detection through the FAST algorithm. If you need it, please refer to it.
Package com.xu.opencv;import org.opencv.core.Core;import org.opencv.core.Mat;import org.opencv.core.MatOfKeyPoint;import org.opencv.core.Scalar;import org.opencv.features2d.Features2d;import org.opencv.features2d.ORB;import org.opencv.features2d.SIFT;import org.opencv.highgui.HighGui;import org.opencv.imgcodecs.Imgcodecs;import org.opencv.imgproc.Imgproc / * @ Title: Image.java * @ Description: OpenCV-4.0.0 Test File * @ Package com.xu.Image * @ author: hyacinth * @ date: 12:20 * @ version: Vmur1.0.0 * @ Copyright: 2019 hyacinth * / public class Image {static {System.loadLibrary (Core.NATIVE_LIBRARY_NAME);} public static void main (String [] args) {fast () } public static void fast () {Mat src = Imgcodecs.imread ("D:\\ OneDrive\\ desktop\\ 5.jpeg"); Mat gray = new Mat (); Imgproc.cvtColor (src, gray, Imgproc.COLOR_BGR2GRAY); ORB orb = ORB.create (500,1.2f, 8,31,0,2, ORB.HARRIS_SCORE, 31,20); MatOfKeyPoint point = new MatOfKeyPoint () Orb.detect (gray, point); Features2d.drawKeypoints (src, point, src, new Scalar (0,0,255), Features2d.DrawMatchesFlags_DRAW_RICH_KEYPOINTS); HighGui.imshow (FAST Corner Detection, src); HighGui.waitKey (0);}}
Effect picture
This is the end of the content about "the method of SIFT corner detection in Java OpenCV". Thank you for your reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.