Skip to content

Commit

Permalink
Reconfigure Issue #3
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamalpaneru committed Oct 8, 2017
2 parents e31785b + a4339a1 commit ac72213
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/xtractor/xtract.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def start(img)
columns_filter(img)[0..-2].each_with_index do |column, j|
x,y= column[1], row[1]
w,h= columns_filter(img)[j+1][0]-x, rows_filter(img)[i+1][0]-y
puts "#{j}x#{i}"

Magick::Image.constitute(w, h, "RGB", img.get_pixels(x,y,w,h).map{ |pixel|
[pixel.red, pixel.green, pixel.blue]}.flatten).write("cell-files/#{j}x#{i}.jpg") do |out|
out.depth=8
Expand All @@ -100,7 +100,7 @@ def collect_hash(img)
def out_final(img)
output_file = File.open('table.tsv', 'w')
rows_filter(img)[0..-2].each_with_index do |row, i|
text_row = []
text_row = []
columns_filter(img)[0..-2].each_with_index do |column, j|
text_row << File.open("cell-files/#{j}x#{i}.txt", 'r').readlines.map{|line| line.strip}.join(" ")
end
Expand Down

0 comments on commit ac72213

Please sign in to comment.