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 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
Image Analyst
on 21 Nov 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 Comments
More Answers (2)
sohail abbasi
on 26 Nov 2018
1 Comment
Image Analyst
on 26 Nov 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
on 10 Dec 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 Comments
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!