I want to create an array of matrices for segment the image.
Here is what I do for creating array, and it shows an error of "EXC_I386_GPFLT".
How can I fix it or What should I do to achieve my purpose?
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "iostream"
using namespace cv;
using namespace std;
int main( )
{
Mat img;
img = imread("/Users/koike1979/Documents/0306/trucka.bmp", CV_LOAD_IMAGE_COLOR);
namedWindow( "Original image", CV_WINDOW_AUTOSIZE );
imshow( "Original image", img );
Mat H[2]= {Mat(20,20,CV_8UC1),Mat(20,20,CV_8UC1)};
for (int i=0; i<200; i++)
for (int j=0; j<200; j++)
{
Vec3b intensity2 = img.at<Vec3b>(i ,j);
int blue = intensity2.val[0];
int green = intensity2.val[1];
int red = intensity2.val[2];
H[0].at<uchar>(i,j)=(blue+green+red)/3;
}
namedWindow( "Modify pixel", CV_WINDOW_AUTOSIZE );
imshow( "Modify pixel", H[0] );
waitKey(0);
return 0;
}