how to find the biggest horizontal length in a rectangular window
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Elysi Cochin
il 17 Gen 2015
Commentato: Elysi Cochin
il 20 Gen 2015
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...
0 Commenti
Risposta accettata
Image Analyst
il 17 Gen 2015
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 Commenti
Image Analyst
il 19 Gen 2015
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.
Più risposte (0)
Vedere anche
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!