How to write the code for detect horizontal or vertical line?
古いコメントを表示
I have an image that has a one line.
starting, I try to write the code to input my image , change rgb color to gray and crop the image. As the picture below
but I don't know how to write for detect that is a vertical line. if I found the threshold value of intensity of dark color it about 73
It's difficule because It's the first time I use Mablab for my research.
Come on to comment if you use to write it TT
Loveee ูู^^
I try to write it but I don't have the ideaTT

回答 (1 件)
Image Analyst
2019 年 2 月 23 日
0 投票
I don't see any obvious lines in that image. But take a look at hough() or houghlines().
4 件のコメント
Ajaree Rattanaharn
2019 年 2 月 23 日
Image Analyst
2019 年 2 月 23 日
Again, I don't see a line. Why can't you draw it in red over your image?
What is your 2D TT? A photo of your Audi automobile? It's pretty much the only thing that comes up in Google for TT.
zineb kaoudja
2019 年 3 月 20 日
I think he wants to know the orientation of this shape/object (the black area) is it horizontal or vertical?
Image Analyst
2019 年 3 月 21 日
You can threshold and use regionprops to look at the width and height of the bounding box.
binaryImage = Igray < someValue; % Threshold/binarize image.
binaryImage = bwareafilt(binaryImage, 1); % Extract largest blob.
props = regionprops(binaryImage, 'BoundingBox'); % Measure boundign box.
width = props.BoundingBox(3);
height = props.BoundingBox(4);
if height > width
% Blob is vertical
end
カテゴリ
ヘルプ センター および File Exchange で Image Processing Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!