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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:03:52+00:00 2026-06-07T17:03:52+00:00

I am using Emgu CV, i want to detect two sharp in the picture,

  • 0

enter image description here

I am using Emgu CV, i want to detect two sharp in the picture, first i convert the image to gray,and call cvCanny, then call FindContours, but just one contour found, the triangle not found.

Code:

 public static void Do(Bitmap bitmap, IImageProcessingLog log)
    {
        Image<Bgr, Byte> img = new Image<Bgr, byte>(bitmap);
        Image<Gray, Byte> gray = img.Convert<Gray, Byte>();
        using (Image<Gray, Byte> canny = new Image<Gray, byte>(gray.Size))
        using (MemStorage stor = new MemStorage())
        {
            CvInvoke.cvCanny(gray, canny, 10, 5, 3);
            log.AddImage("canny",canny.ToBitmap());

            Contour<Point> contours = canny.FindContours(
             Emgu.CV.CvEnum.CHAIN_APPROX_METHOD.CV_CHAIN_APPROX_SIMPLE,
             Emgu.CV.CvEnum.RETR_TYPE.CV_RETR_TREE,
             stor);

            for (int i=0; contours != null; contours = contours.HNext)
            {
                i++;
                MCvBox2D box = contours.GetMinAreaRect();

                Image<Bgr, Byte> tmpImg = img.Copy();
                tmpImg.Draw(box, new Bgr(Color.Red), 2);
                log.AddMessage("contours" + (i) +",angle:"+box.angle.ToString() + ",width:"+box.size.Width + ",height:"+box.size.Height);
                log.AddImage("contours" + i, tmpImg.ToBitmap());
            }
        }
    }
  • 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-07T17:03:53+00:00Added an answer on June 7, 2026 at 5:03 pm

    (I don’t know emguCV, but i will give you the idea)

    You can do it as follows:

    1. Split the image to R,G,B planes using split() function.
    2. For each plane, apply Canny edge detection.
    3. Then find the contours in it and approximate each contour using approxPolyDP function.
    4. if number of coordinates in the approximated contour is 3, it is most likely a triangle and the values corresponds to 3 vertices of triangles.

    Below is the python code :

    import numpy as np
    import cv2
    
    img = cv2.imread('softri.png')
    
    for gray in cv2.split(img):
        canny = cv2.Canny(gray,50,200)
    
        contours,hier = cv2.findContours(canny,1,2)
        for cnt in contours:
            approx = cv2.approxPolyDP(cnt,0.02*cv2.arcLength(cnt,True),True)
            if len(approx)==3:
                cv2.drawContours(img,[cnt],0,(0,255,0),2)
                tri = approx
    
    for vertex in tri:
        cv2.circle(img,(vertex[0][0],vertex[0][1]),5,255,-1)
    
    cv2.imshow('img',img)
    cv2.waitKey(0)
    cv2.destroyAllWindows()
    

    Below is canny diagram of blue color plane:

    enter image description here

    Below is the final output, triangle and its vetices are marked in green and blue colors respectively:

    enter image description here

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

Sidebar

Related Questions

I want to make an apps detect an square/rectangle in my webcam using EMGU
Im using EMGU (opencv wrapper) for image processing. I want to load images one
I have an image and two points, and I want to read the pixels
I'm using the Emgu shape detection example application to detect rectangles on a given
I am using Emgu.CV library for object detection and worrying if it is possible
Using a CSS image sprite, I'm creating an 'interactive' image where hovering over certain
Using a populated Table Type as the source for a TSQL-Merge. I want to
Using CI for the first time and i'm smashing my head with this seemingly
How can I do motion tracking using Emgu CV or OpenCV? What are different
I am using following code in WPF to display image in webcam usingEmguCv library

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.