how to crop an image id-card only ..?

1 次查看(过去 30 天)
Malta
Malta 2013-11-11
how to crop an image id-card only ..? using regionprops.

回答(2 个)

Walter Roberson
Walter Roberson 2013-11-11
First you threshold based on brightness. regionprops() and look for the one with the largest Area. Fill the inside of the pixel boundaries for that. The result will be a mask that you can use to extract the ID card from the color image.
  5 个评论
Image Analyst
Image Analyst 2013-11-12
If by fixed you mean always in the same location, it does not matter. regionprops() will find the blobs in the binary or labeled image regardless of where they are locataed in the image, or how they are oriented.
Walter Roberson
Walter Roberson 2013-11-12
And also regardless of if they are a constant size.
What you do need to worry about is the thresholding method, if they can be different colors. You are, for example, likely to have problems with a pure black ID-card that lights up in black with black letters.

请先登录,再进行评论。


Image Analyst
Image Analyst 2013-11-11
Get a monochrome image, for example by looking for white, if the cards are always white. Then threshold and find the largest white blob. This is done in my Image Segmentation Tutorial: http://www.mathworks.com/matlabcentral/fileexchange/25157-image-segmentation-tutorial-blobsdemo
If you want to get a perfect rectangle from the blob, get the filled object and then use http://www.mathworks.com/matlabcentral/fileexchange/34767-a-suite-of-minimal-bounding-objects

类别

Help CenterFile Exchange 中查找有关 Image Segmentation and Analysis 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by