canny-operator

finding edge in tilted image with Canny

我们两清 提交于 2021-01-29 13:25:02
问题 I'm trying to find the tilt angle in a series of images which look like the created example data below. There should be a clear edge which is visible by eye. However I'm struggling in extracting the edges so far. Is Canny the right way of finding the edge here or is there a better way of finding the edge? import cv2 as cv import numpy as np import matplotlib.pyplot as plt from scipy.ndimage.filters import gaussian_filter # create data xvals = np.arange(0,2000) yvals = 10000 * np.exp((xvals -

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

假装没事ソ 提交于 2021-01-26 04:21:20
问题 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 = cv2.Canny(image, lower, upper) then, ##### first situation ##### img = cv2.imread('mango.jpg') gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) auto = auto_canny(gray) cv2.imwrite('mango_gray_edge.jpg', auto) In this situation, I got an image like this: ##### second

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

断了今生、忘了曾经 提交于 2021-01-26 04:17:17
问题 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 = cv2.Canny(image, lower, upper) then, ##### first situation ##### img = cv2.imread('mango.jpg') gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) auto = auto_canny(gray) cv2.imwrite('mango_gray_edge.jpg', auto) In this situation, I got an image like this: ##### second

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

回眸只為那壹抹淺笑 提交于 2021-01-26 04:17:12
问题 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 = cv2.Canny(image, lower, upper) then, ##### first situation ##### img = cv2.imread('mango.jpg') gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) auto = auto_canny(gray) cv2.imwrite('mango_gray_edge.jpg', auto) In this situation, I got an image like this: ##### second

opencv canny: Do minVal and maxVal matter if you're working with a black and white image?

流过昼夜 提交于 2020-01-25 02:52:43
问题 Preface: This is a continuation of this question. Consider the following code, taken from here: import cv2 import numpy as np from matplotlib import pyplot as plt img = cv2.imread('messi5.jpg',0) edges = cv2.Canny(img,100,200) # Would 100 and 200 matter if your original image was black and white? plt.subplot(121),plt.imshow(img,cmap = 'gray') plt.title('Original Image'), plt.xticks([]), plt.yticks([]) plt.subplot(122),plt.imshow(edges,cmap = 'gray') plt.title('Edge Image'), plt.xticks([]),

Canny's Algorithm: Hysteresis Mal-function

被刻印的时光 ゝ 提交于 2019-12-23 08:16:11
问题 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 @ 10 High @ 75 After Hysteresis, with problem A, edges were not strengthen with method performHysteresis; B weak non-edges are not removed with method removeWeak. Source code for the method as follows: import java.awt.image.BufferedImage; import java.awt.image

Glasses detection

早过忘川 提交于 2019-12-21 09:34:32
问题 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 don't meet. I thought about using HoughLinesP, but I'm not sure if this is what I need. So far I have conducted the following steps: Convert image to grayscale Create ROI around the eye/glasses area Blur the image Dilate the image (have done this to

how to remove straight lines or non-curvical lines in a canny image

风格不统一 提交于 2019-12-17 09:58:34
问题 I have a canny edge image I want to remove all line except the lines that look like a semi-circle/ellipse or a 'C'. Tried Hough Circle transforms, it detects all curves.Don't need that. 回答1: A simple approach would be: Find connected components Find the minimum oriented bounding box Compute the aspect ratio of the box, and check if it's too much elongated . On your image, I marked in red almost straight lines, and in green the curved lines. You can play with the threshold on the aspect ratio:

Orientational Canny Edge Detection

强颜欢笑 提交于 2019-12-07 19:16:53
问题 I want to detect edges using Canny method. In the end I want two edge maps: 1 for horizontal 1 for vertical direction. In MATLAB this can be achieved by using Sobel or Prewitt operators with an extra direction argument, but for Canny we do not have this option. E = edge(I,'Sobel','horizontal') Any idea how to extract both horizontal and vertical edges, separately, by using Canny? 回答1: There is no way using the built in edge function. However, Canny edge detection uses the angles from the

Glasses detection

半腔热情 提交于 2019-12-04 04:33:31
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 don't meet. I thought about using HoughLinesP, but I'm not sure if this is what I need. So far I have conducted the following steps: Convert image to grayscale Create ROI around the eye/glasses area Blur the image Dilate the image (have done this to remove any thin framed glasses) Conduct Canny edge detection Found contours These are the results: This