Marking a footprint with a peak pressure box
3 次查看(过去 30 天)
显示 更早的评论
I am using a Matlab code to produce footprint and stance data. I would like to be able to mark the point of peak pressure using a small black box. This needs to be implemented throughout the code so that this image:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/160075/image.jpeg)
and other outputs Can have this box:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/160077/image.png)
0 个评论
回答(1 个)
Image Analyst
2016-4-5
To find the bounding box
[rows, columns] = find(pressureImage > 0);
topRow = min(rows);
bottomRow = max(rows);
leftColumn = min(columns);
rightColumn = max(columns);
% Make box coordinates.
xBox = [leftColumn , rightColumn , rightColumn , leftColumn , leftColumn];
yBox = [topRow , topRow , bottomRow , bottomRow , topRow ]
% Draw the box with green lines.
plot(xBox, yBox, 'g-', 'LineWidth', 2);
This is intended to work on the gray scale image, and the 0 is whatever pressure shows up as white in your pseudocolored image.
To find the row(s) and columns(s) of the max pressure:
% Determine the max pressure value:
maxPressure = max(pressureImage(:));
% Find what rows and columns in the image have that value:
[rowOfMax, colOfMax] = find(pressureImage == maxPressure);
% Plot a black square around it:
plot(colOfMax, rowOfMax, 'ks', 'MarkerSize', 8, 'LineWidth', 2);
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!