title: PHP shape/ pattern recognition inside image
body: <p>I would like to get some tips/ snippets about recognising a desired shape/ pattern inside a picture with the help of PHP.</p>
  
  <p>I want to crop fixed areas (using percentages) of an image containing an identity card but, in order to do this, first I have to detect the boundaries of the identity card and crop the image so that there will be nothing left in it except the card.
  The identity card contained in the picture will not be rotated (not more than a few degrees) and the background may vary.</p>
  
  <p>My final goal is to use the cropped areas with an OCR. I thought that this method will be good for removing the unwanted parts and also helping out the OCR. If you have a better idea, tell me.</p>