itk中的基本数学运算
来源:互联网 发布:2016开淘宝店晚不晚 编辑:程序博客网 时间:2024/05/01 21:14
数字图像处理的本质就是数学运算,今天我们看下itk中的有哪些基本的数学运算。
//1、加,减,乘(注意,没有除哦)#include "itkAddImageFilter.h"//加#include "itkSubtractImageFilter.h"//减#include "itkMultiplyImageFilter.h"//乘typedef itk::AddImageFilter <ImageType, ImageType >mathFilterType;mathFilterType::Pointer mathFilter= mathFilterType::New ();mathFilter->SetInput1(input1);mathFilter->SetInput2(input2);mathFilter->Update();typedef itk::SubtractImageFilter <ImageType, ImageType >mathFilterType;mathFilterType::Pointer mathFilter= mathFilterType::New ();mathFilter->SetInput1(input1);mathFilter->SetInput2(input2);mathFilter->Update();typedef itk::MultiplyImageFilter <ImageType, ImageType >mathFilterType;mathFilterType::Pointer mathFilter= mathFilterType::New ();mathFilter->SetInput1(input1);mathFilter->SetInput2(input2);mathFilter->Update();//2、与,或,非#include "itkAndImageFilter.h"//与#include "itkOrImageFilter.h"//或#include "itkBinaryNotImageFilter.h"//非typedef itk::AndImageFilter <ImageType, ImageType >mathFilterType;mathFilterType::Pointer mathFilter= mathFilterType::New ();mathFilter->SetInput1(input1);mathFilter->SetInput2(input2);mathFilter->Update();typedef itk::OrImageFilter <ImageType, ImageType >mathFilterType;mathFilterType::Pointer mathFilter= mathFilterType::New ();mathFilter->SetInput1(input1);mathFilter->SetInput2(input2);mathFilter->Update();typedef itk::BinaryNotImageFilter <ImageType> mathFilterType; mathFilterType::Pointer mathFilter = mathFilterType::New();mathFilter ->SetInput(input1);mathFilter ->Update();//3、膨胀,腐蚀,开,闭#include "itkBinaryBallStructuringElement.h"//基本球形#include "itkBinaryMorphologicalOpeningImageFilter.h"//开运算#include "itkBinaryMorphologicalClosingImageFilter.h"//闭运算#include "itkGrayscaleErodeImageFilter.h"//灰度膨胀#include "itkGrayscaleDilateImageFilter.h"//灰度膨胀#include "itkBinaryDilateImageFilter.h"//二值膨胀#include "itkBinaryErodeImageFilter.h"//二值膨胀typedef itk::BinaryBallStructuringElement<ImageType::PixelType, ImageType::ImageDimension>StructuringElementType;StructuringElementType structuringElement;structuringElement.SetRadius(rad);structuringElement.CreateStructuringElement();typedef itk::BinaryMorphologicalOpeningImageFilter <ImageType, ImageType, StructuringElementType> BinaryMorphologicalOpeningImageFilterType;BinaryMorphologicalOpeningImageFilterType::Pointer mathOperationFilter= BinaryMorphologicalOpeningImageFilterType::New();mathOperationFilter->SetInput(*input);mathOperationFilter->SetKernel(structuringElement);mathOperationFilter->Update();typedef itk::BinaryMorphologicalClosingImageFilter <ImageType, ImageType, StructuringElementType>BinaryMorphologicalClosingImageFilterType;BinaryMorphologicalClosingImageFilterType::Pointer mathOperationFilter= BinaryMorphologicalClosingImageFilterType::New();mathOperationFilter->SetInput(*input);mathOperationFilter->SetKernel(structuringElement);mathOperationFilter->Update();typedef itk::GrayscaleErodeImageFilter <ImageType, ImageType, StructuringElementType>GrayscaleErodeImageFilterType;GrayscaleErodeImageFilterType::Pointer mathOperationFilter = GrayscaleErodeImageFilterType::New();mathOperationFilter->SetInput(*input);mathOperationFilter->SetKernel(structuringElement);mathOperationFilter->Update();typedef itk::GrayscaleDilateImageFilter <ImageType, ImageType, StructuringElementType>GrayscaleDilateImageFilterType;GrayscaleDilateImageFilterType::Pointer mathOperationFilter = GrayscaleDilateImageFilterType::New();mathOperationFilter->SetInput(*input);mathOperationFilter->SetKernel(structuringElement);mathOperationFilter->Update();typedef itk::BinaryErodeImageFilter <ImageType, ImageType, StructuringElementType>BinaryErodeImageFilter ;BinaryErodeImageFilter ::Pointer mathOperationFilter = BinaryErodeImageFilter ::New();mathOperationFilter->SetInput(*input);mathOperationFilter->SetKernel(structuringElement);mathOperationFilter->Update();typedef itk::BinaryDilateImageFilter <ImageType, ImageType, StructuringElementType>BinaryDilateImageFilter ;BinaryDilateImageFilter ::Pointer mathOperationFilter = BinaryDilateImageFilter ::New();mathOperationFilter->SetInput(*input);mathOperationFilter->SetKernel(structuringElement);mathOperationFilter->Update();typedef itk::BinaryErodeImageFilter <ImageType, ImageType, StructuringElementType>BinaryErodeImageFilter ;BinaryErodeImageFilter ::Pointer mathOperationFilter = BinaryErodeImageFilter ::New();mathOperationFilter->SetInput(*input);mathOperationFilter->SetKernel(structuringElement);mathOperationFilter->SetBackgroundValue(0);mathOperationFilter->SetForegroundValue(1);mathOperationFilter->Update();typedef itk::BinaryDilateImageFilter <ImageType, ImageType, StructuringElementType>BinaryDilateImageFilter ;BinaryDilateImageFilter ::Pointer mathOperationFilter = BinaryDilateImageFilter ::New();mathOperationFilter->SetInput(*input);mathOperationFilter->SetKernel(structuringElement);mathOperationFilter->SetBackgroundValue(0);mathOperationFilter->SetForegroundValue(1);mathOperationFilter->Update();
Σ( ° △ °|||)︴,代码写的多了,文采果然越来越烂,除了注释,居然不知道写些什么。这样下去不是办法,我会尽力从最简单的写起。
阅读全文
0 0
- itk中的基本数学运算
- itk中的基本图像操作
- shell中的数学运算
- shell中的数学运算
- UnityMathf中的数学运算
- shell中的数学运算
- shell中的数学运算
- php数学运算基本语法
- 第三章 基本数学运算
- Unity中的数学运算总结
- Java中的一些数学运算
- shell脚本中的数学运算
- 浅谈java中的数学运算
- shell中的基本运算
- swift中的基本运算
- itk中的图像归一化
- itk中的Sobel算子
- itk中的Cos变换
- Python遍历文件夹和读写文件的方法
- Markdown编辑器写博客
- vim--简单设置
- [李景山php] swoole 之 定时器
- 关于PO文本不支持多语言维护问题
- itk中的基本数学运算
- Picasso源码完全解析(六)--请求的取消、暂停、和恢复
- a font package is…
- form表单上传参数发生400错误
- SE75 采购申请创建抬头文本
- Eclipse没有了自动提示功能
- 文本相关的几个表和程序
- 强制邮箱大写
- smartforms 翻译 SE63