How to classify these images as straight, left oriented, right oriented. Which method i can apply.? Couldn't find any methods after a lot of searching. can you help me.
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Karthik K
am 18 Dez. 2018
Kommentiert: Karthik K
am 18 Jun. 2019



4 Kommentare
Walter Roberson
am 18 Dez. 2018
Threshold to black and white. imfill() the holes. Then do the regionprops.
Akzeptierte Antwort
Image Analyst
am 18 Dez. 2018
What I'd do is to extract the lower portion of the image. Then compute the location of the weighted centroid. If it's way off to the left, it's let facing. If it's to the right of the mid line, it's right facing. If it's reasonally close to the middle, it's symmetrical. Untested code
lowerRow = round(size(grayImage, 1) * 0.75);
subImage = grayImage(lowerRow:end, :)
mask = true(size(subImage));
props = regionprops(mask, subImage, 'WeightedCentroid');
xCentroid = props.WeightedCentroid(1); % Get x centroid.
columns = size(subImage, 2));
if xCentroid < 0.4 * columns
% Facing left
elseif xCentroid > 0.6 * columns
% Facing right
else
% Symmetrical so facing forward.
end
You might have to check the 04 and .6 with actual images to see where the centroid actually lies for a good sampling of real world images.
7 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Image Processing Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!