Answers.Body: <p>I think what you are searching for is something like <a href="https://stackoverflow.com/questions/70881261/extract-lines-from-image-with-python">this</a>, it is sufficient to extract the lines in the image and choose the lines that are most connected as your object</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-09-30T08:38:08.643Z
Answers.Text: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).
Answers.UserDisplayName: Community
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-09-30T06:17:06.610Z
Answers.LastActivityDate: 2022-09-30T06:17:06.610Z
Answers.UserDisplayName: BJMG
Body: <p>I am trying to extract a document as an image from another image. Let's say that we take a photo of a document on a surface. My ultimate goal is to be able to digitize this document but as an image, not as OCR. This is already done in phones like my Samsung, but I want to do this using my Linux machine and as a command line tool if possible.</p>
  <p>As an example see the attached image (created by the default application of my mobile phone). The system recognized the orthogonal area and proposed its bounding box with yellow color. After that of course it is easy to extract this area and make it straight as a regular orthogonal image. What I am interested is how to &quot;reconstruct&quot; this yellow box from scratch.</p>
  <p>Any ideas how to do this? I tried to search various methods and tools, but when I search something there's always information on how to convert this through OCR, which is something I am not interested. I even found some imagemagick techniques that promise to do this, but unfortunately failed :(</p>
  <p><a href="https://i.sstatic.net/Ohf4C.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Ohf4C.jpg" alt="Example" /></a></p>
  
Tags: <image-processing><image-segmentation>
Title: Extract a document page from a photo
UserDisplayName: Panayotis
ThreadText: # Extract a document page from a photo
  
  (Asked by: username_0 on 2022-09-29)
  
  I am trying to extract a document as an image from another image. Let's say that we take a photo of a document on a surface. My ultimate goal is to be able to digitize this document but as an image, not as OCR. This is already done in phones like my Samsung, but I want to do this using my Linux machine and as a command line tool if possible.
  
  As an example see the attached image (created by the default application of my mobile phone). The system recognized the orthogonal area and proposed its bounding box with yellow color. After that of course it is easy to extract this area and make it straight as a regular orthogonal image. What I am interested is how to "reconstruct" this yellow box from scratch.
  
  Any ideas how to do this? I tried to search various methods and tools, but when I search something there's always information on how to convert this through OCR, which is something I am not interested. I even found some imagemagick techniques that promise to do this, but unfortunately failed :(
  
  [![Example](https://i.sstatic.net/Ohf4C.jpg)](https://i.sstatic.net/Ohf4C.jpg)
  
  **Tags:** image-processing, image-segmentation
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-09-30. Score: 1
  
  I think what you are searching for is something like [this](https://stackoverflow.com/questions/70881261/extract-lines-from-image-with-python), it is sufficient to extract the lines in the image and choose the lines that are most connected as your object
  
  > **Comments:**
  > **username_2**: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).  
  
  ---
  
  