Module: Asposeimagingjava::ConvertingRasterImages
- Defined in:
- lib/asposeimagingjava/images/convertingrasterimages.rb
Instance Method Summary collapse
- #binarization_with_fixed_threshold ⇒ Object
- #binarization_with_otsu_threshold ⇒ Object
- #initialize ⇒ Object
- #transform_image_to_grayscale ⇒ Object
Instance Method Details
#binarization_with_fixed_threshold ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/asposeimagingjava/images/convertingrasterimages.rb', line 14 def binarization_with_fixed_threshold() data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/' # Load an existing image image = Rjb::import('com.aspose.imaging.Image').load(data_dir + "test.jpg") # Check if image is cached if !image.isCached() # Cache image if not already cached image.cacheData() end # Binarize image with predefined fixed threshold image.binarizeFixed(100) # Save the image to disk image.save(data_dir + "binarization_with_fixed_threshold.jpg") # Display Status. puts "Binarization image with Fixed Threshold successfully!" end |
#binarization_with_otsu_threshold ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/asposeimagingjava/images/convertingrasterimages.rb', line 36 def binarization_with_otsu_threshold() data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/' # Load an existing image image = Rjb::import('com.aspose.imaging.Image').load(data_dir + "test.jpg") # Check if image is cached if !image.isCached() # Cache image if not already cached image.cacheData() end # Binarize image with Otsu Thresholding image.binarizeOtsu() # Save the image to disk image.save(data_dir + "binarization_with_otsu_threshold.jpg") # Display Status. puts "Binarization image with Otsu Threshold successfully!" end |
#initialize ⇒ Object
3 4 5 6 7 8 9 10 11 12 |
# File 'lib/asposeimagingjava/images/convertingrasterimages.rb', line 3 def initialize() # Binarization with Fixed Threshold binarization_with_fixed_threshold() # Binarization with Otsu Threshold binarization_with_otsu_threshold() # Transform image to its grayscale representation transform_image_to_grayscale() end |
#transform_image_to_grayscale ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/asposeimagingjava/images/convertingrasterimages.rb', line 58 def transform_image_to_grayscale() data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/' # Load an existing image image = Rjb::import('com.aspose.imaging.Image').load(data_dir + "test.jpg") # Check if image is cached if !image.isCached() # Cache image if not already cached image.cacheData() end # Transform image to its grayscale representation image.grayscale() # Save the image to disk image.save(data_dir + "transform_image_to_grayscale.jpg") # Display Status. puts "Transform image to its grayscale representation successfully!" end |