[vtkusers] Color compositions
Jordi Inglada
jordi.inglada at cnes.fr
Wed Mar 21 13:49:38 EST 2001
Hi all,
Is there an easy way to create an RGB (and/or HSV) image from 3 grey-scale
images?
By now, I have done this:
sum2 = vtkImageMathematics::New();
sum1 = vtkImageMathematics::New();
R = vtkImageConstantPad::New();
G = vtkImageExtractComponents::New();
B = vtkImageExtractComponents::New();
R->SetInput(input1);
R->SetOutputNumberOfScalarComponents(3);
R->SetConstant(0);
vtkImageConstantPad* padG = vtkImageConstantPad::New();
padG->SetInput(input2);
padG->SetOutputNumberOfScalarComponents(3);
padG->SetConstant(0);
G->SetInput(padG->GetOutput());
G->SetComponents(1,0,2);
vtkImageConstantPad* padB = vtkImageConstantPad::New();
padB->SetInput(input3);
padB->SetOutputNumberOfScalarComponents(3);
padB->SetConstant(0);
B->SetInput(padB->GetOutput());
B->SetComponents(1,2,0);
sum1->SetInput2(G->GetOutput());
sum1->SetOperationToAdd();
sum2->SetInput1(sum1->GetOutput());
sum2->SetInput2(B->GetOutput());
sum2->SetOperationToAdd();
return sum2->GetOutput();
But I guess there must be an easier way. I have found the classes
vtkImageRGBToHSV and its inverse, but my problem is building a 3-channel
image from 3 1-channel images. From there I can use these classes for
colorspace transformations.
Thanks.
--
Jordi Inglada
CNES - Centre Spatial de Toulouse
DSO/OT/QTIS/SR - BPI 811
18, avenue Edouard Belin
31401 Toulouse Cedex 04 - France
Tel. +33.(0)5.61.27.33.97 - Fax. +33.(0)5.61.28.31.09
GSM: +33.(0)6.89.32.92.94
More information about the vtkusers
mailing list