Grasshopper

algorithmic modeling for Rhino

Hi David et al.

As my knowledge of VB.NET components is fairly limited, is it possible to use the functionality of the GHIS before the image sampler. I have a folder of 19 images that I would like to analyse with the Image Sampler all at the same time.

I've manually stitched them together into a 4 x 5 mosaic and created sub-domains to treat each one individually. However, I expect to have to do this many times with different sets of images. Is there a way to get Grasshopper to stitch them together for me before opening in the image sampler?

Or do you know of another way?

---

Danny

Views: 1032

Replies to This Discussion

It's probably easier to do it just directly in code. The Image Stitcher is difficult to control and its functionality is very specific. The only reason to use it is that it can run in a pristine 2~3GB of memory and can thus create far larger images then when it has to share memory space with an application like Rhino.

Combining images is not difficult if you know a bit of VB/C#, so I can help you out if you tell me exactly what you'd ideally need. Whether as a grasshopper script component or stand-alone app.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

This is a re-posting from a PM

Thanks David,

I'm looking to get the wave heights over a period of time from a specific location.

Here's the sort of thing I'm after. The Orange Arrow indicates [Start Bottom Left and go up before moving to next column] the ideal placement of the images in order of selection. (Although this version actually goes from top left across to the right and then next line etc)

[image removed for confidentiality reasons]

It would be great if it could reduce the original image size to make it manageable but with a certain degree of control. But the grid dimensions could be managed automatically ie 4 x 5 for 19 but access to the dimensions would be useful.

Also I was wondering if there was a way to reverse engineer a colour spectrum. For example if I have a wave spectrum like the one above where the lowest is blue increasing through yellow all the way up to red and I feed the colour value into a component such as the Gradient with a user defined spectrum, can I get a wave height out?

Best regards,

Danny

Also I was wondering if there was a way to reverse engineer a colour spectrum. For example if I have a wave spectrum like the one above where the lowest is blue increasing through yellow all the way up to red and I feed the colour value into a component such as the Gradient with a user defined spectrum, can I get a wave height out?


Gradients do not have a constraint that any colour can only occur once, so it is certainly not possible in every case. It would be possible to find the first (or the last, or any, or all) occurrence(s) of a specific colour in a gradient. However there's no code yet that does this. 


Would it be possible to just get the HUE channel of the colour and remap the 0°~360° value onto your wave-heights?


--

David Rutten

david@mcneel.com

Poprad, Slovakia

Actually, idea.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Nice work!

So here's a quick'n'dirty VB script that aggregates a bunch of images in a folder. It will probably need some tweaking (there's no control over the tile order at the moment), but is this sort of what you were looking for?

You might want to change the default background colour (HotPink at the moment, search the code for "Color.HotPink" and replace with "Color.Burlywood" or "Color.White" or whatever floats your boat (ha! a nautical joke)).

You can also change the interpolation mode of the graphics object. It's hardcoded to NearestNeighbor in the VB component, but you can experiment with other modes as well.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Attachments:

Oh, if the image file is locked by some program, it won't be able to save the new image and you'll get a generic error, I didn't handle it specifically.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

And it's probably quite stupid to save the final image into the same folder, because it might be incorporated during the next iteration. Though hopefully you can use the filter input to prevent this.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Man you love the Cake!

Great, thanks for this.

As you know the desired file name of the composition you could just filter this out each time.

Can it be incorporated into the code to get the aspect ration of the image rather than have a separate height and width? Otherwise I can set an aspect ratio in Grasshopper.

EDIT: I suddenly realised that the aspect ration would only work if they were all the same. Good for my case but not universal none the less.

You can use a package like Paint Shop to record a set of actions and apply them to all the files in a folder. I used to do this for icons (adding drop shadow to 1200 images is not something you want to do manually).

But yes, since the images are tiled, they all need to have the same dimensions.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

RSS

About

Translate

Search

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service