Home:ALL Converter>OpenCV Alphabets detection and extraction on shape of alphabet after skeletonization

OpenCV Alphabets detection and extraction on shape of alphabet after skeletonization

Ask Time:2016-01-21T11:32:53         Author:Malik Faiq

Json Formatter

I want to detect and extract alphabets from image and create new image only contains alphabets.I have applied skeletonization on the image after that I want some suggestions.How can we detect letters using contours or stroke bases.The images I am using are basically dvd player pack panel e.g,

DVD back panel

The code I am using for skeletonization is

cvtColor(input, input, CV_BGR2GRAY);
cv::threshold(input, input, 127, 255, cv::THRESH_BINARY);
cv::Mat skel(input.size(), CV_8UC1, cv::Scalar(0));
cv::Mat temp;
cv::Mat eroded;

cv::Mat element = cv::getStructuringElement(cv::MORPH_CROSS, cv::Size(3, 3));

bool done;
do
{
    cv::erode(input, eroded, element);
    cv::dilate(eroded, temp, element); // temp = open(input)
    cv::subtract(input, temp, temp);
    cv::bitwise_or(skel, temp, skel);
    eroded.copyTo(input);

    done = (cv::countNonZero(input) == 0);
} while (!done);

The output Image After skeletonization,

Image After Skeletonization

Source :http://felix.abecassis.me/2011/09/opencv-morphological-skeleton/

Author:Malik Faiq,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/34914947/opencv-alphabets-detection-and-extraction-on-shape-of-alphabet-after-skeletoniza
yy