Skip to content

Commit

Permalink
ocropy-deskew: append 'deskewed' feature to comments even if image wa…
Browse files Browse the repository at this point in the history
…s not modified
  • Loading branch information
sulzbals authored and finkf committed May 13, 2020
1 parent 34201b6 commit a5f52d1
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions ocrd_cis/ocropy/deskew.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ def process(self):
file_id, self.page_grp, out.local_filename)

def _process_segment(self, segment, segment_image, segment_coords, segment_id, page_id, file_id):
features = segment_coords['features'] # features already applied to segment_image
angle0 = segment_coords['angle'] # deskewing (w.r.t. top image) already applied to segment_image
LOG.info("About to deskew %s", segment_id)
angle = deskew(segment_image, maxskew=self.parameter['maxskew']) # additional angle to be applied
Expand All @@ -147,7 +146,6 @@ def _process_segment(self, segment, segment_image, segment_coords, segment_id, p
segment_id, angle)
segment_image = rotate_image(segment_image, angle,
fill='background', transparency=True)
features += ',deskewed'
# update METS (add the image file):
file_path = self.workspace.save_image_file(
segment_image,
Expand All @@ -156,4 +154,5 @@ def _process_segment(self, segment, segment_image, segment_coords, segment_id, p
file_grp=self.image_grp)
# update PAGE (reference the image file):
segment.add_AlternativeImage(AlternativeImageType(
filename=file_path, comments=features))
filename=file_path,
comments=segment_coords['features'] + ',deskewed'))

0 comments on commit a5f52d1

Please sign in to comment.