DicomImage.BinarizeOtsu
Contents
[
Hide
]DicomImage.BinarizeOtsu method
Apply Otsu thresholding to binarize the image, automatically determining the optimal threshold value based on the image’s histogram. Perfect for developers seeking a reliable method to segment images into foreground and background regions with minimal manual intervention.
public override void BinarizeOtsu()
Examples
The following example binarizes a DICOM image with Otsu thresholding. Binarized images contain only 2 colors - black and white.
[C#]
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.dicom"))
{
Aspose.Imaging.FileFormats.Dicom.DicomImage dicomImage = (Aspose.Imaging.FileFormats.Dicom.DicomImage)image;
// Binarize the image with Otsu thresholding.
dicomImage.BinarizeOtsu();
dicomImage.Save(dir + "sample.BinarizeOtsu.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
See Also
- class DicomImage
- namespace Aspose.Imaging.FileFormats.Dicom
- assembly Aspose.Imaging