accord-net / framework

Machine learning, computer vision, statistics and general scientific computing for .NET
http://accord-framework.net
GNU Lesser General Public License v2.1
4.49k stars 1.99k forks source link

HoughLineTransformation corrupts image size #164

Closed haf closed 6 years ago

haf commented 9 years ago

I got code like this:


  printfn "apply canny"
  let cannied =  canny.Apply eight
  cannied.Save (sprintf "cannied-%s" args.[0])

  let lineTransform = new HoughLineTransformation()
  printfn "apply hough"
  lineTransform.ProcessImage cannied

  let houghLineImage = lineTransform.ToBitmap()
  houghLineImage.Save args.[1]

After apply canny:

cannied-img_2112

After apply hough:

test-hough

It seems the hough transformation somehow distorts the image... I noticed it's the only one that goes through unmanaged memory, perhaps that's the reason?

cesarsouza commented 6 years ago

Well...

Please accept my deep apologies for not having been able to answer this question earlier. In fact, the output of the Hough Transform is correct. It is not that it is corrupting the image, it's just that the set of lines shown at the bottom are really the output of the Hough Transform, e.g. check this image from Wikipedia:

Hough Transform

If you would like to draw the lines that can be found by the Hough Transform into the original image, please take a look at the Hough Transform sample application. It should give an example on how it can be done.

Regards (and sorry again), Cesar

haf commented 6 years ago

Better late than never, right?