i have image of blob from which i get the center point of blob now i want to get the four point that is Top{left ,right}point and Bottom{left, right}point which marked red in image kindly help and write code will appreciative beacuse i new in matlab
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
sohail abbasi
el 21 de Nov. de 2018
Respondida: Saeid
el 10 de Dic. de 2018
bw = im2bw(segmented_images{1},0.6);% code for image black and white of palm cluster put value of 0.2 on result to get whole immage bw
figure, imshow(bw);
binaryImage = bwareafilt(bw, 1);
figure, imshow(binaryImage);
C=imfill(binaryImage,'holes');
figure, imshow(C);
% code for getting the cropped image of white
measurements = regionprops(C, 'BoundingBox');
croppedImage = imcrop(C, measurements.BoundingBox);
figure, imshow(croppedImage);
%code to find the centre of blob
measurements = regionprops(C, 'Centroid');
%figure,imshow(binaryImage);
centroids = cat(1,measurements.Centroid);
figure, imshow(C);
hold on;
plot(imgca,centroids(:,1), centroids(:,2), 'r*','MarkerSize', 10, 'LineWidth', 3);
hold off;
0 comentarios
Respuesta aceptada
Image Analyst
el 21 de Nov. de 2018
See Steve Eddins fascinating blog series on Feret Diameters:
Unfortunately they are not yet built in to the Image Processing Toolbox regionprops() function, so you'll just have to use Steve's code from his Image Processing Blog.
0 comentarios
Más respuestas (2)
sohail abbasi
el 26 de Nov. de 2018
1 comentario
Image Analyst
el 26 de Nov. de 2018
I don't have the code and it would take more than a few minutes to write it.
You can have the Mathworks write it for you: MathWorks Consulting
Saeid
el 10 de Dic. de 2018
Hi,assuming bw being your input binary image, try this:
Regions=regionprops(bw, 'Image','Area','Centroid'); % all white islands
[MaxArea,MaxIndex] = max(cat(1,Regions.Area));
blob=Regions(MaxIndex).Image; % the main island
Center=fix(cat(1,Regions(MaxIndex).Centroid)); % the center of it
A=false(size(blob));
A(Center(1,1),Center(1,2))=true;
DistanceTransform=bwdist(A).*bw;
imshow(mat2gray(DistanceTransform));
Each element of DistanceTransform matrix presents its distance to the center of the blob, so maxima of DistanceTransform matrix are furthest points to the center.
Now the question arrises that how you chose those bloody points on your image. In my eye on the top left you have many regions that are further to the center compared to that on top right, so the 1st to 4th furthest points are not what you want. You need to define your criteria (i.e. one point in each quadrant, etc.)
0 comentarios
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!