hi everyone I want to write a function to deal with image which has been divided to N regions with regionprops function : imageregion = [1 2 3 4 ... n] , for every region i in that image I want to declare variables using for loop like this
for i=1:N
vector1=ismember(labelimage,1)>0;
vector2=ismember(labelimage,2)>0;
.
.
vectorn=ismember(labelimage,n)>0;
end
I try to apply that code but i failed . could any help me thank you

댓글 수: 3

Jan
Jan 2015년 6월 20일
What did you try exactly? You've posted pseudo-code and did not explain if you got an error message of if the results differ from your expectations. "I failed" is not clear enough.
majed majed
majed majed 2015년 6월 21일
what i want exactly is to delete some regions which has particular properties from that image and leave the others . the regions number is not consonant,its differs from image to image. thank you for your help
majed majed
majed majed 2015년 6월 21일
편집: majed majed 2015년 6월 21일
instead of that , does MATLAB has a function to remove undesired regions ( small regions or the area we wish) from a binary image to another one ?

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

추가 답변 (2개)

Jan
Jan 2015년 6월 20일

0 개 추천

Short summary: Don't do this! Use an array instead of a pile of variables with an index hidden in the name.
Image Analyst
Image Analyst 2015년 6월 20일

0 개 추천

There is no reason to do that. You are extracting individual blobs one at a time into "n" binary images with just one blob. Then you're doing that same thing "N" times. There is no reason to do it more than once, and there is not even any reason to do it once. You don't need n images, and don't need to generate n images N times. Why do you think you need to do this? What do you think it will allow you to achieve?

댓글 수: 2

majed majed
majed majed 2015년 6월 21일
what i want exactly is to delete some regions which has particular properties from that image and leave the others . the regions number is not consonant,its differs from image to image. thank you for your interest
Image Analyst
Image Analyst 2015년 6월 21일
Then use a cell array. See the FAQ http://matlab.wikia.com/wiki/FAQ#What_is_a_cell_array.3F and see my Image Segmentation Tutorial in my File Exchange http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862. In there I show you how to filter blobs based on certain feature values.

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

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

질문:

2015년 6월 20일

편집:

2019년 6월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by