Marking a footprint with a peak pressure box
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Image Analyst
le 5 Avr 2016
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 commentaires
Voir également
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!