How can I measure the height and width of the object inside the image, including the small particle inside the object? I'm using the bounding box, but it give me different measurement when i measure the object height and width using distance tool.
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I = imread('image964.jpg'); BW = im2bw(I,0.5); stats = regionprops('table',BW, 'Area','Perimeter','BoundingBox');
B = bwboundaries(BW,'noholes'); subplot(1,2,1); imshow(I); subplot(1,2,2); imshow(BW); hold on visboundaries(B)
bwarea(BW) numberOfImagePixels = numel(BW); numberOfTruePixels = sum(BW(:));
info = regionprops(BW,'BoundingBox'); Width = info.BoundingBox(3); Height = info.BoundingBox(4); numberOfPixelsBB = info.BoundingBox(3)* info.BoundingBox(4);
figure, imshow(BW); h = imdistline(gca); api = iptgetapi(h); fcn = makeConstrainToRectFcn('imline',get(gca,'XLim'),get(gca,'YLim')); api.setDragConstraintFcn(fcn);
%im using this code. What else can i add?
0 Kommentare
Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!