1

I want make app that show something above longest straight line in image.

i know should convert RGB Image to GrayScale. also know should use edge detections algorithm and(sobel,canny,...)

Sobel Edge Detection in Android

but i don't know how can i find largest straight line in image,line may be part of rectangle or any shape,i just want find longest line position in image but no gradient(or small level of gradient)

how can i implement it with no external library (or lightweight libraries)

Community
  • 1
  • 1
hosein
  • 519
  • 5
  • 25

1 Answers1

1

The Hough Transform is the most commonly used algorithm to find lines in an image. Once you run the transform and find lines, it's just a matter of sorting them by length and then crawling along the lines to check for the constraints your application might have.

RANSAC is also a very quick and reliable solution for finding lines once you have the edge image.

Both these algorithms are fairly easy to implement on your own if you don't want to use an external library.

Zaphod
  • 1,927
  • 11
  • 13