Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

asked 2017-02-23 01:14:26 -0600

Nbb gravatar image

how to access matrix with unknown number of channels ?

suppose i have this matrix

int nbChannels=48;
cv::Mat image2(cv::Size(480,640), CV_32FC(nbChannels))

i can access it this way i think

cv::Vec<float,48> data = image2.at<cv::Vec<float, 48> >(row,col)

but how do i access a certain row,col IF i am unaware of the number of channels it has ?

int channels = image2.channels();
cv::Vec<float,channels > data = image2.at<cv::Vec<float, channels > >(row,col)