Hi,
I have several maps (tif format ) with a slight rotation or scaling differences coming from a scanning operation (see below).
I would like to crop the white borders, resize/align to specific image size.
I checked several forum using the -trim option but seams does not work for my case.
The option of pick control points is too tedious to do for all the 500 maps.
I'm using ImageMagick 6.6.9-7 under Ubuntu 12.04
Any suggestions ?
Best
cat border resize resize/align
-
- Posts: 2
- Joined: 2014-10-09T07:06:45-07:00
- Authentication code: 6789
cat border resize resize/align
Last edited by el_selvaje on 2014-10-10T12:23:09-07:00, edited 3 times in total.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: cat border resize resize/align
Please fix your images. They do not show up here. Also please always identify your version of IM and platform.
To post images, you need to upload them to some free hosting service such as dropbox.com and put the URLs here.
To post images, you need to upload them to some free hosting service such as dropbox.com and put the URLs here.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: cat border resize resize/align
I don't understand exactly what you want.
I have (Windows BAT) scripts for aligning images with each other, by scale/rotate/translate. They may or may not be helpful.
I have (Windows BAT) scripts for aligning images with each other, by scale/rotate/translate. They may or may not be helpful.
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: cat border resize resize/align
If you can remove the text at the top and/or bottom of your images, you can try to use the IM -deskew function. Alternately, after removing the text, you can try my script, unrotate at the link below.
Another possibility is to use -hough-lines, to do straight line detection. Then from the end points reported, you could compute the angle of the lines. Then rotate so as to make line orientations horizontal and vertical.
Another possibility is to use -hough-lines, to do straight line detection. Then from the end points reported, you could compute the angle of the lines. Then rotate so as to make line orientations horizontal and vertical.
-
- Posts: 2
- Joined: 2014-10-09T07:06:45-07:00
- Authentication code: 6789
Re: cat border resize resize/align
Thanks
for the kind replays.
After have been manually cat the text i was able to rotate and cat in automatic the two images with this commands.
Now the images have the same size (820x820), but the are slightly distorted (due to the scanning process), so they do not overlap perfectly.
The results are belows.
So my next step is to find a way to align them in such a way that the can be overlapped.
The best solution would be to take one as a reference image and registered the second one.
I know that this operation can be done with control points but i would avoid this due to high number of images.
Any suggestions?
Best
for the kind replays.
After have been manually cat the text i was able to rotate and cat in automatic the two images with this commands.
Code: Select all
for file in scan*.png ; do
convert -deskew 40% $file rot_$file
/tmp/unrotate -a 0 -f 40 -c 1,1 rot_$file crop_$file
convert -liquid-rescale 820x820\! crop_$file res_$file
done
The results are belows.
So my next step is to find a way to align them in such a way that the can be overlapped.
The best solution would be to take one as a reference image and registered the second one.
I know that this operation can be done with control points but i would avoid this due to high number of images.
Any suggestions?
Best
-
- Posts: 59
- Joined: 2009-01-30T03:46:08-07:00
Re: cat border resize resize/align
you might need to look at using openCV for this kind of thing. There's loads of tutorials out there for detecting grids/shapes/lines and then to transform them is one line of code