Skip to content

Commit

Permalink
Radon transform is added. Hough is still broken. Canny is still produ…
Browse files Browse the repository at this point in the history
…cing thick lines.
  • Loading branch information
mudasobwa committed Oct 24, 2014
1 parent ad22fd5 commit 22a355f
Show file tree
Hide file tree
Showing 11 changed files with 880 additions and 551 deletions.
7 changes: 0 additions & 7 deletions bin/magick_canny
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,3 @@ outfile = File.basename(file).sub(/(\.\w+)$/, "-canny\\1")
Magick::Screwdrivers::canny(file, options).write(File.join File.dirname(file), outfile) {
self.quality = options.quality || 90
}

if options.hough
houghfile = File.basename(file).sub(/(\.\w+)$/, "-hough\\1")
Magick::Screwdrivers::hough(file, {:roughly => options.roughly, :logger => options.logger}).write(File.join File.dirname(file), houghfile) {
self.quality = options.quality || 90
}
end
2 changes: 1 addition & 1 deletion bin/magick_scale
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ file = ARGV.first
dir = ARGV.size == 2 ? ARGV.last : File.dirname(file)
`mkdir -p #{dir}`

Magick::Screwdrivers::scale(file, options).each { |img|
Magick::Screwdrivers::scale_fan(file, options).each { |img|
outfile = File.basename(file).sub(/(\.\w+)$/, "-#{img.rows}×#{img.columns}\\1")
img.write(File.join dir, outfile) {
self.quality = options[:quality] || 90
Expand Down
10 changes: 10 additions & 0 deletions lib/rmagick/screwdrivers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,22 @@
require "rmagick/screwdrivers/hough"
require "rmagick/screwdrivers/sobel"
require "rmagick/screwdrivers/canny"
require "rmagick/screwdrivers/radon"

module Magick
module Screwdrivers
class << self
attr_reader :options
end
@options = {
:logger => nil
}
end
class Image # monkeypatch
# (0.299 * px.red + 0.587 * px.green + 0.114 * px.blue).ceil
def at x, y
self.pixel_color(x, y).intensity
end
end

end
Loading

0 comments on commit 22a355f

Please sign in to comment.