Can anyone please explain the meaning of this code?

조회 수: 3 (최근 30일)
Manjiree Waikar
Manjiree Waikar 2017년 9월 11일
댓글: Manjiree Waikar 2017년 9월 11일
if true
% code
boundaries=bwboundaries(handImage1);
x = boundaries{1}(:, 2);
y = boundaries{1}(:, 1);
hold on;
plot(x, y, 'black', 'LineWidth', 2);
newImage = bwlabel(handImage1);
measurements = regionprops(newImage, 'Centroid', 'BoundingBox');
xCentroid = measurements.Centroid(1);
yCentroid = measurements.Centroid(2);
subplot(2, 2, 4);
imshow(newImage);
title('Binary Image with Centroid Marked');
hold on;
plot(xCentroid, yCentroid, 'r*', 'MarkerSize', 10, 'LineWidth', 2);
end
Here, what are x and y?

채택된 답변

KSSV
KSSV 2017년 9월 11일
MATLAB is rich with documentation, you may read the respective functions documentation.
boundaries=bwboundaries(handImage1); % get;s the boudaries of the feature present in the image, the output is cell
x = boundaries{1}(:, 2); % select x coordinates of first boundary
y = boundaries{1}(:, 1); % select y coordinates of first boundary
hold on;
plot(x, y, 'black', 'LineWidth', 2); % plotting the first boundary
newImage = bwlabel(handImage1); % labelling the image
measurements = regionprops(newImage, 'Centroid', 'BoundingBox'); % get the properits of the region
% picking the centroid of the first label
xCentroid = measurements.Centroid(1);
yCentroid = measurements.Centroid(2);
subplot(2, 2, 4); % sub plotting
imshow(newImage); % shows image
title('Binary Image with Centroid Marked');
hold on;
plot(xCentroid, yCentroid, 'r*', 'MarkerSize', 10, 'LineWidth', 2); % plotting the coentorid

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Inertias and Loads에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by