Morphological dilation in a certain direction

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.

 채택된 답변

Image Analyst
Image Analyst 2015년 3월 27일

0 개 추천

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.

댓글 수: 1

Tanmoy
Tanmoy 2015년 3월 28일
Thanks for the answer. Later on I found that dilation is not only for all way increment.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Tanmoy
Tanmoy 2015년 4월 9일

0 개 추천

I need to dilate in red line direction (slope is line's own slope). But, I have to extend the black line (image attached) in the direction (direction = slope) with certain length (say, I will set that to 10 pixels shown in red). Each line has to be dilated with it's own slope? I am trying several dilating concept form matlab.

댓글 수: 1

So make up a kernel with a line of ones running along that direction. To get a precise direction you will have to have a very large kernel since with a 3x3 you have only 0, 45, and 90 degrees since you can go only horizontal, diagonally, or vertically.

댓글을 달려면 로그인하십시오.

질문:

2015년 3월 27일

댓글:

2015년 4월 10일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by