Grasshopper

algorithmic modeling for Rhino

Hi all! I am trying to do hough circle transform in c#. in face I want to input an image to grasshopper and took curves as a ressult. I know there is Aforge.Imaging namespace to image processing for c#.net, but i dont know if that is possible to use it in grasshopper too? may be a source code of hough transform in c# helps to. please consider I am new in c#! thnx!

Views: 1412

Replies to This Discussion

I have no idea what AForge does but :

You want to sample ponts from some list based on another (RGB values) and then do something?

For instance use a concave hull algo on all except the black points (and thus get the "outline").

Or use some ball pivot algo (not Delauney) and get some  "sketch" as mesh

Or select all that have RGB values within a given domain and then ... er ... hmm ... what?

Aforge is a non-standard assembly, so unless you have a copy of it you cannot use it. If you do have a copy of it then that assembly can either be referenced directly by the C# component or you can PInvoke it from code. However if you plan to distribute your script, then you must also be sure that you are allowed to distribute the AForge.dll

I'm not entirely sure how you're going to output curves from applying a hough transform to a bitmap though, you'll need to elaborate on that.

Anyway basic RGB "filtering" stuff "like" this is rather simple (and getting "outlines"/meshes as well, so if this is actually the requirement - and not curves - is entirely doable within GH)

Used classified BPA and Concave hull C# : they indeed do some stuff but well ... image processing is a huge hot cake (and properly prepares the nightmare of tomorrow: Brave New World etc etc).

mesh with BPA:

Various Concave Hull solutions (depending on sensitivity):

For doing things using solely GH you'll probably need:

  • island detection,
  • polyline smoothing,
  • some sort of hard flat clustering,
  • fast BPA/Concave algos,
  • ...

See attached: using a non even random point very simple C# that for huge amount of points is obviously faster than David's stuff (but this of course makes even distribution and thus is maybe better for the scope). C# does the "normalized" points job as well.

If you opt for using David's component on some rectangle you'll need to remap the x/y coordinates (0-1) for the Image sampler. 

Attachments:

And this makes(?) some(??) sense(???) more(????).

Attachments:
Hi David, ofcourse I am not going to crack Aforge, but I was thinking if I can import it to grasshopper c#. So I found that is not going to happen.
I think I can use another ways too. Like what peter mentioned... thank you ☺

Peter I think I can use something like that to do what I want. I will try and send it here, thank you ☺

Well .. if you want huge amount of random points it's advisable to write a small C# that do these without the "even" distribution that David uses (thus taking some time more).

For fun I'll try some (internal) concave algos to see what happens - but if memory serves there's one around that is not classified (using a convex hull as a base guideline).

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service