diff --git a/loadrunable.cpp b/loadrunable.cpp index 94c12db..a20b079 100644 --- a/loadrunable.cpp +++ b/loadrunable.cpp @@ -184,6 +184,7 @@ bool loadFITS(QString path, ImageInfoData &info, RawImage **image) int naxis; long naxes[3] = {0}; fits_get_img_param(file, 3, &imgtype, &naxis, naxes, &status); + fits_get_img_equivtype(file, &imgtype, &status); if(naxis >= 2 && naxis <= 3 && status == 0) { @@ -198,6 +199,10 @@ bool loadFITS(QString path, ImageInfoData &info, RawImage **image) fitstype = TBYTE; break; case SHORT_IMG: + cvtype = CV_16S; + fitstype = TSHORT; + break; + case USHORT_IMG: cvtype = CV_16U; fitstype = TUSHORT; break; @@ -219,6 +224,8 @@ bool loadFITS(QString path, ImageInfoData &info, RawImage **image) cv::Mat tmp(h, w, cvtype); fpixel[2] = i; fits_read_pix(file, fitstype, fpixel, size, NULL, tmp.ptr(), NULL, &status); + if(cvtype == CV_16S) + tmp.convertTo(tmp, CV_16U, 1, 32767); cvimg.push_back(tmp); }