Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Android optimization - line detection is slow - Hough Lines

in my project I need to detect lines in image. I actually have to detect rows and columns inside rectangle. I use OpenCV to accomplish this. I have done it succesfuly but it's kinda slow. I use many functions to preprocess the image - e.g. thresholding, canny, dilation, gaussian blur etc.

I use HoughLines like this

Imgproc.HoughLines(image, lines, 1, Math.PI/90 , threshold, minLineSize, maxGap);

It takes about 2.5 s to complete my program which has ~ 600 lines. But on this one line it takes 2.2 s. As you can see I use Java interface for OpenCV. Is it possible to optimize it someway? Would rewriting my program to NDK make it faster? If I understand OpenCV4Android, than it's just wrapper for functions written in NDK, so I don't think it would be faster. Or is there better and faster approach to detect lines in image? Thanks for any advice.