Important performance improvement: store images as BMP instead of PNG

before processing them with external tools. A sample image took 13
seconds to be stored as PNG while BMP took less than a second.
This commit is contained in:
Albert Cervera i Areny 2009-03-16 23:45:12 +01:00
parent 02241981b6
commit 4119ec747c
3 changed files with 9 additions and 3 deletions

View File

@ -81,7 +81,9 @@ class Barcode(Analyzer):
self.dotsPerMillimeterY = float( image.dotsPerMeterY() ) / 1000.0
file = TemporaryFile.create()
image.save( file, 'PNG' )
# Use BMP format instead of PNG, for performance reasons.
# BMP takes about 0.5 seconds whereas PNG takes 13.
image.save( file, 'BMP' )
command = '/home/albert/d/git/exact-image-0.5.0/objdir/frontends/bardecode'
content = self.spawn( command, file )
self.parseBardecodeOutput( content )

View File

@ -132,7 +132,9 @@ class DataMatrix(Analyzer):
self.dotsPerMillimeterY = float( image.dotsPerMeterY() ) / 1000.0
file = TemporaryFile.create()
image.save( file, 'PNG' )
# Use BMP format instead of PNG, for performance reasons.
# BMP takes about 0.5 seconds whereas PNG takes 13.
image.save( file, 'BMP' )
command = 'dmtxread'
content = self.spawn( command, '-n', '-v', file )
self.parseOutput( content )

View File

@ -167,7 +167,9 @@ class Ocr(Analyzer):
#self.boxes = self.parseTesseractOutput(txt)
# Cuneiform Steps
self.file = TemporaryFile.create( '.png' )
# Use BMP format instead of PNG, for performance reasons.
# BMP takes about 0.5 seconds whereas PNG takes 13.
self.file = TemporaryFile.create( '.bmp' )
image.save( self.file )
txt = lower( self.cuneiform() )
self.boxes = self.parseCuneiformOutput(txt)