Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8203643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T07:37:45+00:00 2026-06-07T07:37:45+00:00

I wanted to try my hand at text recognition, so i’ve used opencv to

  • 0

I wanted to try my hand at text recognition, so i’ve used opencv to trace out the edges and c++ to find slopes, curves etc, the edge algorithm works well on big and uncluttered sets of characters but when it comes against small printed text or text with a lot of background noise like embedded in captcha it struggles and looks incomplete, my guess was i hadn’t set the threshold values correctly and tried different values with no success.

enter image description here

enter image description here

Here is my code :

#include "cv.h"
#include "highgui.h"
using namespace cv;
const int low_threshold  = 50;
const int high_threshold = 150;


int main()
{

    IplImage* newImg; 
    IplImage* grayImg; 
    IplImage* cannyImg; 

    newImg = cvLoadImage("ocv.bmp",1);

    grayImg = cvCreateImage( cvSize(newImg->width, newImg->height), IPL_DEPTH_8U, 1 );

    cvCvtColor( newImg, grayImg, CV_BGR2GRAY );
    cannyImg = cvCreateImage(cvGetSize(newImg), IPL_DEPTH_8U, 1);

    cvCanny(grayImg, cannyImg, low_threshold, high_threshold, 3);
    cvNamedWindow   ("Source", 1);
    cvNamedWindow   ("Destination",1);
    cvShowImage     ("Source", newImg );
    cvShowImage     ("Destination", cannyImg );
    cvWaitKey(0);
    cvDestroyWindow ("Source" );
    cvDestroyWindow ("Destination" );
    cvReleaseImage  (&newImg );
    cvReleaseImage  (&grayImg );
    cvReleaseImage  (&cannyImg );

return 0;

}

I’ve looked across the net and have seen some complicated thresholding conditions like in this code from this site :

% Set direction to either 0, 45, -45 or 90 depending on angle.
[x,y]=size(f1);
for i=1:x-1,
    for j=1:y-1,
        if ((gradAngle(i,j)>67.5 && gradAngle(i,j)<=90) || (gradAngle(i,j)>=-90 && gradAngle(i,j)<=-67.5)) 
            gradDirection(i,j)=0;
        elseif ((gradAngle(i,j)>22.5 && gradAngle(i,j)<=67.5))
            gradDirection(i,j)=45;
        elseif ((gradAngle(i,j)>-22.5 && gradAngle(i,j)<=22.5))
            gradDirection(i,j)=90;
        elseif ((gradAngle(i,j)>-67.5 && gradAngle(i,j)<=-22.5))
            gradDirection(i,j)=-45;
        end
    end
end

If this is the solution can somebody provide me the c++ equivalent of this algorithm, if it’s not what else can i do ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T07:37:47+00:00Added an answer on June 7, 2026 at 7:37 am

    Canny edge detector is a multi-step detector using hysteresis thresholding (it uses two threshold instead of one), and edge tracking (your last snippet is the part of this step). I suggest reading the wikipedia entry first. One possible solution could be to choose the high threshold, so e.g. 70% of the image pixels would be classified as edge (initially – you could do this quickly using histograms), than choose the low threshold as e.g. 40% of the high threshold. It might be a good idea to try to perform edge detection on image block rather than the whole image, so your algorithm could calculate different thresholds for different areas.

    Note that CAPTCHA-s are designed to be hard to segment, and adding noise that broke edge detection is one technique to achive this (you might need to smooth the image first).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wanted to try out an example you can find here: http://php.net/manual/en/function.include.php , but
I just discovered forge and wanted to try it out at once. I closely
I just started out with Python and wanted to try out tornado. Running the
I've read about Single-Page Applications recently and wanted to try one out. After watching
I wanted to try out Cassandra, and thought the easiest way to get up
I wanted to try out some new features in Clang, and I was referred
I wanted to try out some of the automation stuff available through BugSlayer ,
I found this link and I wanted to try the carousel example out. I
I wanted to try out this example of a self-hosted webservice (originally written in
I just wanted to try out SPDY using the node package node-spdy. My javascript:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.