Prepare for OCR, find words and rotate.

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
eleison
Posts: 45
Joined: 2013-12-10T15:14:46-07:00
Authentication code: 6789

Re: Prepare for OCR, find words and rotate.

Post by eleison »

Thanks so much for your answer! I've been busy with family past week, this week i'm going to put time into this project again! I will try your suggestions, and see if I can a solution.
Did you blur the image as I had originally suggested. If you do not, it will try to find each letter.
For test I used an image with just square blocks.
eleison
Posts: 45
Joined: 2013-12-10T15:14:46-07:00
Authentication code: 6789

Re: Prepare for OCR, find words and rotate.

Post by eleison »

Thank you so much for the detailed explanation! I've been so busy with other projects lately. Sorry for late reply :/

You'r method works but might be little bit too slow for me. So I wanted to try my other method I explained previous in this thread. You gave me this -> data=`compare -metric pae -subimage-search -dissimilarity-threshold 1 -similarity-threshold 0 \
out_tmp.jpg \( -size 1x1 xc:black \) null: 2>&1`
# echo "$data"

I get this error message:
compare: unrecognized option `-dissimilarity' @ error/compare.c/CompareImageCommand/556.

My other solution would be to just run your multicrop script and modify it to just return the coordinates, too use for cropping the "none blured org-image". Is that possible?

I'm now using Centos 7 with ImageMagick 6.8.9-10 Q16 x86_64.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Prepare for OCR, find words and rotate.

Post by snibgo »

Code: Select all

-dissimilarity threshold
should read

Code: Select all

-dissimilarity-threshold
(with a hyphen). See http://www.imagemagick.org/script/comma ... -threshold
snibgo's IM pages: im.snibgo.com
eleison
Posts: 45
Joined: 2013-12-10T15:14:46-07:00
Authentication code: 6789

Re: Prepare for OCR, find words and rotate.

Post by eleison »

Thanks! It was obvious, but didn't notice it. The command takes long time to finish :/, but i get correct pixel.

I came up with another method that could work for me: Step 1: use -trim and crop a fixed sized rectangle from each corner. Step 2: fill cropper area with white color then repeat step 1. Since i got quite much white space around each text-object this might work. Either I manually try to find a size for the "fixed sized rectangle" that works for my project, or maybe there is a way to determine the size of the biggest text area?
Post Reply