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 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Image Analyst
2018-11-21
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 个评论
更多回答(2 个)
sohail abbasi
2018-11-26
1 个评论
Image Analyst
2018-11-26
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
2018-12-10
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 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!