[vtkusers] Some problem in using vtkImageGradient

Glen Lehmann glehmann at imaging.robarts.ca
Sun May 9 09:48:03 EDT 2004


Hello Wang,

I think that your bmpReader is assuming you have data with more than 1 
component.  Try:

bmpReader->SetNumberOfComponents(1);

before you get the out put of the reader.

Cheers,
Glen

On May 9, 2004, at 2:47 AM, wang minyou wrote:

> 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
> _______________________________________________
> This is the private VTK discussion list. Please keep messages 
> on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 2057 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20040509/228d8b71/attachment.bin>


More information about the vtkusers mailing list