二进制 腐蚀 扩张 后再二值化
typedef itk::BinaryErodeImageFilter <ImageType, ImageType, StructuringElementType>
BinaryErodeImageFilterType;
BinaryErodeImageFilterType::Pointer erodeFilter = BinaryErodeImageFilterType::New();
erodeFilter->SetInput(Thresholdfilter->GetOutput());
erodeFilter->SetKernel(structuringElement);
typedef itk::BinaryDilateImageFilter <ImageType, ImageType, StructuringElementType>
BinaryDilateImageFilterType;
BinaryDilateImageFilterType::Pointer dilateFilter= BinaryDilateImageFilterType::New();
dilateFilter->SetInput(Thresholdfilter->GetOutput());
dilateFilter->SetKernel(structuringElement);
typedef itk::BinaryThresholdImageFilter<ImageType, ImageType> FilterType;
FilterType::Pointer Thresholdfilter2 = FilterType::New();
Thresholdfilter2->SetInput(erodeFilter->GetOutput());
Thresholdfilter2->SetLowerThreshold(32767);//
Thresholdfilter2->SetUpperThreshold(32767);//
Thresholdfilter2->SetOutsideValue(0);//
Thresholdfilter2->SetInsideValue(1);//
Thresholdfilter2->Update();
本文介绍了使用ITK库进行二进制图像处理的过程,包括腐蚀、膨胀操作及随后的二值化步骤。通过设置不同的内核实现图像的形态学变换,并最终调整阈值来优化图像效果。
543

被折叠的 条评论
为什么被折叠?



