Ask Your Question

smallbulb's profile - activity

2013-07-24 08:21:36 -0600 commented answer faster X/Y matrix creation

Perhaps some optimized/vectorized matrix OpenCV operation might get the result faster. First I tried to create vectors X = [(0, 0), (1, 0), ..., (x-1, 0)] and Y = trans([(0, 0), (0, 1), ..., (0, y-1)]), then extend them to the image resolution by border copying and then add those two matrices together which gave me the result but it was much much slower then the raw loop solution.

2013-07-24 02:48:13 -0600 commented question faster X/Y matrix creation

The whole perspective_to_maps() function takes less then 2 seconds on BeagleBone Black for a 1280x720 matrix. The shooting target project is very sensitive to short response times (shooters are very impatient people) and the camera position might be variable in the future. So I'm looking for every bit of time which might be spared.

2013-07-24 02:40:16 -0600 commented answer faster X/Y matrix creation

Parallelization will not give any more performance because it will be run on a single core ARM chip.

2013-07-23 07:43:55 -0600 asked a question faster X/Y matrix creation

Hi!

Is there more efficient way in OpenCV to create a MxN CV_32FC2 matrix than this?

  // create XY 2D array
  // (((0, 0), (1, 0), (2, 0), ...),
  //  ((0, 1), (1, 1), (2, 1), ...),
  // ...)
  cv::Mat xy(img_size, CV_32FC2);
  float *pxy = (float*)xy.data;
  for (int y = 0; y < img_size.height; y++)
    for (int x = 0; x < img_size.width; x++)
    {
      *pxy++ = x;
      *pxy++ = y;
    }

I need it as a base for cv::perspectiveTransform() (see this post). Any speedup is welcome.

Thanks.