MATLAB Answers


How to detect corner in rectangle?

Asked by Lily
on 6 Jan 2013

Hi, i'm new in matlab image processing. As we know, the rectangle has 4 corner A,B,C,D. How to detect every corner in rectangle automatically? it's like :

if (corner was in A) then
if (corner was in B) then
if (corner was in C) then
if (corner was in D) then

please help me..thank in advance

Best Regards,


Log in to comment.



No products are associated with this question.

1 Answer

Answer by Image Analyst
on 6 Jan 2013

I don't know what you want to do. Did you use the corner() function in the Image Processing Toolbox to detect your corners? Okay, let's say you did. Then do you look at all the points that are returned and determine which is A, which is B, etc.? I assume you did. But I don't know what you want to do inside the if blocks.


Do "which corner" to see if you have it. It's fairly new, just introduced around a couple of years ago. You probably need to upgrade your version of MATLAB.

Alternately, Lily might not have the Image Processing toolbox installed or perhaps installed but not licensed. If she is using Student Version then she might not have gone back and installed it from her installation CD.

corner was introduced in R2010b. The release notes for that version say

In R2008b and later releases, you could find corners by computing a cornermetric matrix with the cornermetric function and then finding peak values. Now, you can simplify your workflow by using the corner function.

Log in to comment.

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!