I'm using dynamic array of IplImage type for storing some images (I would like to do the same thing with cvHistogram but get the same error) from which I need to extract histogram data. Unfortunately I'm getting the error and have no knowledge how to solve it. Any help and suggestions to do this another way would be appreciated.
This is the part of the code:
void getColorHistogram( void ){
IplImage *images = (IplImage *)malloc( sizeof(IplImage) * 6 );
if ( images == NULL )
{
printf("Memory error. EXITING...\n");
exit( -1 );
}
for (int i = 0; i < 6 ; i++ ){
char *num = (char *)malloc( sizeof(int) );
char *extension = (char *)".jpg";
sprintf( num, "%d", i );
int nameLen = strlen( num ) + strlen( extension ) + 1;
char *imgName = (char *)malloc( nameLen );
strlcpy( imgName, num, nameLen );
strlcat( imgName, extension, nameLen );
images[i] = cvLoadImage( imgName, CV_LOAD_IMAGE_UNCHANGED );
}
free( images );
}
And this is the error that I get
error: no match for ‘operator=’ in ‘images[i] = cvLoadImage
(((const char*)imgName), -0x00000000000000001)’
/opt/local/include/opencv2/core/types_c.h:463: note:
candidates are: _IplImage& _IplImage::operator=(const _IplImage&)
P.S. I'm using i<6
in loop because sizeof(images)/sizeof(images[0])
gives me 0.
Many thanks!