so i found out how to fill this emxArray_uint8_T with unsinged char, in c++ there is the code
emxArray_uint8_T *I;
emxInit_uint8_T(&I, 3);
string imageName("F:/********amr.jpg");
Mat image;
image = imread(imageName.c_str(), IMREAD_COLOR); // Read the file
Vec3b intensity;
int sizeimage, counter;
int rows = image.rows;
int cols = image.cols;
sizeimage = rows*cols;
I->size[0] = rows;
I->size[1] = cols;
I->size[2] = 3;
emxEnsureCapacity((emxArray__common *)I, 0, (int)sizeof(unsigned char));
counter = 0;
for (int i = 0;i < cols;i++)
{
for (int j = 0;j < rows;j++)
{
intensity = image.at<Vec3b>(j, i);
uchar blue = intensity.val[0];
uchar green = intensity.val[1];
uchar red = intensity.val[2];
I->data[counter] = red;
I->data[counter + sizeimage] = green;
I->data[counter + 2* sizeimage] = blue;
counter++;
}
}
now the data is transfered from the image into the emxArray_uint8_T which u can use in your c++ code i had the same results of my function in Matlab and my c++ program.