フィルターのクリア

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.

5 ビュー (過去 30 日間)
Straight.png Left.png Right.png
  4 件のコメント
Walter Roberson
Walter Roberson 2018 年 12 月 18 日
Threshold to black and white. imfill() the holes. Then do the regionprops.
Karthik K
Karthik K 2018 年 12 月 19 日
Now its 22*1 struct field with highest value at the 1st position.
MajorAxisLength = 446.005497994246
MinorAxisLength = 277.216494649624.
How can i further move on sir?
Also if we need to present according to degree orientation shown below. how to proceed. Any idea.?
180 degree <---- ------> 90 degree
|
0 degree

サインインしてコメントする。

採用された回答

Image Analyst
Image Analyst 2018 年 12 月 18 日
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 件のコメント
Image Analyst
Image Analyst 2019 年 6 月 17 日
And what happened when you tried it? Did it work?
Karthik K
Karthik K 2019 年 6 月 18 日
It works but 0.6 and 0.4 has to be varied accordingly for each images.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Data Workflows についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by