Questions tagged [canny-operator]

The Canny edge detector is an edge detection operator that uses a multi-stage algorithm to detect a wide range of edges in images.

The Canny edge detector is an edge detection operator that uses a multi-stage algorithm to detect a wide range of edges in images. It was developed by John F. Canny in 1986. Canny also produced a computational theory of edge detection explaining why the technique works.

Canny's aim was to discover the optimal edge detection algorithm. In this situation, an "optimal" edge detector means:

  • good detection – the algorithm should mark as many real edges in the image as possible.

  • good localization – edges marked should be as close as possible to the edge in the real image.

  • minimal response – a given edge in the image should only be marked once, and where possible, image noise should not create false edges.

To satisfy these requirements Canny used the calculus of variations – a technique which finds the function which optimizes a given functional. The optimal function in Canny's detector is described by the sum of four exponential terms, but it can be approximated by the first derivative of a Gaussian.

From: http://en.wikipedia.org/wiki/Canny_edge_detector

253 questions
16
votes
1 answer

Can Canny in OpenCV deal with both grayscale and color images?

I have some questions about the Canny edge detector in OpenCV. Here is the code I tried. def auto_canny(image, sigma=0.33): v = np.median(image) lower = int(max(0, (1.0 - sigma) * v)) upper = int(min(255, (1.0 + sigma) * v)) edged =…
XV15
  • 161
  • 1
  • 1
  • 3
14
votes
1 answer

How to detect edge and crop an image in Python

I'm new to Image Processing in Python and I'm trying to solve a common problem. I have an image having a signature of a person. I want to find the edges and crop it to fit the signature in the image. Input Image Expected Output I tried Canny Edge…
8
votes
1 answer

OpenCV Detect Very Small Lines

Here is an example image of what I’m working with: On every image there is a measurement strip. The measurement strip may vary in scale and angle. I’ve identified some intersection with the measurement strip and now need to determine what number it…
Tom
  • 1,636
  • 2
  • 13
  • 21
8
votes
0 answers

Matching specific elements of an Image; known shapes OpenCV C++

After getting no answer to this question, I ended up coming across some interesting looking possible solutions: The Robust Matcher from this post, as well as the Canny Detector from this post. After setting up a Canny Edge Detector, referencing its…
MLMLTL
  • 1,519
  • 5
  • 21
  • 35
8
votes
2 answers

Glasses detection

What I'm trying to do is measure the thickness of the eyeglasses frames. I had the idea to measure the thickness of the frame's contours (may be a better way?). I have so far outlined the frame of the glasses, but there are gaps where the lines…
LKB
  • 1,020
  • 5
  • 22
  • 46
7
votes
1 answer

OpenCV canny edge detection is not working properly on ideal square

I am using this binary square image of 15*15 pixels. 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 …
7
votes
1 answer

Canny's Algorithm: Hysteresis Mal-function

I am writing Canny's Algorithm, and I seem to have an issue with hysteresis. The Thresholds Appears to process, however my hysteresis does not seem to function at all. As well as method remove weak for some odd reason. Please help! Low @…
DVCode
  • 171
  • 1
  • 9
7
votes
2 answers

How do I detect polygon contours that I drew by using opencv?

I'm new to OpenCV. I know that many ways exist for detecting contours of polygons. But, how do I detect polygon contours that I drew using opencv? Here is my code: Mat src = imread("C:/Users/Nickolay/Desktop/1.jpg"); resize(src, src, Size(400,…
Rougher
  • 834
  • 5
  • 19
  • 46
6
votes
1 answer

How can I detect edges on an image of a document, and cut sections into seperate images?

The task is to take an image of a document, and leverage straight lines surrounding different 'sections' in order to split up the image into different documents for further parsing. Size of the different 'sections' is completely variable from page…
6
votes
1 answer

Pre processing image before applying Canny Edge detection

I have an image of a room below and I want to detect all wall edges. I've tried a lot of different combinations of filters (Bilateral, Gaussian, Laplacian, etc.) and the best combination seems to be the following, Convert the image to…
WagglyWonga
  • 341
  • 3
  • 14
6
votes
2 answers

Adaptive parameter for Canny Edge

I'm using a project using OpenCV for detecting a card that will be place on a atable. I have successfully detect it using Canny Edge. However, for different image the parameter must be tuned manually. I wish for my project to be worked with every…
IllSc
  • 1,419
  • 3
  • 17
  • 24
5
votes
1 answer

Hough line transform to find polygons in an image

I am trying to find all the polygons (including the filled in one) in the image below. Currently, I'm trying to use Hough Transform to accomplish this, but it does not detect all the lines in the image. In addition, because of how wide the lines…
4
votes
2 answers

Does cv2.Canny() perform a Gaussian blur?

I know it's important to apply Gaussian blur to an image before using Canny to detect edges. My question is: does cv2.Canny() do Gaussian blur on its own or it is necessary to apply cv2.GaussianBlur() before cv2.Canny()? The documentation isn't…
4
votes
1 answer

opencv floodfill after canny edge detector

private Bitmap CannyImg(Bitmap photo) { Mat srcMat = new Mat (photo.getHeight(), photo.getWidth(), CvType.CV_8UC3); Bitmap myBitmap32 = photo.copy(Bitmap.Config.ARGB_8888, true); Utils.bitmapToMat(myBitmap32, srcMat); Mat gray = new…
4
votes
2 answers

How to remove colour background of an image in MATLAB

I want to remove the green pixels in this image and replace it with white background as a preliminary step to do canny detection on this picture to detect only the spanner. I converted it into hsv and considered h without green as follows, But…
Image Check
  • 91
  • 2
  • 14
1
2 3
16 17