Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Detect page corners in a photo

I have tried 2 methodologies as follows:-

  1. conversion of image to Mat
  2. apply gaussian blur
  3. then canny edge detection
  4. find contours

the problem with this method is: 1. too many contours are detected 2. mostly open contours 3. doesn't detect what I want to detect

Then I changed my approach and tried adaptive thresholding after gaussian blur it is much better and I am able to detect the corners in 50% cases

The current problem I am facing is that the page detection requires contrasting and plain background without any reflections. I think it's too idealistic for real world use.

This is where I would like some help. Even a direction towards the solution is highly appreciated especially in java. Thanks in anticipation

Detect page corners in a photo

I have tried 2 methodologies as follows:-

  1. conversion of image to Mat
  2. apply gaussian blur
  3. then canny edge detection
  4. find contours

the problem with this method is: 1. too many contours are detected 2. mostly open contours 3. doesn't detect what I want to detect

Then I changed my approach and tried adaptive thresholding after gaussian blur it is much better and I am able to detect the corners in 50% cases

The current problem I am facing is that the page detection requires contrasting and plain background without any reflections. I think it's too idealistic for real world use.

This is where I would like some help. Even a direction towards the solution is highly appreciated especially in java. Thanks in anticipation

https://ibb.co/fMWPjF

https://ibb.co/doyRya

https://ibb.co/fTT4jF

https://ibb.co/k1vH4F

Detect page corners in a photo

I have tried 2 methodologies as follows:-

  1. conversion of image to Mat
  2. apply gaussian blur
  3. then canny edge detection
  4. find contours

the problem with this method is: 1. too many contours are detected 2. mostly open contours 3. doesn't detect what I want to detect

Then I changed my approach and tried adaptive thresholding after gaussian blur it is much better and I am able to detect the corners in 50% cases

The current problem I am facing is that the page detection requires contrasting and plain background without any reflections. I think it's too idealistic for real world use.

This is where I would like some help. Even a direction towards the solution is highly appreciated especially in java. Thanks in anticipation

https://ibb.co/fMWPjF

https://ibb.co/doyRya

https://ibb.co/fTT4jF

https://ibb.co/k1vH4F

Update: median blur did not help much so I traced the cause and found that the page boundary was detected in bits and pieces and not a single contour so it detected the biggest contour as a part of the page boundary Therefore performed some morphological operations to close relatively small gaps and the resultant largest contour is definitely improved but its its not optimum. Any ideas how I can improve the big gaps?

https://ibb.co/kVKrya

https://ibb.co/hmndda

Detect page corners in a photo

I have tried 2 methodologies as follows:-

  1. conversion of image to Mat
  2. apply gaussian blur
  3. then canny edge detection
  4. find contours

the problem with this method is: 1. too many contours are detected 2. mostly open contours 3. doesn't detect what I want to detect

Then I changed my approach and tried adaptive thresholding after gaussian blur it is much better and I am able to detect the corners in 50% cases

The current problem I am facing is that the page detection requires contrasting and plain background without any reflections. I think it's too idealistic for real world use.

This is where I would like some help. Even a direction towards the solution is highly appreciated especially in java. Thanks in anticipation

https://ibb.co/fMWPjF

https://ibb.co/doyRya

https://ibb.co/fTT4jF

https://ibb.co/k1vH4F

Update: Update: median blur did not help much so I traced the cause and found that the page boundary was detected in bits and pieces and not a single contour so it detected the biggest contour as a part of the page boundary Therefore performed some morphological operations to close relatively small gaps and the resultant largest contour is definitely improved but its its not optimum. Any ideas how I can improve the big gaps?

https://ibb.co/kVKrya

https://ibb.co/hmndda

Detect page corners in a photo

I have tried 2 methodologies as follows:-

  1. conversion of image to Mat
  2. apply gaussian blur
  3. then canny edge detection
  4. find contours

the problem with this method is: 1. too many contours are detected 2. mostly open contours 3. doesn't detect what I want to detect

Then I changed my approach and tried adaptive thresholding after gaussian blur it is much better and I am able to detect the corners in 50% cases

The current problem I am facing is that the page detection requires contrasting and plain background without any reflections. I think it's too idealistic for real world use.

This is where I would like some help. Even a direction towards the solution is highly appreciated especially in java. Thanks in anticipation

https://ibb.co/fMWPjF

https://ibb.co/doyRya

https://ibb.co/fTT4jF

https://ibb.co/k1vH4F

Update: median blur did not help much so I traced the cause and found that the page boundary was detected in bits and pieces and not a single contour so it detected the biggest contour as a part of the page boundary Therefore performed some morphological operations to close relatively small gaps and the resultant largest contour is definitely improved but its its not optimum. Any ideas how I can improve the big gaps?

https://ibb.co/kVKrya

https://ibb.co/hmndda

Update 2:

https://ibb.co/gB8Zm5 <--new Image

https://ibb.co/imvfR5 <-- canny result after matching the results of median and adaptive from your answer

Detect page corners in a photo

I have tried 2 methodologies as follows:-

  1. conversion of image to Mat
  2. apply gaussian blur
  3. then canny edge detection
  4. find contours

the problem with this method is: 1. too many contours are detected 2. mostly open contours 3. doesn't detect what I want to detect

Then I changed my approach and tried adaptive thresholding after gaussian blur it is much better and I am able to detect the corners in 50% cases

The current problem I am facing is that the page detection requires contrasting and plain background without any reflections. I think it's too idealistic for real world use.

This is where I would like some help. Even a direction towards the solution is highly appreciated especially in java. Thanks in anticipation

https://ibb.co/fMWPjF

https://ibb.co/doyRya

https://ibb.co/fTT4jF

https://ibb.co/k1vH4F

Update: median blur did not help much so I traced the cause and found that the page boundary was detected in bits and pieces and not a single contour so it detected the biggest contour as a part of the page boundary Therefore performed some morphological operations to close relatively small gaps and the resultant largest contour is definitely improved but its its not optimum. Any ideas how I can improve the big gaps?

https://ibb.co/kVKrya

https://ibb.co/hmndda

Update 2:

https://ibb.co/gB8Zm5 <--new Image

https://ibb.co/imvfR5 <-- canny result after matching the results of median and adaptive from your answer

Update 3: https://ibb.co/is6WzQ <-- Image before canny edge