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.
IndexProgramming Questions & HelpPrograms › All Images in one Program. Need little help...
Page Index Toggle Pages: 1
All Images in one Program. Need little help... (Read 1496 times)
All Images in one Program. Need little help...
Jun 1st, 2005, 6:57pm
 
hello,

i try to write a Program that calculates every Image you can imagine. This is based on the fact, that every Image is build out of pixels. The Program generates Images from a selected size, an fills every Pixel with random colour. If you wait long enough you may see picture of you?...

That's the background, now back to reality. Here is the Link to the first try:
http://www.getp.de/dipl/processing%20sketches01/orakelbilt02/applet/

i figured out that the random function is not the right way to do this. Because the random function only generates noise, i don't know much about this random function, but i think there should be an other way. The "numeric" way...

I imagine a Program that begins on a white drawing area, and fills
pixel by pixel the area with colour (or greyscale). So that every combination of Color/Pixel someday appears on the screen.

But all the experiments to write such a Program don't work. I have not enough programming experience to figure out how a algorithms should do that.

i helped my in a very inconvenient way: it is based on the first script, but every image which is shown on the screen is saved to a memory, if the following images are similar or the same as one in the memory it will not be shown on the screen... have a look.

http://www.getp.de/dipl/processing%20sketches01/orakelbilt04_randomcheckv02/applet/


for demonstrating what i need here an other try:
look at the black square (pixel)... it goes through the image pixel by
pixel, when the last pixel is reached there starts an other pixel...
and so on... this example is only with 2 colours, and only with 2
Pixels,..

http://www.getp.de/dipl/processing%20sketches01/orakelbilt032sansrandom/applet/

please ignore the pink squares, they are only for debugging.

if you have any idea how to program, i called it "Ultimate Oracle Picture" i am happy to try out your ideas.

greetings
jon

,,sorry for bad English

Re: All Images in one Program. Need little help...
Reply #1 - Jun 1st, 2005, 7:18pm
 
how wierd.. i was talking to my friend about exactly this yesterday, but didn't think of making it because i don't like waiting :p but if you use halftones (bw only), i guess you could manage to get some results .. Smiley i'll give it a go Wink

-seltar
Re: All Images in one Program. Need little help...
Reply #2 - Jun 1st, 2005, 7:57pm
 
Ok, first of all: if you want to make a 5 by 5 pixel image and try every possible color combination for those 25 pixels, you will end up trying 255^255^255^25 possibilities (Processing returns Infinity when I tried calculating this). I recommend using far less colors (gray scale still gives 255^25 possibilities) like 2: black and white. Using only black and white gives 2^25 = 33554432 possibilities, which is still a hell of a lot for only a 5 by 5 pixel image.

I wrote some code that loops through every possible black and white 5 by 5 pixel image (which would take about 20 days to complete at 20fps):
Code:
int a = 0; // image counter
int s = 5; // image size

void setup() {
size(200, 200);
fill(0);
}

void draw() {
background(255);
for (int i = 0; i < s*s; i++) { // loop through all pixels of the image
if ((a & 1<<i) != 0) { // checks if pixel should be black or white
rect((i%s)*(width/s), (i/s)*(height/s), width/s, height/s); // draws pixel
}
}
a++; // next image
}


Hope this helps,
Koenie
Re: All Images in one Program. Need little help...
Reply #3 - Jun 2nd, 2005, 10:56am
 
i've been trying to get you're code to work with anything over 5*5 pixels, but with no luck.. it just repeats the pattern, like a grid..

-seltar
Re: All Images in one Program. Need little help...
Reply #4 - Jun 2nd, 2005, 2:42pm
 
That's correct, because 'a' will get too big. You could try storing 'a' in an array, so you could get a bigger grid, like this:

Code:
int s = 6; // image size
int a[] = new int[s*s]; // image counter

void setup() {
size(200, 200);
fill(0);
}

void draw() {
background(255);
for (int i = 0; i < a.length; i++) { // loop through all pixels
if (a[i] == 1) { // checks if pixel should be black or white
rect((i%s)*(width/s), (i/s)*(height/s), width/s, height/s); // draws pixel
}
}

// binary increment on a[]
for (int i = 0; i < a.length; i++) {
if (a[i] == 0) {a[i] = 1; break;}
else a[i] = 0;
}
}


Koenie
Re: All Images in one Program. Need little help...
Reply #5 - Jun 2nd, 2005, 4:50pm
 
An artist has been running a piece like this that looks at calculating every possible permutation of a 32*32 icon, needless to say it's undoubetdly still running.

I'll try and dig out a reference for you.

Here it is, it runs as an applet

http://iaaa.nl/cursusAA&AI/EveryIcon/

This version just does black and white which I thinks a good place to start
Re: All Images in one Program. Need little help...
Reply #6 - Jun 2nd, 2005, 7:02pm
 
The code koenie provided does exactly the same :)
You could've been famous koenie, but someone beat you to it ;)

-seltar
Re: All Images in one Program. Need little help...
Reply #7 - Jun 2nd, 2005, 10:09pm
 
I knew about this artist, but I think it's complete nonsense to do this, it doesn't make sense to try every possible 32*32 pixel combination. So even if I wrote the code before him, he'd still be famous.

The point is, did Jon learn anything here? We haven't heard from him since the start of this topic.

Koenie
Re: All Images in one Program. Need little help...
Reply #8 - Jun 3rd, 2005, 1:05pm
 
thank you all, i have tested the code of koenie, and it works well. it is very simple and good for adding own ideas. i didn't know that so much works are done to this topic, thank you for the links.

i think the main thing to do now is to reduce the numbers of images that are shown to the user. the computer have to decide if an image is an "image" or only "noise". but this is a very complex thing. on one hand AI and the other an aesthetic question.
For German speaking people: http://www.stuttgarter-schule.de/
A good Site about the Work of Max Bense in the 60s about programmable aesthetics...

At the moment i make my diploma with the topic "Automatic Design" or "Discover the Possibilities". When i am finished or there are some works to see, i post it here. The main these is: If ther is a solution for a problem, you have to look over all posibilities and "just" chose the right one.

All in the aspect of Graphicdesign, i.e. you need an arrow...
http://www.getp.de/dipl/processing%20sketches01/multiform_raster_interpolate01/applet/
it's not finished, but i think it shows the main idea.






Re: All Images in one Program. Need little help...
Reply #9 - Jun 3rd, 2005, 1:27pm
 
here an other experiment from my work:
it calculates all shapes between 2 shapes drawn by mouse (no curves,
only Polygons)

http://www.getp.de/dipl/processing%20sketches01/multiform_raster_interpolate02_input/applet/

how to use:

1. draw a shape on the grid by clicking with the mouse on the grid area. (i.e. start with three points)

2. press the first red button (if nothing happens press it again for a little longer time)

3. draw a second shape with exactly the same numbers of points

4. then press the 2nd (middle) red button.

now the script begins to interpolate all shapes between.
(note: the interpolation don't works on the grid...)

the right red button resets the script, now you can start at the beginning if you like.

(don't look at the source, it's horrible, but it works)
Re: All Images in one Program. Need little help...
Reply #10 - Aug 2nd, 2005, 6:15pm
 
hi there,
this might interest you:
http://www.scanraid.com/speakingincolour/selection

I did this in Actionscript, but I bet it would work better in Processing. It's a bit slow and clunky, because it's my first effort at programming.
best wishes,
annie
Page Index Toggle Pages: 1