0

I have a system that looks like a fairly noisy image with a single object in it that appears as a presumably Gaussian peak. I would like to write a simulator of the environment to test an algorithm, but I can't think of a clean way to add a 2 dimensional Gaussian peak to a noise frame. This is similar to what I want to do with my algorithm but my data is orders of magnitude harder to get (the event that creates the data only happens once or twice a year). If possible I would like to use OpenCV.

Fundamentally I am asking how to create a 2-d Gaussian peak in an OpenCV matrix.

Sam
  • 289
  • 1
  • 10

1 Answers1

2

You are probably looking for something like this:

int ksize = your_gaussian_size_can_be_your_noise_frame_size;
cv::Mat gaussX = cv::getGaussianKernel(ksize, -1, CV_32F);
cv::Mat gaussY = cv::getGaussianKernel(ksize, -1, CV_32F);
cv::Mat gauss2d = gaussX * gaussY.t();

@gauss2d is what you need if I get it correctly.

Cynichniy Bandera
  • 5,991
  • 2
  • 29
  • 33