Grasshopper

algorithmic modeling for Rhino

Assigning Geometry to color values from image sampler

Hi, I have a image sampling definition that changes selected geometry depending on brightness values in a greyscale image. See first image.

I am looking to do the same with a colored image. For example, reds will be sampled as one geomerty, blues as another....and so on for a number of colors.

Thanks

Views: 8679

Replies to This Discussion

You can peel apart the colours into HUE, SATURATION and LIGHTNESS channels. Then use the hue to find which geometry you need. Basically, each type of geometry has to be associated with a hue value and you find the closest one.

I'm not quite sure how the lightness still fits into this scheme.

yes i dont think lightness will be necessary in the case of color. So i am assuming its the ARGB split component?

as to linking the geometry i am a bit out of my depth here.

Attachments:

Actually you can sample the HUE directly from the image sampler. If you select this filter the sampler will output a range of values between 0.0 and 1.0 that represent the hue.

I used a trick to find the nearest hue value, which is to convert all hues to point x-coordinates. Then I used [Closest Point] to find the nearest one. It's easier than finding the nearest number at the moment.

In the attached file I'm mapping hue values to the line segments (0,0,0)->(1,0,0), however hue is a circular scale so ideally I should have mapped them to a circle. I'll leave that as an exercise to the reader...

Attachments:

thanks david, works like a charm.

yes, either the circle mapping of the hue values or better still, assigning rgb values to the geometry, because at the moment i'm not sure how i can previsualise an image i make in say photoshop before i use it in GH to sample (?).

So i had a go at trying to sample the RBG values, based on what u had given. Perhaps I missed the point, but it fails to reveal all of the geometry....

Attachments:

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service