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 › howto merge multiple images 800x700(5) in realtime
Page Index Toggle Pages: 1
howto merge multiple images 800x700(5) in realtime (Read 961 times)
howto merge multiple images 800x700(5) in realtime
Jan 21st, 2006, 4:33pm
 
Hello people just like to know how to merge images effectively using big images at 5 to 6 maybe more in real time. These images are 800x700 jpegs.

right now im just using varitions the:

tint(255,mouseX);

function but it seems to lag or flicker as images merge or fade in fade out. So i need help on the smooth processing of the imagery in realtime.p.s. i am using the mouseX for testing values and final product will be sensors using bx-24 microcontroller also im very new to processing.

Id be gratful for any help and thank you in advance  Smiley
Re: howto merge multiple images 800x700(5) in real
Reply #1 - Jan 22nd, 2006, 12:38pm
 
I’ve figure out the problem a sort if you want to use it feel free the values you have to change are the pictures name for a quick start. Press play and use the mouse to change imagery.

The PROBLEM is if I use more than 2 set of images processing kicks up this error(Grr Sad ):

java.lang.OutOfMemoryError

Id be grateful for any help on how to get rid of this problem. Smiley

Recap of the sketch it fades images in and out of each other ,"simple”. Here is my code in its raw form(sorry I got deadline) for 2 set of images:
Re: howto merge multiple images 800x700(5) in real
Reply #2 - Jan 22nd, 2006, 12:39pm
 
float input1 = 0;
float rangea1 = 300;
float rangeb1 = 750;
float maxpercent1 = rangeb1-rangea1;
float finalpercent1 = 0;
float atint = 0;
int numFrame1 = 3;  // The number of frames in the animation
int frame1 = 0;
PImage[] images1 = new PImage[numFrame1];

float input2 = 0;
float rangea2 = 0;
float rangeb2 = 600;
float maxpercent2 = rangeb2-rangea2;
float finalpercent2 = 0;
float btint = 0;
int numFrame2 = 3;  // The number of frames in the animation
int frame2 = 0;
PImage[] images2 = new PImage[numFrame2];


void setup()
{
 size(800,640 );
 background(51) ;
 framerate(10);
 
 //set1
 images1[0]  = loadImage("redajit1.jpg");//put your own picture heres in data folder
 images1[1]  = loadImage("redajit2.jpg"); //put your own picture heres in data folder
 images1[2]  = loadImage("c.jpg");
 
 //set2
 images2[0]  = loadImage("greenajit1.jpg");
 images2[1]  = loadImage("greenajit2.jpg");
 images2[2]  = loadImage("greenbabygun.jpg");
}


void draw()
{

   background(0) ;      
   tint(255, atint);
   image(images1[frame1], 0, 0);
   
   tint(255, btint);
   image(images2[frame2], 0, 0);
   
/////////////////////////////////////////////////////////////////////////////          
//sensor 1 setup
   if(mouseX >= 0 && mouseX < 2000){
       input1 = mouseX ;
       finalpercent1 =((input1-rangea1)/(maxpercent1)*100);
      //println(finalpercent1);
      println(input1);
      //println(atint);      
/////////////////////////////////////////////////////////////////////////////      
//sensor 1 setup end
//ranges of results sensor 1
      //
       if((finalpercent1 >= 0) && (finalpercent1 < 20))
       {
       atint =((finalpercent1)/(20)*255);
       frame1 = 1;
       }
       if((finalpercent1 >= 30) && (finalpercent1 < 40))
       {
       //atint =((finalpercent1)/(20)*255);
       //frame1 = 2;
       }
       if((finalpercent1 >= 40) && (finalpercent1 < 60))
       {
       atint =((finalpercent1-40)/(20)*255);
       frame1 = 0;
       }
       if((finalpercent1 >= 60) && (finalpercent1 < 80))
       {
       atint =((finalpercent1-60)/(20)*255);
       frame1 = 2;
       }      
       if((finalpercent1 > 80)&& (finalpercent1 < 100))
       {
      frame1 = 1;
       atint =((finalpercent1-80)/(20)*255);
       }
       }
////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////          
//sensor 2 setup
       if(mouseY >= 0 && mouseY < 2000){
       input2 = mouseY ;
       finalpercent2 =((input2-rangea2)/(maxpercent2)*100);
       //println(finalpercent2);
      // println(input2);
/////////////////////////////////////////////////////////////////////////////      
//sensor 2 setup end
//ranges of results sensor 2
      //
       if((finalpercent2 >= 0) && (finalpercent2 < 20))
       {
       btint =((finalpercent2)/(20)*255);
       frame2 = 1;
       }
       if((finalpercent2 >= 20) && (finalpercent2 < 40))
       {
       btint =((finalpercent2-20)/(20)*255);
       frame2 = 2;
       }
       if((finalpercent2 >= 40) && (finalpercent2 < 60))
       {
       btint =((finalpercent2-40)/(20)*255);
       frame2 = 0;
       }
       if((finalpercent2 >= 60) && (finalpercent2 < 80))
       {
       btint =((finalpercent2-60)/(20)*255);
       frame2 = 2;
       }      
       if((finalpercent2 > 80)&& (finalpercent2 < 100))
       {
       frame2 = 1;
       btint =((finalpercent2-80)/(20)*255);
       }

       }
}//end of draw
Re: howto merge multiple images 800x700(5) in real
Reply #3 - Jan 22nd, 2006, 6:23pm
 
Ajit wrote on Jan 22nd, 2006, 12:38pm:
The PROBLEM is if I use more than 2 set of images processing kicks up this error(Grr Sad ):

java.lang.OutOfMemoryError

Id be grateful for any help on how to get rid of this problem. Smiley


You may take a look at this:
http://processing.org/faq/bugs.html#memory
Re: howto merge multiple images 800x700(5) in real
Reply #4 - Jan 23rd, 2006, 12:19am
 
Cheers Flo got It working

i need to do more tinkering with the sketch to move it to its full capaicty

Thanks for that it seems very useful Smiley
thank you thank you thank you
Page Index Toggle Pages: 1