I have a hiragana character set and I would like to count the number of endpoints / hints that a character has.
Example: input image:

desired output image:

I tried using a convex hull

code: (based on the opencv tutorial here )
findContours(threshold_output, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, Point(0, 0));
vector<vector<Point> >hull(contours.size());
for (int i = 0; i < contours.size(); i++)
{
convexHull(Mat(contours[i]), hull[i], false);
}
Mat drawing = Mat::zeros(threshold_output.size(), CV_8UC3);
for (int i = 0; i< contours.size(); i++)
{
if (hierarchy[i][3] == 0) {
Scalar color = Scalar(rng.uniform(0, 255), rng.uniform(0, 255), rng.uniform(0, 255));
drawContours(drawing, hull, i, color, 1, 8, vector<Vec4i>(), 0, Point());
}
}
then conrnerHarris (), but it returned too many unwanted angles

code: (based on the opencv tutorial here )
int blockSize = 2;
int apertureSize = 3;
drawing = binarizeImage(drawing);
cornerHarris(drawing, dst, blockSize, apertureSize, 0.04, BORDER_DEFAULT);
normalize(dst, dst_norm, 0, 255, NORM_MINMAX, CV_32FC1, Mat());
convertScaleAbs(dst_norm, dst_norm_scaled);
int countCorner = 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) > 50)
{
circle(output, Point(i, j), 2, Scalar::all(255), -1, 8, 0);
countCorner++;
}
}
}
He discovered 11 corners.
I think this may be the same as fingertip detection, but I donβt know how to do it.
[I am using OpenCV 2.4.9.]