Skip to content

Commit

Permalink
use old method for Region.text()
Browse files Browse the repository at this point in the history
  • Loading branch information
vgod committed Sep 23, 2011
1 parent 9544561 commit 7ee6980
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 3 additions & 3 deletions sikuli-script/src/main/native/vision.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,10 +406,10 @@ Vision::findChanges(FindInput input){

string
Vision::recognize(Mat image){
return OCR::recognize_as_string(image);
//return OCR::recognize_as_string(image);
// old method
//OCRText text = OCR::recognize(image);
//return text.getString();
OCRText text = OCR::recognize(image);
return text.getString();
}

string
Expand Down
8 changes: 5 additions & 3 deletions sikuli-script/src/test/java/org/sikuli/script/OCRTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,12 @@ protected float testOcrSuite(String suite, Stat accum) throws IOException{
BufferedImage img = ImageIO.read(new File("test-res/OCR/" + suite + ".png"));
List<OCRTruth> truth = readGroundTruth("test-res/OCR/" + suite + ".csv");
int correct = 0, total = 0;
int margin = 4;
for(OCRTruth t : truth){
BufferedImage text_img = img.getSubimage(t.x, t.y, t.w, t.h);
BufferedImage text_img = img.getSubimage(
t.x-margin, t.y-margin, t.w+margin*2+1, t.h+margin*2+1);
Screen scr = createMockScreen(text_img);
String recognized_text = scr.text().trim();
String recognized_text = scr.text();
if(t.text.equals(recognized_text))
correct++;
else{
Expand Down Expand Up @@ -109,7 +111,7 @@ protected float[] testListTextOnSuite(String suite, Stat accum) throws IOExcepti
@Test
public void testAllOCR() throws Exception {

float accuracy[] = {164/348f, 126/177f, 201/325f, 153/236f, 77/133f, 82/112f};
float accuracy[] = {202/348f, 109/177f, 221/325f, 132/236f, 80/133f, 57/112f};
int i = 0, correct = 0, total = 0;
Stat accum = new Stat();
for(String suite : _suites){
Expand Down

0 comments on commit 7ee6980

Please sign in to comment.