I have used canny edge detection using the following code :
blur( src, src_gray, Size(3,3) );
Canny( src_gray, detected_edges, 20, 40, kernel_size );
dst = Scalar::all(0);
src.copyTo(dst,detected_edges);
This give me the right edged form , but if i use corner detection by taking the variable dst as input array for corner detection, i get exception although have converted dst to float type 32:
dst.convertTo(temp, CV_32FC1);
cornerHarris( temp, 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++;
}
}
}