フィルターのクリア

How to enclose a line using regionprops and rectangle function

2 ビュー (過去 30 日間)
suvendra sahoo
suvendra sahoo 2014 年 1 月 8 日
回答済み: Image Analyst 2014 年 1 月 8 日
Dear Image analyst,
I am having two english text lines. I want to enclose individual lines in a rectangle with red color. Can you tell me how can i do this using regionprops and rectangle function.
Waiting for your reply
Suvendra

回答 (1 件)

Image Analyst
Image Analyst 2014 年 1 月 8 日
A simplistic way (probably too simplistic):
  1. Threshold: binaryImage = grayImage < 128;
  2. call imclose to connect nearby letters: binaryImage = imclose(binaryImage, true(7));
  3. call regionprops and ask for BoundingBox measurements = regionprops(binaryImage, 'BoundingBox');
  4. call rectangle() or plot() to draw the box.
Give it a shot. Come back if you can't figure out that algorithm (though I've given 3 out of 4 lines of it so it should be easy to finish the rest of it).

カテゴリ

Help Center および File ExchangeGPU Computing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by