So I'm pursuing a project that requires 2 video cameras as 2 seperate inputs.  Which I am aiming to do through processing only, no JMyron, etc.. as there are more complications with using 2 webcams.
    I'm trying to create my own pixelblobs, using code from Daniel Shiffmans Learning Processing book, and adding to it.
  I want to tell the program, to find the 1st pixel that is black and the last pixel that is black and draw a gray square about 5 x 5 pixels at each of these constantly refreshing locations.  
  I then wish to have it constantly find the average of these 2 locations and draw a small red square there.  This position will be used as the 
'motion' cursor for other parts of my project.  
  My problem, is that I don't know how to tell it to read through the black pixels, and stop at the 1st one - so I can then have it draw a square here..   I'm having trouble thinking up an algorithm for it..   
  Here is the code for the basic 'simple motion detection'..  without the addition of what I need..  
  any ideas would be much appreciated - THX A BUNCH 

here is the code:
import processing.video.*;
Capture video;
//previous frame
PImage prevFrame;
//how different must a pixel be to be a motion pixel
float threshold = 100;
void setup(){
  size(320,240);
  video = new Capture(this,width,height,30);
  //Create an empty image with the same size video aperture
  prevFrame = createImage(video.width,video.height,30);//30 !? does what
}