How to find angle of corners detected?
i want to find angles between the corners detected from a sketched rectangle, i have used harris corner detection and canny edge detection and also have drawn circles around the corners , can i used all of these together to find angles of each corner?
I want to find angles from this image for rectangle classification.
I have so far done this:
Here is a snippet of code (I have saved the vertices of the drawn circle and want to use it with detected edges from canny):
cornerHarris( detected_edges, dst, blockSize, apertureSize, k, BORDER_DEFAULT );
normalize( dst, dst_norm, 0, 255, NORM_MINMAX, CV_32FC1, Mat() );
convertScaleAbs( dst_norm, dst_norm_scaled );
/// Drawing a circle around corners
for( int j = 0; j < dst_norm.rows ; j++ )
{
{
for( int i = 0; i < dst_norm.cols; i++ )
{
if( (int) dst_norm.at<float>(j,i) > thresh )
{
circle( dst_norm_scaled, Point( i, j ), 5, Scalar(0), 2, 8, 0 );
count++;
}
}
}
vector<Point>* circle_points;
circle_points= new vector<Point>[count];
int pt=0;
for( int j = 0; j < dst_norm.rows ; j++ )
{
for( int i = 0; i < dst_norm.cols; i++ )
{
if( (int) dst_norm.at<float>(j,i) > thresh )
{
ellipse2Poly( Point(i,j), axes, 0, 0, 360, 1, circle_points[pt] );
pt++;
}
}
}
}