I print out a digital image(say Img) with a colored printer. I than take the picture of the printed image, so now I have a new digital image say newImg. How can I find the four vertices of the original image(Img) in this newImg.
Show older comments
I am right now using the 'Harris Corner Detector' after dilating the image(dilation helps avoid false corners). But this method is not working. It is giving me many corners along with the actual four vertices and sometimes it is not giving me the actual corners at all. The background not necessarily black. It can be white(mostly it will be white), it can be some text or any other color but the image is easily distinguishable from the background. Also the image(Img) inside the image(newImg) is no more a rectangle after the perspective distortion that takes place while taking pictures from a camera i.e. our ROI is not a rectangle.
PS: you can add a frame around the actual image(IMG) before printing it out, and can make use of this frame while detecting.
Answers (1)
Image Analyst
on 1 Jul 2013
0 votes
How about just finding the centroid of a thresholded version of the image. Then find the perimeter with bwboundaries(). Then find the 4 coordinates that are furthest from the centroid. Should be pretty simple. Give it a try.
4 Comments
Abhay
on 2 Jul 2013
Edited: Walter Roberson
on 2 Jul 2013
Image Analyst
on 2 Jul 2013
I can't see anything from dropbox.com due to company firewall restrictions - it's one of only a very few file sharing sites that are banned. Anyway, you want the centroid of only the image within the image. So if you have a tilted rectangle (the print) sitting on a black background paper, you'd determine the value of the brightest part of the background and do
binaryImage = grayImage > backgroundIntensity;
binaryImage = imfill(binaryImage, 'holes'); % Fill rectangle.
binaryImage = bwareaopen(binaryImage, 10000); % Remove small noise.
measurements = regionprops(binaryImage, 'Centroid');
centroid = measure
Walter Roberson
on 2 Jul 2013
IA, the OP has uneven illumination on the background image, so the automatic thresholding is not evenly selecting just the inside rectangle.
Abhay
on 2 Jul 2013
Edited: Walter Roberson
on 2 Jul 2013
Categories
Find more on Image Processing and Computer Vision 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!