《itk实用demo》-二进制 腐蚀 扩张 后再二值化

本文介绍了使用ITK库进行二进制图像处理的过程,包括腐蚀、膨胀操作及随后的二值化步骤。通过设置不同的内核实现图像的形态学变换,并最终调整阈值来优化图像效果。

二进制 腐蚀 扩张 后再二值化

 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();
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值