Browse files

to merge

  • Loading branch information...
1 parent 3479180 commit c1d2fee4f24a47272355d15c6a2ed03fb8c6462c antoine froger committed Dec 9, 2012
Showing with 146 additions and 123 deletions.
  1. +2 −2 Interface/ocr_gui.ml
  2. +2 −2 OCR/Makefile
  3. +142 −119 OCR/ocr_gui.ml
View
4 Interface/ocr_gui.ml
@@ -44,7 +44,7 @@ Froger Antoine (<froger_a@epita.fr>)
Gibert Charles (<gibert_c@epita.fr>)"]
~copyright:"Copyright © 2012-2013 Colibri"
~version:" colibri 1.0"
- ~website:"site elie ici"
+ ~website:"http://colibri.symbiogears.com"
~position:`CENTER_ON_PARENT
~parent:window
~destroy_with_parent:true () in
@@ -89,4 +89,4 @@ let _ =
window#show();
GMain.main()
-
+
View
4 OCR/Makefile
@@ -1,9 +1,9 @@
LIB = ocamlopt -I +sdl -I +lablgtk2
DPDC = sdl.cmxa sdlloader.cmxa bigarray.cmxa lablgtk.cmxa
-MOD = Tools.ml Pretreatment.ml OSdl.ml Rotation.ml Binarisation.ml Main.ml
+MOD = Tools.ml Pretreatment.ml OSdl.ml Rotation.ml Binarisation.ml Main.ml ocr_gui.ml
EXE:
- $(LIB) $(DPDC) -o Colibri $(MOD) ocr_gui.ml
+ $(LIB) $(DPDC) -o Colibri $(MOD)
Clean :
rm *.cm* *.o Colibri
View
261 OCR/ocr_gui.ml
@@ -1,119 +1,142 @@
-let _ = GMain.init()
-
-(* Fenêtre principale de l'application. *)
-let window = GWindow.window
- ~title:"Colibri"
- ~position:`CENTER
- ~height:600
- ~width:800 ()
-
-let box = GPack.vbox
- ~spacing:2
- ~border_width:10
- ~packing:window#add ()
-
-(* Toolbar *)
-let toolbar = GButton.toolbar
- ~orientation:`HORIZONTAL
- ~style:`ICONS
- ~packing:(box#pack ~expand:false) ()
-
-(* Parcourir *)
-let btn = GFile.chooser_button
- ~action:`OPEN
- ~packing:(box#pack ~expand:false) ()
-
-let get_contents = function (* str_op -> str *)
- | Some x -> x
- | _ -> raise Not_found
-
-
-let data = [`T "Extraire le texte"; `S; `B `SAVE; `S; `B `CUT; `B `COPY; `B `PASTE; `S;]
-
-let btn1 = GButton.tool_button
- ~label:"Extraire le texte"
- ~packing:toolbar#insert ()
-
-let _ =
- let packing = toolbar#insert in
- List.iter (function
- | `S -> ignore (GButton.separator_tool_item ~packing ())
- | `B stock -> ignore (GButton.tool_button ~stock ~packing ())
- | _ -> ()
- ) data
-
-let _ =
- begin
- ignore btn1;
- btn1#connect#clicked
-(function _ -> Main.main (get_contents (btn#filename)))
- end
-
-let item = GButton.tool_item
- ~packing:toolbar#insert ()
-
-let about_button =
- let dlg = GWindow.about_dialog
- ~authors:
- ["Les Greens :
-
-Abisaad Elie (<abisaa_e@epita.fr>)
-Dos Santos Johan (<dossan_j@epita.fr>)
-Froger Antoine (<froger_a@epita.fr>)
-Gibert Charles (<gibert_c@epita.fr>)"]
- ~copyright:"Copyright © 2012-2013 Colibri"
- ~version:" version 1.0"
- ~website:"site elie ici"
- ~position:`CENTER_ON_PARENT
- ~parent:window
- ~destroy_with_parent:true () in
- let btn = GButton.button ~stock:`ABOUT ~packing:item#add () in
- GMisc.image ~stock:`ABOUT ~packing:btn#set_image ();
- btn#connect#clicked (fun () -> ignore (dlg#run ()); dlg#misc#hide ());
- btn
-
-(* Boutons presentation *)
-let bbox = GPack.button_box `HORIZONTAL
- ~layout:`EDGE
- ~packing:box#pack ()
-
-let binarisation = GButton.button ~label:"binarisation" ~packing:bbox#add ()
-let rotation = GButton.button ~label:"rotation" ~packing:bbox#add ()
-let rlsa = GButton.button ~label:"rlsa" ~packing:bbox#add ()
-let extraction = GButton.button ~label:"extraction" ~packing:bbox#add ()
-
-
-(* Textbox *)
-let txt_frame = GBin.aspect_frame
- ~label:"Texte"
- ~packing:box#add ()
-let entry = GEdit.entry
- ~text: ""
- ~packing: txt_frame#add
- ()
-
-(* Image Preview *)
-let img_frame = GBin.aspect_frame
- ~label:"Image"
- ~packing:box#add ()
-
-let image = GMisc.image
- ~packing:img_frame#add ()
-
-(* Events *)
-
-let _ =
- binarisation#connect#clicked (fun _ -> image#set_file "bin.bmp");
- rotation#connect#clicked (fun _ -> image#set_file "rot.bmp");
- rlsa#connect#clicked (fun _ -> image#set_file "rlsa.bmp");
- extraction#connect#clicked (fun _ -> image#set_file "extraction.bmp")
-
-let _ =
- btn#connect#selection_changed ~callback:(
- fun _ -> image#set_file(get_contents btn#filename);
- entry#set_text("Texte extrait à partir de l'image.")
- );
- window#connect#destroy ~callback:GMain.quit;
-
- window#show();
- GMain.main()
+let _ = GMain.init()
+
+(* Fenêtre principale de l'application. *)
+let window = GWindow.window
+ ~title:"Colibri"
+ ~position:`CENTER
+ ~height:600
+ ~width:800
+ ~resizable:true ()
+
+let box = GPack.vbox
+ ~spacing:2
+ ~border_width:10
+ ~packing:window#add ()
+
+(* Toolbar *)
+let toolbar = GButton.toolbar
+ ~orientation:`HORIZONTAL
+ ~style:`ICONS
+ ~packing:(box#pack ~expand:false) ()
+
+(* Parcourir *)
+let btn = GFile.chooser_button
+ ~action:`OPEN
+ ~packing:(box#pack ~expand:false) ()
+
+let get_contents = function (* str_op -> str *)
+ | Some x -> x
+ | _ -> raise Not_found
+
+let btn1 = GButton.tool_button
+ ~label:"Extraire le texte"
+ ~packing:toolbar#insert ()
+
+let _ = GButton.separator_tool_item ~packing:toolbar#insert ()
+
+let save = GButton.tool_button
+ ~stock:`SAVE
+ ~packing:toolbar#insert ()
+
+let copy = GButton.tool_button
+ ~stock:`COPY
+ ~packing:toolbar#insert ()
+
+let paste = GButton.tool_button
+ ~stock:`PASTE
+ ~packing:toolbar#insert ()
+
+let _ = GButton.separator_tool_item ~packing:toolbar#insert ()
+
+(*let _ =
+ begin
+ ignore btn1#connect#clicked
+(function _ -> Main.main (get_contents (btn#filename)))
+ end
+*)
+let item = GButton.tool_item
+ ~packing:toolbar#insert ()
+
+let about_button =
+ let dlg = GWindow.about_dialog
+ ~authors:
+ ["Les Greens :
+
+Abisaad Elie (<abisaa_e@epita.fr>)
+Dos Santos Johan (<dossan_j@epita.fr>)
+Froger Antoine (<froger_a@epita.fr>)
+Gibert Charles (<gibert_c@epita.fr>)"]
+ ~copyright:"Copyright © 2012-2013 Colibri"
+ ~version:" version 1.0"
+ ~website:"site elie ici"
+ ~position:`CENTER_ON_PARENT
+ ~parent:window
+ ~destroy_with_parent:true () in
+ let btn = GButton.button ~stock:`ABOUT ~packing:item#add () in
+ GMisc.image ~stock:`ABOUT ~packing:btn#set_image ();
+ btn#connect#clicked (fun () -> ignore (dlg#run ()); dlg#misc#hide ());
+ btn
+
+(* Boutons presentation *)
+let bbox = GPack.button_box `HORIZONTAL
+ ~layout:`EDGE
+ ~packing:box#pack ()
+
+let binarisation = GButton.button ~label:"binarisation" ~packing:bbox#add ()
+let rotation = GButton.button ~label:"rotation" ~packing:bbox#add ()
+let rlsa = GButton.button ~label:"rlsa" ~packing:bbox#add ()
+let extraction = GButton.button ~label:"extraction" ~packing:bbox#add ()
+
+(* correction orthographique*)
+let correctbutton = GButton.button ~label:"Corriger" ~packing:bbox#add ()
+
+
+(* Textbox *)
+let hbox = GPack.hbox
+ ~spacing:2
+ ~packing:box#add ()
+
+let img_frame = GBin.aspect_frame
+ ~label:"Image"
+ ~packing:hbox#add ()
+
+let txt_frame = GBin.aspect_frame
+ ~label:"Texte"
+ ~packing:hbox#add ()
+
+let scroll = GBin.scrolled_window
+ ~hpolicy:`ALWAYS
+ ~vpolicy:`ALWAYS
+ ~packing:txt_frame#add ()
+
+let texte = GText.view
+ ~packing:scroll#add ()
+
+(* Image Preview *)
+
+let image = GMisc.image
+ ~packing:img_frame#add ()
+
+
+let spell = GSpell.view
+ ~packing:scroll#add ()
+
+(* Events *)
+
+let _ =
+ (*save#connect#clicked (fun _ -> let stg = entry#get_text in(* fonction de sauvegarde ici *))*)
+ binarisation#connect#clicked (fun _ -> image#set_file "bin.bmp");
+ rotation#connect#clicked (fun _ -> image#set_file "rot.bmp");
+ rlsa#connect#clicked (fun _ -> image#set_file "rlsa.bmp");
+ extraction#connect#clicked (fun _ -> image#set_file "extraction.bmp");
+ correctbutton#connect#clicked (fun _ -> () )
+
+let _ =
+ btn#connect#selection_changed ~callback:(
+ fun _ -> image#set_file(get_contents btn#filename)
+ );
+ window#connect#destroy ~callback:GMain.quit;
+
+ window#show();
+ window#maximize();
+ GMain.main()

0 comments on commit c1d2fee

Please sign in to comment.