0

I'm taking a 640x480 video stream so for every frame I got an array Img[480,640,3].

I used black and white filter: cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) so now Img[i][j] = X, 0 <= X <= 255. Now I need to pass through every column and apply Gaussian function for its every element (making normal distribution).

I do this by iterations:

for y in range(frameWidth):
   for x in range(frameHeight):
       normpdf(....)

But this is reeeally slow way and I can process 1 frame each 1.5 - 2 seconds what is not suitable for real-time processing. Are there any methods to do this faster?

askrav
  • 195
  • 12
  • use numpy inbuilt methods for performing this task: http://stackoverflow.com/questions/36267936/normalizing-rows-of-a-matrix-python – ZdaR Nov 14 '16 at 18:34
  • I looked at the documentation https://docs.scipy.org/doc/numpy/reference/generated/numpy.linalg.norm.html#numpy.linalg.norm and then there is no ord-argument for linalg.norm() that would be considered a Gaussian distribution. Which method should I use? – askrav Nov 14 '16 at 18:55
  • What expression then you want to apply on a single row ? kindly describe your `normpdf` method – ZdaR Nov 14 '16 at 18:59
  • normpdf is Gaussian function: [link](https://en.wikipedia.org/wiki/Normal_distribution#Probability_density_function) This way I want to find the most brightest pixel in the row. After processing all rows I'll get the most brightest line. I took normpdf function here: [link](http://stackoverflow.com/questions/12412895/calculate-probability-in-normal-distribution-given-mean-std-in-python) – askrav Nov 14 '16 at 19:22

0 Answers0