0

Basically,

  1. I have set a reference line at particular place of the image say at height/2
  2. I calculate the total white pixel at that line

The frame keep going continuously. Then, how can I read/get back the value of total white pixel from previous frame and current frame continuously?

Thanks.

Mzk
  • 1,102
  • 3
  • 17
  • 40
  • I don't understand your question :s, save the value to a variable ? – jlengrand Oct 19 '12 at 14:11
  • Which part is not clear? I just want to get back the value from previous frame and get current frame so that I can compute division of it. What should I do actually? This is the link http://stackoverflow.com/questions/9974239/opencv-rgb-to-gray, see the post by karlphilip. Am I suppose to do that in order to get the value previously and current value? – Mzk Oct 19 '12 at 14:24

1 Answers1

1

you need to hold a member with the prev value.
assuming readPixel() function reads the total white value, curr is the current value, and prev is the previous value. this is example pseudo-code:

prev = curr = readPixel; //avoid division by zero
for(;;)
{
    curr = readPixel();
    value = curr / prev;
    prev = curr;
}
Eran W
  • 1,696
  • 15
  • 20