So, I'm a new openCV user, and I could use some help. Below is some code that I'm trying to write for a blob detection program, not using the blob.h library. My goal is to create a new mat one pixel bigger than the original mat then copy the data in to the new one so that there is one pixel lining the edge. Then I can start going through the data and not have to worry about the edges. But I'm having a problem with getting the new structure created and the data in it. Can anyone help?
Mat img_src, img_dst;
CvMat *img_onebigger;
void BlobDetection(Mat image) {
////// Number of new rows and new columns are 1/2 original
int cols = image.cols;
int rows = image.rows;
uchar* data = image.data;
int label_id = 1;
int r, c;
////// Original step size (number of values per row) of image
int step = image.step;
int current_pixel = image.data[r*step + c];
img_onebigger = cvCreateMat(rows+1, cols+1, CV_32FC1);
cvCreateData(img_onebigger);
for(r=1; r < rows; r++){
for(c=1; c<cols; c++){
img_onebigger->data[r*step+c] = image.data[r*step+c];
}
}