Java OpenCV:从图像数据设置MatOfKeyPoints
我在OpenCV中创建了一个FeatureDetector。现在我不想使用所有的关键点。所以我决定用面具。现在我有两个问题:Java OpenCV:从图像数据设置MatOfKeyPoints,java,image,opencv,mask,Java,Image,Opencv,Mask,我在OpenCV中创建了一个FeatureDetector。现在我不想使用所有的关键点。所以我决定用面具。现在我有两个问题: 一,。我是使用MatOfKeyPoint还是使用Mat类,两者都在OpenCV核心中。 二,。如何根据包含二进制信息的图片中的数据设置掩码 这是我到目前为止所拥有的 @SuppressWarnings("static-access") public static void run() { System.loadLibrary(Core.NATIVE_LIBRARY
一,。我是使用MatOfKeyPoint还是使用Mat类,两者都在OpenCV核心中。
二,。如何根据包含二进制信息的图片中的数据设置掩码 这是我到目前为止所拥有的
@SuppressWarnings("static-access")
public static void run() {
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
String sourcePath = "pic.png";
Features2d features2d = new Features2d();
Mat srcImgMat = Highgui.imread(sourcePath);
if (srcImgMat == null) {
System.out.println("Failed to load image at " + sourcePath);
return;
}
System.out.println("Loaded image at " + sourcePath);
MatOfKeyPoint matOfKeyPoints = new MatOfKeyPoint();
FeatureDetector blobDetector = FeatureDetector.create(FeatureDetector.DENSE);
blobDetector.detect(srcImgMat, matOfKeyPoints);
//============================================================================================================
MatOfKeyPoint matOfKeyPointsSecond = new MatOfKeyPoint();
Mat mask = new Mat();
//picture with binary data
File file = new File("binary.jpg");
BufferedImage image = ImageIO.read(file);