Grasshopper

algorithmic modeling for Rhino

Hi all,

 

I would like to Count and output the RGB Grid with a supplied image.

So the output would be:

numbers of Grids with value 0,0,255 (blue): 5

numbers of Grids with value 255,0,0 (red): 2

...etc.

 

But i don't seem to get it working....hope someone could look into my script and point out whats wrong. Thanks

 

 

 

Views: 1181

Attachments:

Replies to This Discussion

Does anyone know whether it is possible with image sampler or not?..
thAnks...

it would be easier if this bitmap has size 3x3 pixels (without any antialiasing etc, just pure bitmap). 

then youll need some scripting -> iterate through all the pixels and if e.g pixel's hue <15 and >90 then add "red" to the strings/int list. 

pseudocode : 

create list of strings

load bitmap from file path

get bitmap height

get bitmap width

count pixels -> (width*height) -> create a new int (pixelCount)

check every pixels color :

  • loop till i = pixelCount-1
  • if hue < 20 and >80 then add "red" to string list
  • if hue >20 and <40 then add ... etc.

output string list

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service