Thanks first of all. I've got another question kinda related to that, but didn't want to start a new thread.
How can I read the number of channels from the camera interface? So, I got the ASI 120 CM, which means it makes color images and it's fits must hence have three dimensions. Is there a property (INDI interface or fits IO) where I can read that from. I wasn't able to find some of that kind yet.
What I alread got is below. Still missing the automated declaration of cv_type.
int cv_type;
int status=0;
int nelements=0;
char error_status[100];
int nullval=0;
int anynull;
int byte_type=0;
void* memptr;
fitsfile * fptr=NULL;
fits_open_memfile(&fptr,&(bp->blob),&(bp->bloblen),2880,realloc,&status);
if(status)
{
fits_report_error(stderr, status); /* print out any error messages */
fits_get_errstatus(status, error_status);
DEBUGF(INDI::Logger::DBG_ERROR, "FITS Error (open_memfile): %s", error_status);
return;
}
switch (cam_env.bits_per_pixel)
{
case 8:
byte_type = TBYTE;
// cv_type = CV_8UC3; //f.eks.
break;
case 16:
byte_type = TUSHORT;
break;
case 32:
byte_type = TULONG;
break;
default:
DEBUGF(Logger::DBG_WARNING, "Unsupported bits per pixel value %d\n", cam_env1.bits_per_pixel);
return;
break;
}
nelements = cam_env.pixel.area();
fits_read_img(&fptr, byte_type, 1, nelements, &nullval, memptr, &anynull, &status);
if(status)
{
fits_report_error(stderr, status); /* print out any error messages */
fits_get_errstatus(status, error_status);
DEBUGF(INDI::Logger::DBG_ERROR, "FITS Error (read_img): %s", error_status);
return;
}
img = cv::Mat(cam_env.pixel, cv_type, memptr);