[vtkusers] Some problem in using vtkImageGradient

wang minyou wmy1024 at hotmail.com
Sun May 9 02:47:17 EDT 2004


Hello everyone, 

I have some problem in using vtkImageGradient. According to the example in 
vtk-doc, I use vtkImageGradient to do image processing. But in runtime 
occurs some errors in vtkOutputWindow, which says:vtkImageGradient 
(019200A0): Execute: input has more than one components. The input to 
gradient should be a single component image. Think about it. If you insist 
on using a color image then run it though RGBToHSV then ExtractComponents 
to get the V components. That's probably what you want anyhow. 

But I want to get the Gradient of the grey level of the image.How can I do 
that? Has anybody
done similar work before? Please help me.
Thank you very much! 

some codes are as follow: 

vtkImageGaussianSmooth* pGaussianSmooth=vtkImageGaussianSmooth::New(); 
pGaussianSmooth->SetInput(bmpReader->GetOutput()); 
pGaussianSmooth->SetStandardDeviation(1.0); 
pGaussianSmooth->SetDimensionality(2); 
pGaussianSmooth->SetRadiusFactors(10,10,0); 

vtkImageGradient* imgGradient=vtkImageGradient::New(); 
  imgGradient->SetInput(pGaussianSmooth->GetOutput()); 
  imgGradient->SetDimensionality(2); 

vtkImageMagnitude* imgMagnitude=vtkImageMagnitude::New(); 
  imgMagnitude->SetInput(imgGradient->GetOutput());

_________________________________________________________________
享用世界上最大的电子邮件系统― MSN Hotmail。  http://www.hotmail.com  




More information about the vtkusers mailing list