I'm not sure what you mean by "algorithms distinguishable for documents and natural images" -- can you elaborate? OpenCV itself doesn't have builtin functionality to take documents and fit them to a pre-defined template, that tends to be part of a specific use-case/niche of computer vision for document processing. The general idea is to take a document a user has filled out and "fit" it to a blank template, where you know exactly where each field is. That way you can exact the information from the document.