java harris corner,检测在Java中使用CornerHarris与OpenCV的图像的四角

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);

}

Following are the tutorials I followed (in python and C++):

I need to to know how to complete this code and get it working. Any help is appreciated!

EDIT

I want to find corners of this kind of an image like this:

VW4YJ.jpg

解决方案

Various techniques to find edges in the image.

Extract the white colour with HSV inrange()

Use Hough lines transform to detect the lines.

Use the angles of the detected lines to find the corners.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值