Ask Your Question

How to detect scaled ID card rectangle

asked 2015-02-21 08:24:41 -0500

essamzaky gravatar image

I have application which will read the ID crad , the nature of the image is that the card is scaled and shifted location now how I get the card rectangle and scale it to the fixed defined rectangle , a sample of card images attached

the input image is scaled by 130%

image description

The required image , the card rectangle and scaled to the original size image description

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2015-02-21 09:22:29 -0500

theodore gravatar image

updated 2015-02-21 09:24:11 -0500

My process would be:

  1. find external contour
  2. obtain bounding box of the contour --> rectangle
  3. pass rectangle/ROI to another Mat
  4. resize new Mat to desired size/dimensions
edit flag offensive delete link more



And to add to this a bounding rectangle of a contour will be a rotated rect, so you could first rotate it back to the best orientation before resizing.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-02-21 10:22:12 -0500 )edit

Thanks @theodore , @StevenPuttemans , I will test in my real data set and back to you with the result

essamzaky gravatar imageessamzaky ( 2015-02-21 10:43:23 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2015-02-21 08:24:41 -0500

Seen: 1,333 times

Last updated: Feb 21 '15