Grasshopper

algorithmic modeling for Rhino

hey there, 

i want to have a gradually dispersion of point by a colour image. Where the image are red or blue i want a major density of point, that gradually decrese to the area that are yellow. 

Can anyone help me?

Views: 8801

Replies to This Discussion

http://www.grasshopper3d.com/forum/topics/image-sampling-3?commentI...

Image sampler returns the brightness of particular pixels inside of assigned picture, related to particular point in Rhino. It can return saturation, RGB colors...,

Thank's Felipe.... i just see this definition, but i want to work with a color, and RGB colour have 3 value, and i don't know how i can use this 3 value!

Hi Paolo,

it is an interesting problem because your image is basically a custom gradient mapped onto a grey-scale image. These images often have custom gradients (red=hot, blue=cold) to make it friendlier for humans to read them, but it makes it a lot harder to programmatically extract the information. Is there any chance you'd have access to the original data? If yes, then use the greyscale image and sample Brightness using the Image Sampler.

If no, then you need to find a way to convert colours into single numbers. A not very fast, not very accurate but relatively secure way of doing this would be to duplicate the gradient in Grasshopper and generate a related set of colours and numbers. Then use Key lookup to find your actual values using the [Find Similar Member] component.

I'll try and come up with an example later today (though no promises).

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Oops, [Find Similar Member] doesn't seem to work, you're better off treating your colours as points and then using [Closest Point].

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Attachments:

Thanks David, very inspiring.

Hi Erick, this is exactly what I meant. Can I see how you built the algorithm? It's can help me much. I thank you in advance

I came up with one solution, not very flexible though. Basically what you do is amplify the mesh non-linearly. For example using a power function. This will stretch the mesh vertically and it will stretch it more so where the mesh is high to begin with.

Then you use [Populate Geometry] to place points on this mesh, and due to the nature of the population algorithm there will be more points (on average) on very steep mesh faces than on very horizontal mesh faces. By projecting these points back onto the XY plane, you get a gradient map (see attached).

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Attachments:

Hi all,

Reviving this post - wondering if there might be any better methods to do this four years later..

or if anyone has tried other approaches since.

Thank you very much,

Tim

I did a similar color lookup translation in this thread, May, 2017:

Image Sampler with rgba images
http://www.grasshopper3d.com/forum/topics/image-sampler-with-rgba-i...

Hi Joseph,

Thanks a lot for the response!

It seems to me like translating the extracted color information to variable density of point distribution would require something different from translating it to radii of spheres (the latter would be a single value to single value mapping).

Any thoughts on translating the information to density distribution?

Thanks again,

Tim

I don't see it as that much different, depending on what you expect?  I added this bit of code to what I wrote in May for the other thread.  I'm not going to spend more time on this but will look forward to seeing what you come up with.

Hi Joseph,

Thanks for your response again;

I implemented and altered your approach a bit to work with what I had (a colored mesh).

I had thought of this idea, but was unsure of the somewhat discrete result it would return:

The amount of points distributed in a local area (or a single circle in this case) is limited by the number of steps the domain is allowed to offer, and thus, like what you showed in the image, the distribution is essentially striated and not really continuous across the entire global area.

Please find attached if you or any other would like to take a look and give further suggestions.

Thank you!

Attachments:

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service