MATLAB: Morphological dilation in a certain direction

digital image processingdilationdilation with directionImage Processing Toolboxmorphology

Dilation by creating structuring element will dilate in all direction, but I want to do dilation in a particular direction, say 70 degree from a particular pixel. I understand that I need to write a self-adaptive function, but how? For example, I have a line with slope of 70 degree. I want to increase the length of the line in both end (by dilation). If i use "bwmorph()", it increases in all direction, But I need only in one direction.

Best Answer

Not sure why you think "Dilation by creating structuring element will dilate in all direction" - it's just not true. For example to dilate only along the vertical direction, make a column vector:
se = true(15, 1); % 15 rows tall by one column wide column vector.
dilatedImage = imdilate(binaryImage, se);
So go ahead and make a 2D binary array with a line of "true"s at 70 degrees.
Related Question