필터 지우기
필터 지우기

To assign different color in boundary.

조회 수: 2 (최근 30일)
Jhilam Mukherjee
Jhilam Mukherjee 2013년 12월 22일
댓글: Image Analyst 2021년 11월 9일
I want to outline the boundary of the segment image using bwperim() and get the resultant image i.e boundary.jpg, but my aim is to get an output image which outline the region of segment.jpg with different colors link red or green. How it is possible

채택된 답변

Image Analyst
Image Analyst 2013년 12월 22일
You can use bwboundaries() and plot() to do that:
hold on;
boundaries = bwboundaries(binaryImage);
numberOfBoundaries = size(boundaries, 1);
for k = 1 : numberOfBoundaries
thisBoundary = boundaries{k};
plot(thisBoundary(:,2), thisBoundary(:,1), 'g', 'LineWidth', 2);
end
hold off;
  댓글 수: 3
Alex Perrakis
Alex Perrakis 2021년 11월 9일
pic01=imread("1.tiff");
pic1=im2gray(pic01);
i=1;
boundaries=[];
for i=3:7:69;
pic050=im2gray( imread(i+".tiff") );
%pic50=im2gray(pic050);
newpicture=imsubtract(pic01,pic050);
%imshow(newpicture)
level = graythresh(newpicture);
level = 0.1405;
newbinpic = imbinarize(newpicture,level);
%imshowpair(newpicture,newbinpic,'montage')
newbinpic2=bwpropfilt(newbinpic,'perimeter',1);
% imshowpair(newbinpic2,newpicture,'montage');
boundariesi = bwboundaries(newbinpic2);
boundaries=[boundaries; boundariesi];
binaryImage = 0.6< newbinpic2 & newbinpic2<1;
end
figure; imshow(pic01);
hold on
for k=1:length(boundaries)
thisBoundary = boundaries{k};
x = thisBoundary(:,2);
y = thisBoundary(:,1);
plot(x,y,'r-','Linewidth',2);
end
grid off
This is my code until now
Image Analyst
Image Analyst 2021년 11월 9일
Yeah, you could call getdata() or getsnapshot() to get a frame and then analyze it to get the boundaries. Not sure how "real time" it would be -- how many frames per second -- but you could certainly try it.

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

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by