Method: Aspose::Cloud::Barcode::Reader#read_by_algorithm

Defined in:
lib/Barcode/reader.rb

#read_by_algorithm(symbology, algorithm) ⇒ Object

Read Barcodes by Applying Image Processing Algorithm

@param string symbology Type of barcode.
@param string barcodesCount Recognize specified count of barcodes.


144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/Barcode/reader.rb', line 144

def read_by_algorithm(symbology, algorithm)
  raise 'Symbology not provided.' if symbology.empty?
  raise 'algorithm not provided.' if algorithm.empty?

  str_uri = "#{Aspose::Cloud::Common::Product.product_uri}/barcode/#{@filename}/recognize"
  str_uri = "#{str_uri}?type=#{symbology}&BinarizationHints=#{algorithm}"

  signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
  response = RestClient.get(signed_uri, {:accept => 'application/json'})
  json = JSON.parse(response)
  json['Code'] == 200 ? json['Barcodes'] : nil
end