Sun Mon Tue Wed Thu Fri Sat 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
int vert_steps = 287; int horz_steps = 388; double p1_x = 53.5; double p1_y = 48; double p2_x = 1203.5; double p2_y = 52.5; double p3_x = 52; double p3_y = 1602.5; image source; source.open("tc4 scan.png"); image target; target.open("tc4 result.png"); target.new(vert_steps+1, horz_steps+1); double vert_dx = (p2_x - p1_x)/vert_steps; double vert_dy = (p2_y - p1_y)/vert_steps; double horz_dx = (p3_x - p1_x)/horz_steps; double horz_dy = (p3_y - p1_y)/horz_steps; int loaded_width = source.width; int loaded_height = source.height; for x from 0 to vert_steps+1 for y from 0 to horz_steps+1 { double p_x = p1_x + x * vert_dx + y * horz_dx; double p_y = p1_y + x * vert_dy + y * horz_dy; int i_x = floor(p_x + 0.5); int i_y = floor(p_y + 0.5); if ( 0 <= i_x && i_x <= loaded_width && 0 <= i_y && i_y <= loaded_height) { doublecolor col = source.getInterpolatedColour(i_x, i_y); target.setColour(x, y, col); } } |
The image shown on the right, was processed with a script executed
by MySample from a picture I took at
the end of the game. The script performs some lens correction. For
this, I had to make some slight improvements: adding the square root
function. I have worked on MySample again in the past week.