test_mask.rb
1| require 'rubygems'
2| require_gem 'camellia'
3| include Camellia
4|
5| source=CamImage.new
6|
7|
8| source.load_pgm("resources/chess.pgm")
9| mask=CamImage.new(source.width,source.height)
10|
11|
12| mask.set!(0)
13| mask.draw_circle(mask.width/2,mask.height/2,50,255)
14| mask.fill_color(mask.width/2,mask.height/2,255)
15|
16|
17| encoded_mask=mask.encode
18| source.mask=encoded_mask
19| encoded_mask.inverse!
20| dest=CamImage.new
21| source.copy(dest)
22|
23|
24| encoded_mask.inverse!
25| source.sobel_v_abs(dest)
26| dest.save_pgm("output/ruby_chess_sobel_mask.pgm")