demo地址:
https://lorensen.github.io/VTKExamples/site/Cxx/Images/CombineImages/
关键代码:
// Combine the images (blend takes multiple connections on the 0th input port)
vtkSmartPointer<vtkImageBlend> blend =
vtkSmartPointer<vtkImageBlend>::New();
blend->AddInputConnection(imgReader1->GetOutputPort());
blend->AddInputConnection(imgReader2->GetOutputPort());
blend->SetOpacity(0,.5);
blend->SetOpacity(1,.5);
将rgb图像转为灰度图像
vtkImageLuminance(将rgb图像转为灰度图像)
vtkImageExtractComponents(提取图像颜色分量,每个颜色的分量为一个灰度图)