フィルターのクリア

How to draw a horizontal line passing through the given points?

1 回表示 (過去 30 日間)
Poornima Gokhale
Poornima Gokhale 2015 年 12 月 17 日
コメント済み: Poornima Gokhale 2015 年 12 月 18 日
I have a word in which I have the row index of the first black pixel in the column and the row index of the last black pixel in the column. So I want to draw a horizontal line joining all the first black pixels and all the last black pixels so that i can get the size of the word from those lines. Please help me with the code. First pixels
last pixels

回答 (2 件)

Image Analyst
Image Analyst 2015 年 12 月 17 日
Let's say your image is called grayImage, and that your pixel columns are called "firstPixels" and "lastPixels" and of course you have your row indexes "firstRow" and "lastRow". So then just loop
for k= 1 : length(firstPixels)
% Set row to zero for this word in the first row.
grayImage(firstRow, firstPixels(k):lastPixels(k)) = 0;
% Set row to zero for this word in the last row.
grayImage(lastRow, firstPixels(k):lastPixels(k)) = 0;
end
  3 件のコメント
Image Analyst
Image Analyst 2015 年 12 月 18 日
You have to call imshow() after you change the grayImage variable.
If you don't want lines burned into the image, you can use the line() function to put it into the graphical overlay.
Poornima Gokhale
Poornima Gokhale 2015 年 12 月 18 日
What does this grayImage function do?

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


Image Analyst
Image Analyst 2015 年 12 月 18 日
You might want to look at Brett's File Exchange submission: http://www.mathworks.com/matlabcentral/fileexchange/48466-text-recognizer

カテゴリ

Help Center および File ExchangeConvert Image Type についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by