Find 8 extreme pixels to determine skewness
Show older comments
Hello,
I'm currently taking a course in Computer Vision and I'm trying to solve a problem, which thus far seems impossible.
I've taken a photo of a map, but the photo is slightly skewed. I want to draw timezones on the map, but they end up in wrong places because of this shear, thus I need to correct the position of timelines for this to work.
The original image has had small blobs removed with 'bwareaopen'. In the image 'Points I want to find' I've circled the exact pixels I want to find in red.
I'm able to draw a bounding box around the entire map using the answer on this page but this leads to the following result: Problematic image.
I want to achieve something like this. This box can be calculated with the X- and Y-positions of the pixels I've circled. If I can find the corners of the box I want immediately, that's fine as well.
Can anyone point me in the right direction to find the exact pixels I've marked?
Regards, Bas
Answers (1)
Image Analyst
on 23 Oct 2015
1 vote
Use bwconvhull().
13 Comments
Bas Dalenoord
on 23 Oct 2015
Edited: Bas Dalenoord
on 23 Oct 2015
Image Analyst
on 23 Oct 2015
Time zones should not be straight. I'm not sure how you're plotting them. Do you have the mapping toolbox? Maybe it has some tools for that.
If you need to warp your image, you can use imwarp(). See this page: http://blogs.mathworks.com/steve/2006/08/04/spatial-transformations-defining-and-applying-custom-transforms/
Bas Dalenoord
on 23 Oct 2015
Edited: Bas Dalenoord
on 23 Oct 2015
Image Analyst
on 23 Oct 2015
Who says that those pins in the corners were necessarily pushed into the map in the 100% accurate place? The bounding quadrilateral could vary depending on the angle the pins are stuck in the paper.
Bas Dalenoord
on 23 Oct 2015
Bas Dalenoord
on 26 Oct 2015
Edited: Bas Dalenoord
on 26 Oct 2015
Image Analyst
on 26 Oct 2015
Since the pins are not necessarily pushed in there accurately, and you don't have a perfect angle and aren't using a telecentric lens, then how about if you just use the bounding box? A bounding quadrilateral is not unique - there could be several that would work, but a bounding box is unique.
Bas Dalenoord
on 26 Oct 2015
Image Analyst
on 26 Oct 2015
See minboundrect() or minboundquad() in John D'Errico's suite: http://www.mathworks.com/matlabcentral/fileexchange/34767-a-suite-of-minimal-bounding-objects
Bas Dalenoord
on 26 Oct 2015
Image Analyst
on 26 Oct 2015
Well you'd have to use find() to get the coordinates of the binary image so that his functions could then work. But be careful, find() returns (rows, columns), i.e. (y,x), not (x,y).
Bas Dalenoord
on 27 Oct 2015
Bas Dalenoord
on 27 Oct 2015
Edited: Bas Dalenoord
on 27 Oct 2015
Categories
Find more on Geometric Transformation and Image Registration in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!