how to find the biggest horizontal length in a rectangular window

2 ビュー (過去 30 日間)
Elysi Cochin
Elysi Cochin 2015 年 1 月 17 日
コメント済み: Elysi Cochin 2015 年 1 月 20 日
how to find the biggest horizontal length of the individual contours which are present inside the rectangular window...
i have binarized the image and selected a rectangular portion, now in need to compute the biggest horizontal length inside the rectangular window....
please do reply...

採用された回答

Image Analyst
Image Analyst 2015 年 1 月 17 日
Simply binarize your lines by thresholding,
binaryImage = grayImage < 128;
then call bwlabel,
labeledImage = bwlabel(binaryImage);
then call
stats = regionprops(labeledImage, 'BoundingBox')
then extract all the bounding boxes
allBB = [stats.BoundingBox];
Then look for the blob number with the largest 3rd index of allBB - use the max() function and both output arguments. I know from your other questions that you already know how to do all these steps so let me know if you have problems.
  2 件のコメント
Image Analyst
Image Analyst 2015 年 1 月 19 日
No. You have to extract the widths from the bounding box array. The width is the third element of each BB which means it shows up in elements 3, 7, 11, etc. of the concatenated array of all the BBs. I believe (just off the top of my head) that you do this:
widths = allBB(3:4:end);
Then sort that and find the index of the blob with the widest width
[maxWidth, indexOfWidestBlob] = max(widths);
No need for any for loop. Attach your original image without all that annotation if you want any more help.
Elysi Cochin
Elysi Cochin 2015 年 1 月 20 日
thank you sir... i understood...

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

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by