Questions tagged [mathematical-morphology]

This tag discusses the theory, applications of Mathematical Morphology to fields of Image analysis, Non linear Signal Processing Methods, Statistical and Structural Pattern recognition, Scale Space Analysis, Variational Methods, Optimization Theory, Topology, and other topics.

Mathematical morphology is an approach to modeling geometric structures.

It has applications in image analysis, low-level computer vision applications, and pattern recognition. Basic operations include dilation, erosion, opening, closing, tophats, and watershed transforms, while advanced operations include geodesics, connective filtering, and segmentation.

More information is on Wikipedia: https://en.wikipedia.org/wiki/Mathematical_morphology

180 questions
13
votes
1 answer

Iterations vs. Kernel Size in Morphological Operations (OpenCV)

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…
pyhat
  • 155
  • 1
  • 1
  • 7
12
votes
3 answers

How do i separate overlapping cards from each other using python opencv?

I am trying to detect playing cards and transform them to get a bird's eye view of the card using python opencv. My code works fine for simple cases but I didn't stop at the simple cases and want to try out more complex ones. I'm having problems…
Hissaan Ali
  • 2,229
  • 4
  • 25
  • 51
10
votes
1 answer

Counting the squama of lizards

A biologist friend of mine asked me if I could help him make a program to count the squama (is this the right translation?) of lizards. He sent me some images and I tried some things on Matlab. For some images it's much harder than other, for…
9
votes
2 answers

Python Opencv morphological closing gives src data type = 0 is not supported

I'm trying to morphologically close a volume with a ball structuring element created by the function SE3 = skimage.morphology.ball(8). When using closing = cv2.morphologyEx(volume_start, cv2.MORPH_CLOSE, SE) it returns TypeError: src data type = 0…
David
  • 157
  • 1
  • 2
  • 7
9
votes
4 answers

implementing erosion, dilation in C, C++

I have theoretical understanding of how dilation in binary image is done. AFAIK, If my SE (structuring element) is this 0 1 1 1. where . represents the centre, and my image(binary is this) 0 0 0 0 0 0 1 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 so the…
Curious
8
votes
3 answers

How can i find cycles in a skeleton image with python libraries?

I have many skeletonized images like this: How can i detect a cycle, a loop in the skeleton? Are there "special" functions that do this or should I implement it as a graph? In case there is only the graph option, can the python graph library…
8
votes
2 answers

OpenCV grooving detection

I have pictures of a surface with many grooves. In most cases the edges of the grooving form parallel lines so Canny and Hough transformation work very good to detect the lines and to do some characterization. However, at several places the grooving…
marc
  • 205
  • 5
  • 11
7
votes
2 answers

Tensorflow dilation behave differently than morphological dilation

As the following piece of code shows, the tensorflow tf.nn.dilation2D function doesn't behave as a conventional dilation operator. import tensorflow as tf tf.InteractiveSession() A = [[0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0], [0, 0,…
7
votes
2 answers

Disk Structuring Element opencv vs Matlab

I want to create a disk shaped structuring element on OpenCv. I need my SE to be similar with sel = strel('disk',5); I want to do this using cvstructuringElementEx(cols,rows,anchor_x,anchor_y,shape,*values); What do I need to do to achieve this…
7
votes
2 answers

Morphological separation of two connected boundaries

I've got a question regarding the following scenario. As I post-process an image, I gained a contour, which is unfortunately twice connected as you can see at the bottom line. To make it obvious what I want is just the outter line. Therefore I…
mchlfchr
  • 3,998
  • 4
  • 26
  • 35
7
votes
2 answers

Segmenting a grayscale image

I am having trouble achieving the correct segmentation of a grayscale image: The ground truth, i.e. what I would like the segmentation to look like, is this: I am most interested in the three components within the circle. Thus, as you can see, I…
7
votes
1 answer

Need only one edge in Canny edge algorithm

When i use the canny edge algorithm, it produces the 2 edges opposite the thick colored line as expected, but i want only one edge to be displayed so as to make my line and curve detection algorithm much less complicated, any ideas on how i can make…
6
votes
1 answer

OpenCV Opening/Closing shifts the positions of the pixels

I'm currently using morphology transformations on binary images with OpenCV 2.4 I just noticed that using the built-in functions of OpenCV, all my pixels' positions are shifted right and down by one (i.e. the pixel previously located at (i,j) is now…
Julian
  • 556
  • 1
  • 8
  • 27
6
votes
3 answers

Calculate perimeter of numpy array

I want to calculate the perimeter of a given numpy array structure. With perimeter i mean the exact perimeter of the structure in the numpy array. The structure could include holes. My current aproach is something like this: import numpy a =…
6
votes
2 answers

Helping using the dilate function OpenCV

In the following code I want to use the dilate function but I don't know how to cast a Mat class into a InputArray and OutputArray. Can you help me? Using this prototype function: void dilate(InputArray src, OutputArray dst, InputArray kernel, Point…
1
2 3
11 12