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 & HelpSyntax Questions › reading the image but never displaying it
Page Index Toggle Pages: 1
reading the image but never displaying it (Read 582 times)
reading the image but never displaying it
Oct 23rd, 2007, 1:18am
 
hi
i am trying to get processing to read an image in terms of black and white and if the pixel is black / white draw something in place of that black / white pixel.
i have got to a point where i THINK it is doing that but i dont want the image to be seen behind what i am drawing.
is there any way to do this?
here is my code so far....

PImage polarfleece;
void setup (){
size (600,600);
polarfleece =loadImage("polarfleece.JPG");
image(polarfleece, 0, 0);
filter(GRAY);
filter(POSTERIZE, 2);


}  
 
void draw ()
{  
   polarfleece.loadPixels ();  
   for (int x = 0; x< polarfleece.width; x++)  
   {  
  for (int y=0; y< polarfleece.height; y++)  
  {  
 int i = (y * polarfleece.width + x);  
 if (polarfleece.pixels [i] == color(255) ) {  
ellipse (x,y,40,40) ;  
 }  
 else if (polarfleece.pixels [i] == color(256) ) {  
 }  
  }  
   }  
}

any help would be greatly appreciated
thanks
Re: reading the image but never displaying it
Reply #1 - Oct 23rd, 2007, 10:05am
 
I'm not sure i get what you want to do exactly but if you don't want to display the image simply comment or remove the line image(polarfleece, 0, 0);

This one is not neeeded to access to the pixel array (which is achieve by the loadPixel function).

Btw you can call smooth() in the setup if you want some antialiasing on the ecclipse.
Page Index Toggle Pages: 1