Line detection in Java

2019-09-05 06:40发布

问题:

My main goal is to detect the little line over the left of the image:

By detecting line I mean I want a line equation of this form: y = ax + b.

In order to find the line, I tried using this Hough Transform java class, which doesn't return the equation I want but at least supposed to find the line, but what happens is that it does not detect the line I want (it actually locates only the horizontal line in the image, and even this is not perfect. The y cord is located perfectly but the x is missed and started from 0, and as you see the line does not start at x=0).

I do not mind detecting all the lines in the image, but at least I have to detect the line I want, the sole line over the left.

I also don't mind using other method than Hough Transform...

P.S already tried this ImageJ code but it didn't work out for me as well. (I used it as is, maybe it needs to be changed, but I don't really understand what the ParticleAnalyzer does)