手动创建一个黑色0的图片,其中加入两个矩形,一个为像素值为100的灰色;另一个是像素值为255的白色
将图片输出为png和TXT
用连通区域算子计算出连通区域1,2,3
将连通区域输出到TXT
为了能够显示像素为1,2,3的图片,放大这些像素
输出放大后的像素图片到png
输出放大后的像素图片到TXT
#include "itkImage.h"
#include <vtkSmartPointer.h>
#include <vtkPNGWriter.h>
#include "itkScalarConnectedComponentImageFilter.h"
#include <itkImageToVTKImageFilter.h>
#include <itkVTKImageToImageFilter.h>
#include <string>
#include <iostream>
#include<vtkImageShiftScale.h>
void CreateImage(itk::Image<unsigned char, 2>* const image)
{
// Create an image with 2 connected components
itk::Image<unsigned char, 2>::IndexType start = { {0,0} };
start[0] = 0;
start[1] = 0;
itk::Image<un
本文档介绍如何使用ScalarConnectedComponentImageFilter工具处理图像,具体操作包括创建一个包含不同像素值的图像,应用连通区域算子进行分析,并将结果输出为图像和文本文件,便于观察和理解连通区域的划分。
订阅专栏 解锁全文
7889

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



