Esempio n. 1
0
 def performOcr(self, engine_name=None):
     selected_engine_index = self.box_editor.getSelectedOcrEngine()
     if engine_name:
         for i in xrange(len(self.ocr_engines)):
             if self.ocr_engines[i][0].name == engine_name:
                 selected_engine_index = i
                 break
     self.box_editor.selectOcrEngine(selected_engine_index)
     image = graphics.convertPixbufToImage(self.box_editor.getImage())
     angle = self.box_editor.getAngle()
     if angle:
         image = graphics.getImageRotated(image, angle)
     if selected_engine_index != None:
         engine = self.ocr_engines[selected_engine_index][0]
         engine.setImage(image)
         text = engine.read()
         self.box_editor.setText(text)
         debug('Finished reading')
     text_size = graphics.getTextSizeFromImage(image)
     if text_size:
         y_resolution = float(self.reviewer.page.resolution[1])
         text_size /= y_resolution
         text_size *= 72.0
         self.box_editor.setFontSize(math.floor(text_size))
Esempio n. 2
0
 def performOcr(self, engine_name = None):
     selected_engine_index = self.box_editor.getSelectedOcrEngine()
     if engine_name:
         for i in xrange(len(self.ocr_engines)):
             if self.ocr_engines[i][0].name == engine_name:
                 selected_engine_index = i
                 break
     self.box_editor.selectOcrEngine(selected_engine_index)
     image = graphics.convertPixbufToImage(self.box_editor.getImage())
     angle = self.box_editor.getAngle()
     if angle:
         image = graphics.getImageRotated(image, angle)
     if selected_engine_index != None:
         engine = self.ocr_engines[selected_engine_index][0]
         engine.setImage(image)
         text = engine.read()
         self.box_editor.setText(text)
         debug('Finished reading')
     text_size = graphics.getTextSizeFromImage(image)
     if text_size:
         y_resolution = float(self.reviewer.page.resolution[1])
         text_size /= y_resolution
         text_size *= 72.0
         self.box_editor.setFontSize(math.floor(text_size))
Esempio n. 3
0
 def __pressedAngleDetectionButton(self, widget):
     image = graphics.convertPixbufToImage(self.box_editor.getImage())
     angle = graphics.getHorizontalAngleForText(image)
     debug('ANGLE: ', angle)
     self.box_editor.setAngle(angle)
Esempio n. 4
0
 def setImage(self, pixbuf):
     self.image = graphics.convertPixbufToImage(pixbuf)
     self.emit('changed_image', pixbuf)
Esempio n. 5
0
 def __pressedAngleDetectionButton(self, widget):
     image = graphics.convertPixbufToImage(self.box_editor.getImage())
     angle = graphics.getHorizontalAngleForText(image)
     debug('ANGLE: ', angle)
     self.box_editor.setAngle(angle)