Skip to content
Browse files

rotate function works

  • Loading branch information...
1 parent f17c11f commit eec19cb270085eea1488f7d4dd4739b5f3caf47e dezyal committed Oct 17, 2012
Showing with 3 additions and 3 deletions.
  1. +2 −2 OCR/Rotation.ml
  2. +1 −1 OCR/main.ml
View
4 OCR/Rotation.ml
@@ -9,7 +9,7 @@ let rotate mtx w h angle =
(float)w*.cos(a) +. (float)h*.sin(a))
and new_h = int_of_float(
(float)w*.sin(a) +. (float)h*.cos(a)) in
- let new_mtx = Array.make_matrix new_w new_h 255 in
+ let new_mtx = Array.make_matrix w h 255 in
for x = 0 to w-1 do
for y = 0 to h-1 do
if (mtx.(x).(y) == 0) then
@@ -18,7 +18,7 @@ let rotate mtx w h angle =
and new_y = int_of_float(
(float)(x)*.sin(a) +. (float)y*.cos(a)) in
print_int new_x;print_string ":";print_int new_y;print_newline();
- if (new_x > -1 && new_x < new_w && new_y > -1 && new_y < new_h) then
+ if (new_x > -1 && new_x < w-1 && new_y > -1 && new_y < h-1) then
new_mtx.(new_x).(new_y) <- 0
done
done;
View
2 OCR/main.ml
@@ -14,7 +14,7 @@ let main () =
[|2;5;2;5;20;5;2;5;2|] (1./.48.) in
let mtx3 = Pretreatment.new_binarisation
(Pretreatment.pre_bin mtx2 w h) w h in
- let mtx3 = Rotation.rotate mtx3 w h (2.) in
+ let mtx3 = Rotation.rotate mtx3 w h (-2.) in
OSdl.display (Pretreatment.mtx2su mtx3 w h pfi) w h;
OSdl.wait ();
exit 0

0 comments on commit eec19cb

Please sign in to comment.
Something went wrong with that request. Please try again.