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;
![untited.jpg](https://www.mathworks.com/matlabcentral/answers/uploaded_files/141600/untited.jpg)
댓글 수: 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!