我正在尝试打印 32 位浮点图像的像素强度。这是我正在使用的代码。图像中有两种类型的值,通过在 matlab 上的 imread 中看到它,NAN 和浮点。该程序加载图像,但在尝试运行时挂起。谁能建议我出了什么问题。谢谢你的帮助。
#include <opencv/cv.h>
#include <opencv/highgui.h>
#include <stdio.h>
#include <sys/types.h>
#include <dirent.h>
void printIplImage(const IplImage* src)
{
int row = 0,col = 0;
for(row = 0; row < src->height; row++)
{
for(col = 0; col < src->width; col++)
{
printf("%f, ", ((float*)(src->imageData + src->widthStep*row))[col]);
}
printf("\n");
}
}
int main(int argc, char** argv)
{
IplImage *t3 = cvLoadImage("divimages1.tiff",CV_LOAD_IMAGE_UNCHANGED);
printIplImage(t3);
cvReleaseImage (&t3);
return 0;
}