Home > Software engineering >  Detect wall corner with openCV - Hard
Detect wall corner with openCV - Hard

Time:10-17

I have this image (sorry for the size): wall corner

Edit: this is just a simple wall corner of my room, nothing special...

I'm trying to detect the exactly corner, but so far failed to do so. I try to use gray and bilateral, mask and canny and of course combinations of some openCV corner algorithms like Harris, EigenValsAndVecs, MinEigenVal and more... So far, I found a lot of points, or none.
Any idea please?

Thanks

CodePudding user response:

This seems rather straightforward. First you compute the gradient magnitude, which will find the lines in between the three mostly uniform regions (b in the image below), and then you apply something like the Harris corner detector (or any other variety will work too) to find the intersection point between the straight lines (c in the image below). I used a sigma of 4 for both the Gaussian gradient magnitude and the smoothing in the Harris detector.

output

I did this test quickly in MATLAB, because it was open, but you have access to the same DIPlib algorithms I used (disclosure: I'm an author of DIPlib). It would look something like this:

import diplib as dip

a = dip.ImageRead('corner.jpg') # you can use OpenCV or PIL or whatever else for reading too

b = dip.GradientMagnitude(a, sigmas=4)
c = dip.HarrisCornerDetector(b, sigmas=4)
  • Related