Ask Your Question

coinocr's profile - activity

2017-05-19 21:27:45 -0600 received badge  Taxonomist
2014-05-26 14:48:13 -0600 answered a question Framework Not Found — OpenCV

try this

on the left navigation bar, select the top level project file so that you see the "Build Phases" on the right panel. There select the "Link Binary with Libraries." If opencv2.framework is not there, add it. If it is there, remove it and add it again.

This has worked for me with weird framework issues.

2014-05-26 14:35:31 -0600 commented question Unable to install OpenCV 2.4.9 on Ubuntu 14.04

I installed 2.4.9 on Ubuntu 14.04 without any issues following these steps: http://docs.opencv.org/trunk/doc/tutorials/introduction/linux_install/linux_install.html

2014-05-24 15:25:19 -0600 asked a question coin date cascade training

I have been trying to create a cascade classifier for a penny date prefix of the number 19. I am following this tutoria: http://coding-robin.de/2013/07/22/train-your-own-opencv-haar-classifier.html , but but I haven't had a positive result from detection. I am getting a circle in the middle regardless of what image i use.

C:\fakepath\opencv_penny_date_facedetect.png

Can someone please see if I am missing something?

Here are the files used for the training:

http://coinmatico.com/wp-content/uploads/2014/05/opencv-haar-classifier-training3.zip

created samples like this:

perl bin/createsamples.pl positives.txt negatives.txt samples 1500\
  "opencv_createsamples -bgcolor 0 -bgthresh 0 -maxxangle 1.1\
  -maxyangle 1.1 maxzangle 0.5 -maxidev 40 -w 15 -h 15"

and trained like this:

opencv_traincascade -data classifier -vec samples.vec -bg negatives.txt\
  -numStages 20 -minHitRate 0.999 -maxFalseAlarmRate 0.5 -numPos 100\
  -numNeg 12 -w 15 -h 15 -mode ALL -precalcValBufSize 1024\
  -precalcIdxBufSize 1024

The classifier/cascade.xml is what i'm using with the facedetect.cpp sample from opencv: https://github.com/Itseez/opencv/blob/master/samples/c/facedetect.cpp

...I know I need a lot more sample images but I wanted to test something simple before I comited to all the cropping needed. Thanks for your help.

2014-05-24 14:33:04 -0600 commented answer coin date ocr

Thanks for the input, I was thinking about training tesseract but it seems more appropriate to train OpenCV instead.

2014-05-16 02:46:07 -0600 commented question coin date ocr

CODE ON PASTEBIN: http://pastebin.com/0K4UNCJs

2014-05-16 02:43:08 -0600 received badge  Editor (source)
2014-05-16 02:22:54 -0600 asked a question coin date ocr

Hello, I am trying to setup an automated way to get the date from coins. I am keeping it simple and decided to first try it on pennies since the dates are in the same location in relation to its circle. I am using tesseract for the OCR of the date. I am having difficulty processing the date from the penny so that tesseract will correctly translate it.

My question is, does anyone have a good idea what I can do to the image from a penny's date field so that tesseract will translate correctly. I am trying morphologies but can't get the right setting so that it works.

Here is my code(needs alot of cleanup but does the job)

#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "tesseract/baseapi.h"
#include "iostream"

using namespace cv;
using namespace std;

static void help()
{
    cout << "\nThis program demonstrates circle finding with the Hough transform.\n"
            "Usage:\n"
            "./houghcircles <image_name>, Default is pic1.png\n" << endl;
}

/**
 * Rotate an image
 */
void rotate(cv::Mat& src, double angle, cv::Mat& dst)
{
    int len = std::max(src.cols, src.rows);
    cv::Point2f pt(len/2., len/2.);
    cv::Mat r = cv::getRotationMatrix2D(pt, angle, 1.0);

    cv::warpAffine(src, dst, r, cv::Size(len, len));
}

int main(int argc, char** argv)
{
    const char* filename = argc >= 2 ? argv[1] : "board.jpg";


    int centerx,centery, radius;

    //Mat img = imread(filename, 0);
    Mat img = imread(filename,0);

    Mat org;
    img.copyTo(org);

    Mat date_img;

    if(img.empty())
    {
        help();
        cout << "can not open " << filename << endl;
        return -1;
    }

    Mat cimg;
    medianBlur(img, img, 5);
    cvtColor(img, cimg, COLOR_GRAY2BGR);

    vector<Vec3f> circles;
    HoughCircles(img, circles, HOUGH_GRADIENT, 1, 300,
                 100, 30, 400, 2000 // change the last two parameters
                                // (min_radius & max_radius) to detect larger circles
                 );
    for( size_t i = 0; i < circles.size(); i++ )
    {
        Vec3i c = circles[i];
        circle( cimg, Point(c[0], c[1]), c[2], Scalar(0,255,255), 3, LINE_AA);
        circle( cimg, Point(c[0], c[1]), 2, Scalar(0,255,0), 3, LINE_AA);

    centerx = c[0]; 
    centery = c[1];
    radius = c[2];  

    cv::Mat mask = cv::Mat::zeros( img.rows, img.cols, CV_8UC1 );
    circle( mask, Point(c[0], c[1]), c[2], Scalar(255,255,255), -1, 8, 0 ); //-1 means filled
    org.copyTo( cimg, mask ); // copy values of img to dst if mask is > 0.

    break;

    }

    //cv::Mat roi( cimg, cv::Rect( centerx-radius, centery-radius, radius*2, radius*2 ) );
    cout << "DIAMETER: " <<  radius  << " CENTERX: " << centerx << " CENTERY: " << centery << endl;

    cv::Rect myROI(centerx-radius,  centery-radius, radius*2,radius*2);
    cimg = cimg(myROI);

 //  rotate(cimg, 90, cimg);




 //   rectangle(cimg, Point(cimg.rows/1.45, cimg.cols/1.6),Point(cimg.rows/1.1,cimg.cols/1.35), Scalar(0,255,255), 3, 8, 0 );

    //get date
    date_img = cimg(Rect( Point(cimg.rows/1.45, cimg.cols/1.6),Point(cimg.rows/1.1,cimg.cols/1.35) ) ) ;
    date_img.convertTo(date_img, -1, 1.8, 1);


    Mat element = getStructuringElement(MORPH_ELLIPSE, Size(15,15), Point(-1,-1) );
    erode(date_img,date_img, element);
    //dilate ...
(more)