Login  Register

Re: Counting overall pixel change

Posted by Michael Schmid on May 18, 2009; 1:57pm
URL: http://imagej.273.s1.nabble.com/Counting-overall-pixel-change-tp3692482p3692485.html

Hi Peter,

the easiest would be to convert the stack into single images  
(Image>Stack>Stack to Images) and then have a macro step though. If  
nothing else is open, you can use this macro:

for (i=1; i<nImages; i++) {
   imageCalculator("Difference create", i,i+1);
   setThreshold(1, 255);  //use (2, 255) for one level tolerance, etc.
   run("Convert to Mask");
   getRawStatistics(nPixels, mean);
   print(d2s(mean*nPixels/255, 0));
   close();
}


Michael
________________________________________________________________

On 18 May 2009, at 15:16, martenszeus wrote:

> Can anyone suggest a way to compare two images (in a stack from an  
> original
> video) and find out how many pixels are different in the second,  
> relative to
> the first? Each image is 8-bit B/W, so what I'd like to count is  
> the sum of
> exactly how many black pixels become white and vice versa from one  
> slice to
> the next.  I'm dealing with stacks of approximately 500 images, and  
> would
> like to generate an integer string from these comparisons.
> Thanks much for any help!