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 7884853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:54:43+00:00 2026-06-03T04:54:43+00:00

I am using EmguCV 2.3.0.1416 from a simple console application (.net 4.0 and c#)

  • 0

I am using EmguCV 2.3.0.1416 from a simple console application (.net 4.0 and c#) and I have a question around canny’s, edge detection etc. Given the following code:

var colours = new[]
                  {
                      new Bgr(Color.YellowGreen),
                      new Bgr(Color.Turquoise),
                      new Bgr(Color.Blue),
                      new Bgr(Color.DeepPink)
                  };

// Convert to grayscale, remove noise and get the canny
using (var image = new Image<Bgr, byte>(fileName)
    .Convert<Gray, byte>()
    .PyrDown()
    .PyrUp()
    .Canny(new Gray(180),
           new Gray(90)))
{
    // Save the canny out to a file and then get each contour within
    // the canny and get the polygon for it, colour each a different
    // colour from a selection so we can easily see if they join up
    image.Save(cannyFileName);

    var contours = image
        .FindContours(CHAIN_APPROX_METHOD.CV_CHAIN_APPROX_SIMPLE,
                      RETR_TYPE.CV_RETR_EXTERNAL);

    using (var debug = new Image<Bgr, byte>(image.Size))
    {
        int colIndex = 0;
        for (; contours != null; contours = contours.HNext)
        {
            Contour<Point> poly = contours
                .ApproxPoly(contours.Perimeter*0.05,
                            contours.Storage);

            debug.Draw(poly, colours[colIndex], 1);

            colIndex++;
            if (colIndex > 3) colIndex = 0;
        }

        debug.Save(debugFileName);
    }
}

I get this output (this is actually just a part of the image but it shows what I am asking about):

Canny Edge

As you can see it has a blue line with a little bit of pink and then a green line. The real thing has just a solid edge here so I want this to be a single line in order that I can be sure it is the edge of what I am looking at.

The original image looks like this (I have zoomed it but you can see it has a very distinctive edge that I was expecting to be able to find easily).

Orignal

If I look at just the canny I can see the gap there so I tried adjusting the parameters for creating the canny (the threshold and linking threshold) but they have made no difference.

I also dilated and then eroded the canny (using the same value for the iterations parameter – 10 incidentally) and that seemed to do the trick but could I lose accuracy by doing this (it just feels a bit wrong somehow)?

So, how should I ensure that I get a single line in this instance?

  • 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-03T04:54:45+00:00Added an answer on June 3, 2026 at 4:54 am

    Did you try smoothing before canny?

    I found this link, maybe useful for you

    http://www.indiana.edu/~dll/B657/B657_lec_hough.pdf

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

Sidebar

Related Questions

I am interested in using Emgucv for face detection. I have installed emgucv and
We are working on a video processing application using EmguCV and recently had to
I have the following code to display an image in imagebox using EmgucV: Capture
Using C# for ASP.NET and MOSS development, we often have to embed JavaScript into
Hi I am developing a campera capture application. I am currently using EmguCV 2.0.
I am making an object tracking application. I have used Emgucv 2.1.0.0 to load
I am using EmguCV to query frames sequentially from a capture that I defined
I have written a program in C# using EmguCV (wrapper of openCV). The program
Using the http://www.ifans.com/forums/showthread.php?t=132024 post from another question i am allowing the user to enter
I am trying to do some facial recognition using EmguCV. I was wondering if

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.