我正在尝试使用 Simple-itk 托管 dll 在 .bmp 图像上应用 CannyEdgeDetectionImageFilter。
这是我的代码:
itk.simple.Image image1= SimpleITK.ReadImage("Input.bmp");
ImageFileReader read = new ImageFileReader();
read.SetFileName("Input.bmp");
read.Execute();
CannyEdgeDetectionImageFilter canny = new CannyEdgeDetectionImageFilter();
itk.simple.Image image2= canny.Execute(image1);//I got below exception here.
ImageFileWriter write = new ImageFileWriter();
write.SetFileName("Output.bmp");
write.Execute(image2,"Output.bmp", true);
我在执行 CannyEdgeDetectionImageFilter 时遇到了这个异常。
sitk::ERROR: 像素类型: 2D byclass itk::simple::CannyEdgeDetectionImageFilter 不支持 8 位无符号整数向量
如何将这个不受支持的东西转换为 simpleitk 支持?
这是我的代码的一些补充。我试图将 8 位无符号整数向量转换为支持的向量,但在这里我没有做到这一点。
CastImageFilter cast = new CastImageFilter();
PixelIDValueEnum p= cast.GetOutputPixelType();
image1= SimpleITK.Cast(image1, p);//I got below exception here.
sitk::ERROR:过滤器不支持从 8 位无符号整数的转换向量转换为 32 位浮点数
我还能做些什么来处理这段代码吗?
任何帮助表示赞赏。