2015-05-08 3 views
5

मैं सरल-आईटी प्रबंधित प्रबंधित डीएल का उपयोग कर .bmp छवि पर CannyEdgeDetectionImageFilter को लागू करने का प्रयास कर रहा हूं।8-बिट हस्ताक्षरित पूर्णांक का वेक्टर समर्थित नहीं है

itk.simple.Image image1= SimpleITK.ReadImage("Input.bmp"); 

ImageFileReader read = new ImageFileReader(); 
read.SetFileName("Input.bmp"); 
read.Execute(); 

CannyEdgeDetectionImageFilter canny = new CannyEdgeDetectionImageFilter(); 
itk.simple.Image image2= canny.Execute(image1);//I got below exception here. 

ImageFileWriter write = new ImageFileWriter(); 
write.SetFileName("Output.bmp"); 
write.Execute(image2,"Output.bmp", true); 

मैं CannyEdgeDetectionImageFilter निष्पादित करते समय इस अपवाद है:

यहाँ मेरी कोड है।

sitk::ERROR: Pixel type: vector of 8-bit unsigned integer is not supported in 2D byclass itk::simple::CannyEdgeDetectionImageFilter

मैं इस असमर्थित चीज़ को सरलता के लिए समर्थित कैसे कर सकता हूं?

यहां मेरे कोड में कुछ बदलाव है। मैंने 8-बिट हस्ताक्षरित पूर्णांक के वेक्टर को समर्थित में डालने की कोशिश की, लेकिन यहां मैं ऐसा करने में असफल रहा।

CastImageFilter cast = new CastImageFilter(); 
PixelIDValueEnum p= cast.GetOutputPixelType(); 
image1= SimpleITK.Cast(image1, p);//I got below exception here. 

sitk::ERROR: Filter does not support casting from casting vector of 8-bit unsigned integer to 32-bit float

कुछ और मैं इस कोड काम करने के लिए कर सकता है है?

किसी भी मदद की सराहना की जाती है।

+0

@ सोनर: थेंक्स :) – Shikha

+0

कोई समस्या नहीं। याद रखें, अच्छा स्वरूपण हमेशा आपका मित्र होता है;) –

उत्तर

0

एक आरजीबी छवि में कैनी फ़िल्टर लागू करने के कुछ तरीके हैं। (मुझे लगता है कि यह एक आरजीबी छवि है?)

बहु-घटक छवि को स्केलर छवि में परिवर्तित करने के कई तरीके हैं। एक साधारण कास्ट अच्छी तरह परिभाषित नहीं है। इसका मतलब ल्यूमिनेंस, एक वेक्टर परिमाण इत्यादि हो सकता है ...

एक विकल्प छवि के प्रत्येक चैनल पर स्वतंत्र रूप से एल्गोरिदम चलाने के लिए है और एक लाल किनारे छवि, एक नीली धार छवि और एक ग्रीन एज छवि प्राप्त करें। यहां कुछ छद्म कोड है:

for i in range(rgbimage.GetNumberOfComponentsPerPixel()): 
    component_image = sitk.VectorIndexSelectionCast(rgbimage, i, sitk.sitkFloat32) 
    edge_images[i] = sitk.CanneyEdgeDetection(component_image) 

edge_image = sitk.Compose(edge_images) 

वैकल्पिक रूप से, आप एक स्केलर एज छवि चाहते हैं। आप आरजीबी चैनलों से ल्यूमिनेंस, ब्राइटनेस या लाइटनेस प्राप्त कर सकते हैं और फिर केवल एक बार कैनी फ़िल्टर चला सकते हैं।

संबंधित मुद्दे