# Revision history [back]

Scalar is a 4 element Scalar_<double> vector in OpenCV. Scalar_ has a constructor where you can pass a value of the Scalar_ type, in the case of Scalar it would be double.

So to make your own cvGet2D, you can create your Scalar like this:

Scalar scal(istribution.at<float>(x,y));


(btw. Mat::at is row first, column last. Just fyi because .at<float>(x,y) had me confused and is an error that's easily overlooked)

Scalar is a 4 element Scalar_<double> vector in OpenCV. Scalar_ has a constructor where you can pass a value of the Scalar_ type, in the case of Scalar it would be double.

So to make your own cvGet2D, you can create your Scalar like this:

Scalar scal(istribution.at<float>(x,y));
scal(distribution.at<float>(x,y));


(btw. Mat::at is row first, column last. Just fyi because .at<float>(x,y) had me confused and is an error that's easily overlooked)