Filter löschen
Filter löschen

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

3 Ansichten (letzte 30 Tage)
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

Akzeptierte Antwort

Image Analyst
Image Analyst am 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.

Weitere Antworten (2)

sohail abbasi
sohail abbasi am 26 Nov. 2018
thanks Image Analystsorry for late reply i am out of town for some days. i have read the steve eddins blog but that is complex for me beacuse i am new in the matlab if you just make a programe/ code for me that will be appericiated. please i am stuck in this. kindly pease do a code for me that only get four corner edges distance from center.
thanks in advance

Saeid
Saeid am 10 Dez. 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.)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by