To assign different color in boundary.
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Jhilam Mukherjee
el 22 de Dic. de 2013
Comentada: Image Analyst
el 9 de Nov. de 2021
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


0 comentarios
Respuesta aceptada
Image Analyst
el 22 de Dic. de 2013
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 comentarios
Alex Perrakis
el 9 de Nov. de 2021
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
el 9 de Nov. de 2021
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.
Más respuestas (0)
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!