Permalink
Browse files

update rotation.ml

  • Loading branch information...
1 parent 105ee0b commit 8415d21e18ead682ec215877a404f0d7e9e42951 dezyal committed Oct 17, 2012
Showing with 6 additions and 5 deletions.
  1. +3 −1 OCR/Rotation.ml
  2. +3 −4 OCR/main.ml
View
@@ -16,7 +16,9 @@ let rotate mtx w h a =
(float)x*.cos(a) -. (float)y*.sin(a))
and new_y = int_of_float(
(float)(x)*.sin(a) +. (float)y*.cos(a)) in
- new_mtx.(new_x).(new_y) <- mtx.(x).(y)
+ print_int new_x;print_string "/";print_int new_y;print_newline();
+ if (new_x > -1) then
+ new_mtx.(new_x).(new_y) <- (*mtx.(x).(y)*)0
done
done;
new_mtx
View
@@ -10,12 +10,11 @@ let main () =
pfi = Sdlvideo.surface_format su in
let w = si.Sdlvideo.w and h = si.Sdlvideo.h in
let mtx = Pretreatment.su2grey su w h in
- (*Pretreatment.dust_off mtx w h;*)
let mtx2 = Pretreatment.conv_filter_3x3 mtx w h
[|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 mtx2 w h ((3.14*.10.)/.180.) in *)
+ let mtx3 = Pretreatment.new_binarisation
+ (Pretreatment.pre_bin mtx2 w h) w h in
+ (*let mtx3 = Rotation.rotate mtx3 w h (0.0523598776)*) in
OSdl.display (Pretreatment.mtx2su mtx3 w h pfi) w h;
OSdl.wait ();
exit 0

0 comments on commit 8415d21

Please sign in to comment.