Class: SharpnessMeter
- Inherits:
-
Object
- Object
- SharpnessMeter
- Defined in:
- lib/focusinspector/SharpnessMeter.rb
Overview
Focus Inspector - The focus inspection and lens calibration software.
Copyright © 2012 by Chris Schlaeger <[email protected]>
This program is Open Source software; you can redistribute it and/or modify it under the terms of MIT license as shipped with this software.
Instance Method Summary collapse
-
#initialize(imageFile) ⇒ SharpnessMeter
constructor
A new instance of SharpnessMeter.
- #measure(x, y) ⇒ Object
Constructor Details
#initialize(imageFile) ⇒ SharpnessMeter
Returns a new instance of SharpnessMeter.
13 14 15 16 |
# File 'lib/focusinspector/SharpnessMeter.rb', line 13 def initialize(imageFile) @imageFile = imageFile @minSquareSize = 100 end |
Instance Method Details
#measure(x, y) ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/focusinspector/SharpnessMeter.rb', line 18 def measure(x, y) image = Magick::Image.read(@imageFile).first x, y, sqSize = findBlackSquare(image, x, y) crop = cropQuadrants(image, x, y) #ImageViewer.new(image) colorHistogram = crop.color_histogram bwHistogram = convertHistToBW(colorHistogram) calcSharpness(bwHistogram, crop) end |