检测在Java中使用CornerHarris与OpenCV的图像的四角 [英] Detect four corners of an image using CornerHarris in JAVA with openCV
问题描述
我想使用的OpenCV CornerHarris方法在我的Android应用程序,以检测我通过在图像的四角。我已成功地通过影像分为CornerHarris。但我需要用圆圈来表示图像的四角。这是到目前为止我写的code:
I am trying to use CornerHarris method of openCV in my android application to detect the four corners of the image that I pass in. I have managed to pass the the image into CornerHarris. But I need to indicate the four corners of the image by circles. This is the code that I have written so far:
private Mat findCorners(Mat original_image) {
Mat imgSource = original_image;
// Mat untouched = original_image.clone();
// convert the image to black and white
Imgproc.cvtColor(imgSource, imgSource, Imgproc.COLOR_BGR2GRAY);
// convert the image to black and white does (8 bit)
Imgproc.Canny(imgSource, imgSource, 200, 200);
Imgproc.cornerHarris(imgSource, imgSource, 2, 3, 0.04, 1);
for(int y = 0; y < imgSource.height(); y++){
for(int x = 0; x < imgSource.width(); x++){
//need to complete here.
}
}
Highgui.imwrite(baseDir + "/mediaAppPhotos/harris.png", imgSource);
}
以下是我跟着教程(Python和C ++):
Following are the tutorials I followed (in python and C++):
<一个href=\"http://glowingpython.blogspot.com/2011/10/corner-detection-with-opencv.html?showComment=1382874899072#c5130082031283749433\"相对=nofollow>角检测与OpenCV的
我需要知道如何完成这个code和得到它的工作。任何帮助AP preciated!
I need to to know how to complete this code and get it working. Any help is appreciated!
修改
我要找到这种类似这样的图像的角落:
I want to find corners of this kind of an image like this:
推荐答案
各种技术来查找图像的边缘。
Various techniques to find edges in the image.
- 提取白色与HSV INRANGE()
- 使用霍夫变换线检测线。
- 使用检测线的角度找到了角落。
这篇关于检测在Java中使用CornerHarris与OpenCV的图像的四角的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!