Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Canny edge giving different result

I have two programs

  1. extracts edges from a bunch of images in a loop at once
  2. extracts edge from a single image

The preprocessing steps of blurring the image and thresholding the Canny Edge are same.

The images used by the two programs are same haven't been altered or enhanced in any way.

For one of the images Program 1 giving less number of contours detected but when running the same image in the Program 2, I can see more contours visually as well as in the count of the edges detected.

In short Program 1 is giving less number of contours than Program 2

Any idea what is happening here?

All the parameters for extraction are same but the detection difference so much.

Canny edge giving different result

I have two programs

  1. extracts edges from a bunch of images in a loop at once
  2. extracts edge from a single image

Using two blurring filter of same kernel size in both the programs.

then

ret, thresh = cv2.threshold(e_img, 240, 255, cv2.THRESH_BINARY)
im2, contours, hierarchy = cv2.findContours(thresh, cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_NONE)

then get the count and save the extracted image.

The preprocessing steps of blurring the image and thresholding the Canny Edge are same.

The images used by the two programs are same haven't been altered or enhanced in any way.

For one of the images Program 1 giving less number of contours detected but when running the same image in the Program 2, I can see more contours visually as well as in the count of the edges detected.

In short Program 1 is giving less number of contours than Program 2

Any idea what is happening here?

All the parameters for extraction are same but the detection difference so much.

Canny edge giving different result

I have two programs

  1. extracts edges from a bunch of images in a loop at once
  2. extracts edge from a single image

Using two blurring filter of same kernel size in both the programs.

then

ret, thresh = cv2.threshold(e_img, 240, 255, cv2.THRESH_BINARY)
im2, contours, hierarchy = cv2.findContours(thresh, cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_NONE)

then get the count and save the extracted image.

The preprocessing steps of blurring the image and thresholding the Canny Edge are same.

The images used by the two programs are same haven't been altered or enhanced in any way.

For one of the images Program 1 giving less number of contours detected but when running the same image in the Program 2, I can see more contours visually as well as in the count of the edges detected.

In short Program 1 is giving less number of contours than Program 2

Any idea what is happening here?

All the parameters for extraction are same but the detection difference so much.

This is one of the random pictures of potatoes i found online as an example of the output The left most when run through program 1, the middle one when extracted through program 2 then the right most is the origin image

We can see edges detected have changed, one is detecting the border(program2) where as other(program1) can't

image description