# Tag Info

## Hot answers tagged morphological-operations

10

If you are not worried about the speed or exact contour of hand, below is a simple solution. The method is like this : You take each contour and find distance to other contours. If distance is less than 50, they are nearby and you put them together. If not, they are put as different. So checking distance to each contour is a time consuming process. Takes a ...

8

Here's a step-by-step procedure for erosion/dilation by hand: Print out A and se on two sheets of paper Place the se paper on every pixel of the A sheet in turn At each position: Take the pixel values of A at the respective positions where se is 1. For the first top-left position, this would be 0,0,1,1 as I have tried to illustrate here: For an erosion, the ...

6

I am somewhat surprised that feature points don't work that well. I have had success registering shapes like yours using either Harris points, this is a corner detector, in combination with the RANSAC algorithm. See the wiki or Peter Kovesi his site Using a feature detector like SURF or SIFT in combination with an edge map of the image prior to feature ...

6

If you're willing to add/subtract etc. morphologically transformed images, you can count how many signal pixels are in the vicinity of each pixel, and threshold based on that number. img = imread('http://i.stack.imgur.com/wicpc.png'); n = false(3);n(4) = 1; s = false(3);s(6) = 1; w = false(3);w(2) = 1; e = false(3);e(8) = 1; %# note that you could ...

4

You will want to use the morphological closing operation, which is the erosion of the dilation of an image. This means that you first dilate the image, removing the small 'holes' in the interior of the image, and then you erode the image, shrinking the boundary. If you want the final boundary to be 'smaller' than the original boundary, simply erode more than ...

4

Just a naive suggestion: do you know about component labeling? The technique is about finding chunks of "touching" pixels and assigning them a label, e.g. an integer number. You can then interrogate each chink separately, looking for the pixel that share the same label. In MATLAB, here is the function that does it trivially: bwlabel

4

To fix the connectivity issue, you can try a close operation: cv::Mat structuringElement = cv::getStructuringElement(cv::MORPH_ELLIPSE, cv::Size(40, 40)); cv::morphologyEx( inputImage, outputImage, cv::MORPH_CLOSE, structuringElement ); I doubt that this will produce the results that you want, but you can give it a try.

3

I guess the basic question here becomes - what difference does non-flat structuring elements make w.r.t flat structuring elements ? From the definition of dilation one can see that the structuring element can define a support (like in flat structuring elements) or another function itself (gray scale structuring elements). Look at wiki which defines the ...

3

This is quite an interesting problem to solve! Try a median filter. See the reference here and here for more details. Though I haven't put my hands to simulate your problem, this is a suggestion. My gut feeling says that it might give you great benefit because, it is known to counter salt-n-pepper type of noise. In your case, the images has extra white ...

3

You can also run a distance transform on the image, then detect local maxima (searching for pixels with highest/lowest value of all pixels in 3x3 pixel patch - can be larger depending on expected minimum distance between the original blobs). Note that for detecting features of size 1-3 pixels, you need to double your sampling frequency (either upscale the ...

3

After couple days of research, I have found another interesting solution. The Similar algorithm for segmentation of overlapping objects is described in this article (the algorithm below is an adaptation for objects of parallelogram shape). It uses properties of the boundary to perform separation. Perhaps someone may find it interesting. Overlapping ...

3

What you are essentially doing is a matched filter. However, thanks to Hough transform, your filter (line) is oriented and therefore I would call it an oriented matched filter. For generating the Bresenham line and sampling the pixels you might want the use the OpenCV line iterator. The simple usage would be similar to: cv::LineIterator it(image, pt1, pt2, ...

2

For planar elements (implied by the wording "structuring element") the containment of origin is enough to maintain the properties of anti-extensivity for erosion, and extensivity for dilation as can be found in many texts and you also pointed that out. So, yes, this is enough for the non-negativity for the arithmetic difference (this is directly shown by ...

2

I looked up in Jaehne, Gonzalez, Soille (the one you've posted as well as Mathematical Morphology and Its Applications to Image and Signal Processing) and some other special morphological papers and haven't found neither any design criteria for the structuring element nor any special hints why it has to be symmetrical. Personally I think that a symmetrical ...

2

It looks like you're "oversegmenting" your image. Morphological operations, as bjnoernz has suggested, would help. In particular, a watershedding approach should get closer to what you want than just checking distance (as in python example above). See http://cmm.ensmp.fr/~beucher/wtshed.html.

2

One option would be to apply repeated morphological erosion to the image until it is fully eroded. At that point, each of the blobs shown above would be reduced down to a single pixel; you could take the locations of those pixels to be the list of points that you're looking for.

2

You are correct. Erosion of that image with that structuring element should cause all of the 1's to disappear. There are two ways to look at it. One is that only ones that are surrounded by ones will remain. There are no such ones. The other is that you will only have ones remain where you can fit the structure element into a set of ones in the image, ...

2

I am afraid that whatever way you pick to do this, it is not going to be straightforward because to assign the targets to clusters you are going to have to go through the image (at least once). I suppose that getting the points is the easier problem of the two (you are probably already applying some form of thresholding for example). To recover the ...

2

According to this paper, the grayscale dilation of image $I$ by a non-flat structuring element $S$ is defined as follows: $[I ⊕ S](x,y) = \displaystyle\max_{(s,t)∈S}\{I(x-s,y-t)+S(s,t)\}$ Since the origin of the structuring element is in the top right corner, we have that $s∈[0,1]$ and $t∈[-2,0]$ excluding the point $(s,t)=(0,-1)$. So using your example of ...

2

I guess this depends on the digital distance transform that one is approximating on the 3d grid and there are various local connectivities possible. There is an implementation in ImageJ here. It would also be good to verify if you are using a non-flat structuring element or a correct 3d structuring element. Read Matlab reference here. In the place of ...

2

Referring to MATLAB, the basic steps are Determine the connected components: CC = bwconncomp(BW, conn); Compute the area of each component: S = regionprops(CC, 'Area'); Remove small objects: L = labelmatrix(CC); BW2 = ismember(L, find([S.Area] >= P)); At the last step, after obtaining $L$, you might as well retain the component with the largest area ...

2

Looks like you are using Matlab. Try bwareaopen(I, N), where I is the original binary image and N is the estimated size of each unwanted connected region. You can try edit bwareaopen for more details. Basically the algorithm tries to find the size of connected regions. Connected-component labeling with union-find algorithm is expected to get you there.

2

You can use a line structure with 90 degree and a pre-defined thickness to erode the image. Then scan along the x-axis. In each y-axis line, it can be viewed as connection parts if there are more than 4 pixels.

1

Take a look to this paper from Santiago Velasco, it's about Conditional Toggle Mapping, and it's application to denoising.

1

Why do not use hough transform for finding lines and then finding table region? you can use hough transform to find horizontal and vertical lines. and then extract region of lines.

1

Though I didnot play with the rolling ball algorithm, I guess based on your comparison results it is quite obvious that the two algorithms you are interested in donot have a big difference. This is often the results, when you tried to compare some algorithm which is claimed to be better with some classic algorithm: a paper method is often no better than the ...

1

You are actually drawing the skeleton of the background (brighter region). change cv::threshold(image, image, threshold, 255, cv::THRESH_BINARY); in your codes to cv::threshold(image, image, threshold, 255, cv::THRESH_BINARY_INV); You should be able to get the right skeleton.

1

If you know the median filter principle, that's exactly the same type of operation. For each pixel, you take a look to all the neighbor pixels (defined by the structuring element), and you take the max (dilation) or the min (erosion). Therefore it's like the median filter, but instead of taking the median value, you take the min/max. The mathematical ...

1

Structuring element is mostly supposed to be a binary array (though you can try 0 0 7 7 by yourself). H=[0 0 1 1] u, v are the pixel coordinate at I. In your example, the only pixel value that will change is I(1,2) (the array label starts from 0 instead of 1). I = 1 2 3 3 7 2 Consider I(1,2), from the formula, I(1,2) I(1,1), and I(1,0)...

1

The asymmetric structuring elements produce a translation dilation on the original set or image. The size of the translation is determined by the offset in the center of the structuring element. For example you could try this using matlab for the dilation operator: I = imread('circles.png'); se = strel('disk',10); %you could see it with se = strel('line',5,...

Only top voted, non community-wiki answers of a minimum length are eligible
{"ft_lang_label":"__label__en","ft_lang_prob":0.9129816,"math_prob":0.9446882,"size":12580,"snap":"2019-35-2019-39","text_gpt3_token_len":3241,"char_repetition_ratio":0.14400445,"word_repetition_ratio":0.016989145,"special_character_ratio":0.26852146,"punctuation_ratio":0.13561964,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.97725403,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-09-21T09:59:21Z\",\"WARC-Record-ID\":\"<urn:uuid:f86c8288-635f-457a-b5a5-0606bdec7311>\",\"Content-Length\":\"167528\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:4e9ab2fd-66ce-4acd-84b2-6c43e1bb4e49>\",\"WARC-Concurrent-To\":\"<urn:uuid:ff809834-0091-4f51-9971-5f51b0412203>\",\"WARC-IP-Address\":\"151.101.65.69\",\"WARC-Target-URI\":\"https://dsp.stackexchange.com/tags/morphological-operations/hot\",\"WARC-Payload-Digest\":\"sha1:C37HRPP3K77XKE34OLHEIY6GIYEBFFWH\",\"WARC-Block-Digest\":\"sha1:M6XK2352RBTHMXCKHVTCGD4KJL6ZYSWW\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-39/CC-MAIN-2019-39_segments_1568514574377.11_warc_CC-MAIN-20190921084226-20190921110226-00205.warc.gz\"}"}