Merge regions
이전 댓글 표시
Hi, I want to merge two regions if they are close to each other and their average intensity is similar.
if (| y1-y2 | <T & | M2-M1 |<t)
statement to merge
end
But I do not know how to write the statement for the merger of regions. Anyone know?
댓글 수: 3
Walter Roberson
2012년 1월 12일
How are the regions represented?
Marlene
2012년 1월 12일
Walter Roberson
2012년 1월 12일
Suppose you had two squares separated by a modest distance, with one of the two a bit up and to the right of the other. What would you like the merged region to look like in that case?
답변 (1개)
Image Analyst
2012년 1월 12일
Something like this perhaps???:
if (meanOfRegion1 - meanOfRegion2) < maxAllowableDifference
mergedMask = region1Mask & region2Mask; % Assumes binary images.
mergedImage = originalImage; % Initialize new image.
mergedImage(~mergedMask) = 0; % Zero out everything outside the merged region.
end
댓글 수: 7
Marlene
2012년 1월 12일
Image Analyst
2012년 1월 12일
OK, but what do you think the mean of the binary regions is? I'll bet my next year's salary that they'll all be 1 (since logical true = 1). So what's the point? If all your regions are 1 (because they're from a binary image), then how can you decide whether to merge or not merge regions?
Walter Roberson
2012년 1월 12일
Presumably the selected areas mask an image which is not binary, and it is the average magnitude of the active parts of the second image which is being considered.
But still I don't know how Marlene would like the connection to be made between the two regions. Smallest box that encloses both regions? Just label both regions the same and let them continue to be disjoint? Figure out the closest approach of the two objects and create a 1-wide 8-connected path between the two ? My Magic 8-Ball says "The situation is clouded".
Image Analyst
2012년 1월 12일
I agree Walter, that's why my suggestion had both a binary image and an original grayscale image. In cases like these there is usually some sort of heirarchy that keeps track of what regions are adjacent to what other regions. Otherwise you can play tricks with binary or integer images to keep track. I don't know how she's keeping track. Adjacent regions are have the potential to be merged.
Marlene
2012년 1월 13일
Image Analyst
2012년 1월 13일
That's what we thought. So, yes, my code is essentially what you'd do and would "resolve the problem" if you choose to do it that way.
Walter Roberson
2012년 1월 13일
Okay, so given that you have located two nearby regions that you want to merge, how do you want to merge them?
For example, suppose that one of the regions was a square, and three pixels to the right of it was the closest point of a circle of the same diameter. What should the merged region look like?
카테고리
도움말 센터 및 File Exchange에서 Image Arithmetic에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!