0

I'm looking for an efficiant way to get the posistion of all pixels that has a value bigger that let's say (100,100,100). I know I could put use minmaxLoc to get the position of the max and min but a want to add an average to it to I can get them all, and I don't want to use a while loop.

thanks in advance

Engine
  • 5,360
  • 18
  • 84
  • 162
  • What about using a for loop and testing the value of each pixel ? – Étienne Dec 13 '12 at 10:37
  • I'm thinking that threading is the only solution, because I have to call the thread from a while loop, I don't have a clue if it efficent or not !! – Engine Dec 13 '12 at 10:41
  • Also see this question, there is a quite detailed answer about the possibilities to iterate through pixel with opencv: http://stackoverflow.com/questions/4504687/cycle-through-pixels-with-opencv – Étienne Dec 13 '12 at 11:21

1 Answers1

1

You could use a pseudocode like the following:

//process the loop in a multithread way with openmp
#pragma omp parallel for    
int xy=0;
for(int x = 0; x <= x_resolution; ++x) {
  for(int y = 0; y <= y_resolution, ++y) {
    if(value of Point bigger than (100,100,100) {
      do_what_you_want;
    }
  ++xy;
  }
}
Étienne
  • 4,773
  • 2
  • 33
  • 58