I am beginning to learn OpenCV and am having a bit of trouble with some basic operations. So, I can read a video file as follows:
cv::VideoCapture cap("media.avi");
cv::Mat imgNew;
while (cap.read(imgNew)) {
}
Now, I have another function that has the following signature:
template<class T>
bool get_estimate(const T * image_data, int num_pixels)
Now, this takes the image data as this linear array of type const T
where T
in this case could be unsigned char
and the num_pixels
is the number of pixels in the image.
Can someone tell me how I can use this cv::Mat
type with this method. I am hoping there is some easy way to get the underlying array and its type without copying the data into a temporary array but I am not sure. I can always assume that the video image being read is always converted to grayscale.