Ask Your Question

Revision history [back]

App Crashes when I try to get RGB values from cv::Mat

I I am trying to get the R,G & B values of a pixel in a cv::Mat. Here is the method to get the value of B:

int blue = img.at<cv::vec3b>(row,col)[0];

The app Crashes without any error log with EXC_BAD_Excess on the this statement.

I also tried the following method but ran into same problem:(

uchar b = frame.data[frame.channels()frame.colsy + x + 0];

I have successfully added the opencv2.framework in my project. I have added the compiler flags to compile for objective-C++and the normal conversions from cv::Mat to UIImage and vice versa are working fine.

Can any one please help me figure out the reason for this crash??

Am I not allowed to use the "Mat::at(int i0, int i1)" method in Objective-C for iOS?

OR is there any alternative method to get the R,G & B values from a cv::Mat?

click to hide/show revision 2
retagged

App Crashes when I try to get RGB values from cv::Mat

I I am trying to get the R,G & B values of a pixel in a cv::Mat. Here is the method to get the value of B:

int blue = img.at<cv::vec3b>(row,col)[0];

The app Crashes without any error log with EXC_BAD_Excess on the this statement.

I also tried the following method but ran into same problem:(

uchar b = frame.data[frame.channels()frame.colsy + x + 0];

I have successfully added the opencv2.framework in my project. I have added the compiler flags to compile for objective-C++and the normal conversions from cv::Mat to UIImage and vice versa are working fine.

Can any one please help me figure out the reason for this crash??

Am I not allowed to use the "Mat::at(int i0, int i1)" method in Objective-C for iOS?

OR is there any alternative method to get the R,G & B values from a cv::Mat?