image-morphology

How to use Matlab's 512 element lookup table array in OpenCV?

不羁岁月 提交于 2019-12-21 06:06:39
问题 I am designing morphological operations in OpenCV. I am trying to mimic the functions remove and bridge in Matlab's bwmorph. To do this I referred to the function definition of bwmorph.m, there I obtained the Look up table arrays for remove and bridge. After that step the procedure is same for both Matlab and OpenCV. lut(img,lutarray,img) Problem is that Matlab uses a 512 element (9bit) look up table scheme while OpenCV uses a 256 element (8bit) look up scheme, how do I use the Matlab

How to detect hand drawn lines using hough transform in matlab?

空扰寡人 提交于 2019-12-12 02:53:50
问题 I'm working on a matlab image processing project which basically extracts components and connections from an image of hand-drawn circuit diagram. After preproccessing and obtaining skeleton image, I tried to use Hough transform to detect the lines so that i can identify corners and connection paths. Here is the code: [H,T,R] = hough(im); peaks = houghpeaks(H,50,'Threshold',ceil(0.3*max(H(:)))); lines = houghlines(im, T,R,peaks, 'Fillgap', 20, 'MinLength', 20); figure; imshow(im); title('Lines

Morphological Operations On Image

こ雲淡風輕ζ 提交于 2019-12-11 12:14:39
问题 I am currently doing a project in which I am trying to identify humans based on hands vascular pattern in C# using Emgu CV. The gray-scale image of the hand was first processed using the Adaptive Threshold function. Now I want to create a mask of the image using the morphological operations. The purpose is to remove the noise from the image. This is the adaptive-thresholded image: Kindly guide me which function should I use and how to use. 回答1: The code here is in C++. It shouldn't be

horizontal-vertical only lines

只谈情不闲聊 提交于 2019-12-11 01:19:13
问题 I'm new in matlab. I have a block of image as illustrated below: Whites show pixel that their values are equal to 1 and Blacks show pixel that their values are equal to 0 , I want to get vertical only lines . This means horizontal lines should be removed as illustrated below: Also I want to get horizontal only lines . This means vertical lines should be removed as illustrated below: How can I do it in Matlab ? I prefer morphological operations for this. 回答1: Assuming your image is BW below: %

General approach for extracting specific lines or line segments in an image

我怕爱的太早我们不能终老 提交于 2019-12-06 03:56:06
I have this sample cropped image: I need to make black thick lines (horizontal and vertical) disappear or extracted while leave all other info intact. These specific lines are either 4 or 5 pixels thick. I tried: Simple filtering of rows having more zeros/ones if image is read as NumPy array but the filtering condition doesn't terminate till a single row is left with zero or one. Erosion with simple kernel (3,3) but it leaves some noise because some symbols are also thick black Dilation with line structuring element of the width of image width but there are overwhelming variations on line

How to find the coordinates of the outside corners of these 4 squares? (morphological closing/opening does not conserve squares if image is rotated)

大兔子大兔子 提交于 2019-12-04 17:32:23
One of the first processing steps in a tool I'm coding is to find the coordinates of the outside corners of 4 big black squares . They will then be used to do a homographic transform, in order to deskew / unrotate the image (a.k.a perspective transform), to finally get a rectangular image. Here is an example of - rotated and noisy - input ( download link here ): To keep the big squares only, I'm using morphological transformations like closing/opening: import cv2, numpy as np img = cv2.imread('rotatednoisy-cropped.png', cv2.IMREAD_GRAYSCALE) kernel = np.ones((30, 30), np.uint8) img = cv2

Non connecting morphological filter

爷,独闯天下 提交于 2019-12-04 15:47:21
问题 After some simple preprocessing I am receiving boolean mask of segmented images. I want to "enhance" borders of the mask and make them more smooth. For that I am using OPEN morphology filter with a rather big circle kernel , it works very well until the distance between segmented objects is enough. But In alot of samples objects stick together. Is there exists some more or less simple method to smooth such kind of images without changing its morphology ? 回答1: Without applying a morphological

Gap Filling Contours / Lines

淺唱寂寞╮ 提交于 2019-12-04 14:28:12
问题 I have the following image: and I would like to fill in its contours (i.e. I would like to gap fill the lines in this image). I have tried a morphological closing, but using a rectangular kernel of size 3x3 with 10 iterations does not fill in the entire border. I have also tried a 21x21 kernel with 1 iteration and also not had luck. UPDATE: I have tried this in OpenCV (Python) using: cv2.morphologyEx(img, cv2.MORPH_CLOSE, cv2.getStructuringElement(cv2.MORPH_RECT, (21,21))) and cv2

Iterations vs. Kernel Size in Morphological Operations (OpenCV)

给你一囗甜甜゛ 提交于 2019-12-04 13:14:13
问题 I've been using morph. opening in OpenCV to reduce noise outside of my ROI in images via opencv, and until now, whenever I need a higher degree of noise reduction I just randomly increase kernel size or increase the number of iterations until I'm happy. But is there a significant difference in results depending on which you increase / how would you decide which to change in a given situation? I'm trying to come up with a better approach to which parameter I change (by how much) other than

drawing a bounding box in large images

半腔热情 提交于 2019-12-02 06:09:50
问题 I have a large binary image (4k x 7k pix) from which I want to extract the entire yellow portion as a single rectangle. I tried binary erosion to even out features inside the yellow region. Then I used the bbox method of skimage.regionprops but it does not seem to work fast enough for large image with one large bbox. Do you have any suggestion? 回答1: As the image you provided includes distracting axes, and is the wrong colour and too small, I created as realistic a version as I could with