edge-detection

Line detection in image

自作多情 提交于 2019-12-03 12:23:44
I am new to image processing and I was trying to detect vertical lines using this code- image=imread('benzene.jpg'); BW = im2bw(image); w1=[-1 2 -1 ; -1 2 -1 ; -1 2 -1]; g=(imfilter(double(BW),w1)); g=abs(g); T=max(g(:)); g=g>=T; imshow(g); This was my image- And this is what I got after performming the operations- So my question is why am I getting this output?There are 10 vertical lines if vertical double bonds are counted as 2 distinct vertical lines.Also what if I want to get horizontal,vertical,45 and -45 all the lines,how can I use all the 4 masks to get one single output? One simple

OpenCV: Efficient Difference-of-Gaussian

自闭症网瘾萝莉.ら 提交于 2019-12-03 12:03:03
问题 I am trying to implement difference of guassians (DoG), for a specific case of edge detection. As the name of the algorithm suggests, it is actually fairly straightforward: Mat g1, g2, result; Mat img = imread("test.png", CV_LOAD_IMAGE_COLOR); GaussianBlur(img, g1, Size(1,1), 0); GaussianBlur(img, g2, Size(3,3), 0); result = g1 - g2; However, I have the feeling that this can be done more efficiently. Can it perhaps be done in less passes over the data? The question here has taught me about

Python implementation of the laplacian of gaussian edge detection

吃可爱长大的小学妹 提交于 2019-12-03 11:28:25
I am looking for the equivalent implementation of the laplacian of gaussian edge detection. In matlab we use the following function [BW,threshold] = edge(I,'log',...) In python there exist a function for calculating the laplacian of gaussian. It is not giving the edges back definitely. scipy.ndimage.filters.gaussian_laplace Any pointer to online implementation or the code Thanks ycyeh What matlab edge() do should be Compute LoG Compute zero crossings on LoG Compute a threshold for local LoG difference Edge pixels = zero crossing && local difference > threshold The LoG filter of scipy only does

Fastest Sobel Edge Detection C#

一曲冷凌霜 提交于 2019-12-03 09:06:56
I want to make a program that implements sobel edge detection. This is my code : private Bitmap SobelEdgeDetect(Bitmap ori) { Bitmap b = original; Bitmap bb = original; int width = b.Width; int height = b.Height; int[,] gx = new int[,] { { -1, 0, 1 }, { -2, 0, 2 }, { -1, 0, 1 } }; int[,] gy = new int[,] { { 1, 2, 1 }, { 0, 0, 0 }, { -1, -2, -1 } }; int[,] allPixR = new int[width, height]; int[,] allPixG = new int[width, height]; int[,] allPixB = new int[width, height]; int limit = 128 * 128; for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { allPixR[i, j] = b.GetPixel(i, j).R

how to find corners points of a shape in an image in opencv?

巧了我就是萌 提交于 2019-12-03 09:01:47
I have to find corners of shapes in an image. i have used Harris corner detection algorithm to find corner, but it is giving total corners present in an image and for finding corners for a particular shape in that image it is not feasible. please suggest some other approach. You could use Harris corner detection algorithm. Corners are junction of two edges, where an edge is a sudden change in image brightness. This algorithm takes the differential of the corner score into account with reference to direction directly (wikipedia). Function cornerSubPix() refines the corner location - it iterates

Corner detection in Image processing Opencv Python

你离开我真会死。 提交于 2019-12-03 08:21:52
I have an image of the box. I am trying to detect corners and mark those corner from circles. I am using the following code for this: import cv2 import numpy as np img_file = 'Image.jpg' img = cv2.imread(img_file, cv2.IMREAD_COLOR) imgDim = img.shape dimA = imgDim[0] dimB = imgDim[1] # RGB to Gray scale conversion img_gray = cv2.cvtColor(img,cv2.COLOR_RGB2GRAY) # Noise removal with iterative bilateral filter(removes noise while preserving edges) noise_removal = cv2.bilateralFilter(img_gray,9,75,75) # Thresholding the image ret,thresh_image = cv2.threshold(noise_removal,220,255,cv2.THRESH_OTSU)

extract lines from canny edge detection

女生的网名这么多〃 提交于 2019-12-03 07:14:10
问题 In openCV after applying canny edge detection I'd like to further process the result (show only horizontal lines, remove short lines, etc..). But the result of canny is just another image. I'd like to get an array of lines describing the detected edges I'm aware of the famous Hough Line Transform, but the result is not always good, that's why I'd like to manually process canny result. input: output canny only: output canny then Hough line transform This is Hough line transform result(red

Sobel Edge Detection in Android

浪尽此生 提交于 2019-12-03 06:20:34
问题 As part of an application that I'm developing for Android I'd like to show the user an edge-detected version of an image they have taken (something similar to the example below). To achieve this I've been looking at the Sobel operator and how to implement it in Java. However, many of the examples that I've found make use of objects and methods found in AWT (like this example) that isn't part of Android. My question is then really, does Android provide any alternatives to the features of AWT

OpenCV: Efficient Difference-of-Gaussian

馋奶兔 提交于 2019-12-03 03:19:15
I am trying to implement difference of guassians (DoG), for a specific case of edge detection. As the name of the algorithm suggests, it is actually fairly straightforward: Mat g1, g2, result; Mat img = imread("test.png", CV_LOAD_IMAGE_COLOR); GaussianBlur(img, g1, Size(1,1), 0); GaussianBlur(img, g2, Size(3,3), 0); result = g1 - g2; However, I have the feeling that this can be done more efficiently. Can it perhaps be done in less passes over the data? The question here has taught me about separable filters, but I'm too much of an image processing newbie to understand how to apply them in this

How to classify blurry numbers with openCV

强颜欢笑 提交于 2019-12-03 03:15:45
问题 I would like to capture the number from this kind of picture. I tried multi-scale matching from the following link. http://www.pyimagesearch.com/2015/01/26/multi-scale-template-matching-using-python-opencv/ All I want to know is the red number. But the problem is, the red number is blurry for openCV recognize/match template. Would there be other possible way to detect this red number on the black background? 回答1: Classifying Digits You clarified in comments that you've already isolated the