public static void Run() { // The path to the documents directory. string dataDir = RunExamples.GetDataDir_PSD(); //ExStart:BinarizationWithOtsuThreshold string sourceFile = dataDir + @"sample.psd"; string destName = dataDir + @"BinarizationWithOtsuThreshold_out.jpg"; // Load an image using (Image image = Image.Load(sourceFile)) { // Cast the image to RasterCachedImage and Check if image is cached RasterCachedImage rasterCachedImage = (RasterCachedImage)image; if (!rasterCachedImage.IsCached) { // Cache image if not already cached rasterCachedImage.CacheData(); } // Binarize image with Otsu Thresholding and Save the resultant image rasterCachedImage.BinarizeOtsu(); rasterCachedImage.Save(destName, new JpegOptions()); } //ExEnd:BinarizationWithOtsuThreshold }
public static void Run() { // To get proper output please apply a valid Aspose.Imaging License. You can purchase full license or get 30 day temporary license from http:// Www.aspose.com/purchase/default.aspx."); // ExStart:BinarizationWithOtsuThreshold // The path to the documents directory. string dataDir = RunExamples.GetDataDir_ModifyingAndConvertingImages(); // Load an image in an instance of Image using (Image image = Image.Load(dataDir + "aspose-logo.jpg")) { // Cast the image to RasterCachedImage RasterCachedImage rasterCachedImage = (RasterCachedImage)image; // Check if image is cached if (!rasterCachedImage.IsCached) { // Cache image if not already cached rasterCachedImage.CacheData(); } // Binarize image with Otsu Thresholding rasterCachedImage.BinarizeOtsu(); // Save the resultant image rasterCachedImage.Save(dataDir + "BinarizationWithOtsuThreshold_out.jpg"); } // ExEnd:BinarizationWithOtsuThreshold }
public static void Run() { // ExStart:BinarizationWithOtsuThreshold // The path to the documents directory. string dataDir = RunExamples.GetDataDir_ModifyingAndConvertingImages(); // Load an image in an instance of Image using (Image image = Image.Load(dataDir + "aspose-logo.jpg")) { // Cast the image to RasterCachedImage and Check if image is cached RasterCachedImage rasterCachedImage = (RasterCachedImage)image; if (!rasterCachedImage.IsCached) { // Cache image if not already cached rasterCachedImage.CacheData(); } // Binarize image with Otsu Thresholding and Save the resultant image rasterCachedImage.BinarizeOtsu(); rasterCachedImage.Save(dataDir + "BinarizationWithOtsuThreshold_out.jpg"); } // ExEnd:BinarizationWithOtsuThreshold }