We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexDiscussionExhibition › Dices
Page Index Toggle Pages: 1
Dices (Read 2060 times)
Dices
Jul 6th, 2009, 4:09am
 
Hi !

A friend of meine (photoartist) wants do build an image he did out of dices. He asked me how to do this, cause Im a developer, but Im new to processing.
The function should divide a given image into many squares and then choose for the square a image of a dice to replace it.
The dices are from one to six (1- dark and 6 -lightest) and are in red blue and yellow with white points). So the function shoud calculate for a sqare of pixels the average color and brightness and than choose the corresponding image of the dice and then the next part of the image. It shoud be a pointilism effect with dices.
He wants to build this picture if he has the electronic model in real.
2 x 2 meters somehow.
Any advices how to do this in processing.

Thanks in advance. Thomas
Re: Dices
Reply #1 - Jul 6th, 2009, 8:07am
 
Reminder: this section is "a place to share your finished work", questions should go to Programs (in your case) or Syntax Questions or more specialized sections.

And I fear I didn't understand your problem.
Re: Dices
Reply #2 - Jul 6th, 2009, 8:32am
 
I do understand, seems like he just want to copy roberts work
http://www.flight404.com/blog/?p=131

ok, it has been done before many times. with dices, cofee, toasts, rubikcubes etc... so all you have to do is take the picture and remap the brigthness from 0-255 for every pixel to a new greyvalue from 1-6...
Re: Dices
Reply #3 - Jul 6th, 2009, 8:52am
 
Aaah, it is much clearer with an illustration!
Re-reading the explanation after seeing that, it is much clearer, I didn't get it was about real dices...

Would have been easier, perhaps, with red, blue and green dices, but I suppose we have to do with what you have...
And what is the size of a dice? How many fit in the 2 meters?
Re: Dices
Reply #4 - Jul 6th, 2009, 8:53am
 
btw i already worked on something like this. im sorry that i cant share the code because its part of an upcoming book.
But like i said, its pretty easy.


...
Re: Dices
Reply #5 - Jul 6th, 2009, 11:16am
 
Here is my implementation (including source):  
http://luis.net/projects/processing/dice/

...

Input Image:
...

Dice:
... ... ... ... ... ...





Re: Dices
Reply #6 - Jul 7th, 2009, 12:21am
 
yep thats better, now i know why my version looked so strange i should have inverted the dices...
Re: Dices
Reply #7 - Jul 7th, 2009, 1:02am
 
Actually no, at least according to original post, since the dices have white dots...
Also one of the requirements were to use three colors of dice, which make the task harder... (read: more interesting...)
Re: Dices
Reply #8 - Jul 7th, 2009, 9:35am
 
No code change needed:
...

input image:
...

only increased the color index array by adding a few more die:
... ... ...

A different input image would yield better results.   Having dices within the same color range(dark red + pink + orange) with black and white die would make better dice art.  
Re: Dices
Reply #9 - Jul 7th, 2009, 10:06am
 
it might be an interesting experiment to sample the image at double the output resolution (so f.e. 100 pixels -> 50 dice, each 2x2 pixel block producing one die) so that when a 2 or 3 is called for you could subsample those four pixels and determine if a forward/backward slash rotation were a better match, the intent being to add a bit of "edge detection" to the die orientation when possible.
Re: Dices
Reply #10 - Jul 12th, 2009, 4:34am
 
Great. That was exactly what I was searching for !
Many thanks.T.
Page Index Toggle Pages: 1