필터 지우기
필터 지우기

How to obtain the array of black pixel columnwise??

조회 수: 3 (최근 30일)
Poornima Gokhale
Poornima Gokhale 2015년 12월 15일
댓글: Poornima Gokhale 2015년 12월 17일
here I want to get the size of the letter.For that i want the array of black pixels columnwise.I know to calculate the entire pixels of the word.But please help me with this.

채택된 답변

Walter Roberson
Walter Roberson 2015년 12월 15일
col_idx_first_black = sum(cumprod(YourImage,1)) + 1;
col_idx_last_black = size(YourImage,1) - sum(cumprod(flipud(YourImage),1));
col_letter_size = max(0, col_idx_last_black - col_idx_first_black + 1);
Note: col_letter_size will be 0 for columns that contain no black. The first occupied row for the column will be in col_idx_first_black and the last occupied row for the column will be in col_idx_last_black (but those will have misleading values if the row has no black.)
  댓글 수: 8
Walter Roberson
Walter Roberson 2015년 12월 17일
It is visiting every column and locating the first black pixel in the column and returning the row index within the column. It also visits every column and locates the last black pixel in the column and returns the row index within the column. It also calculates the difference between the first and last index for each column in order to tell you the "size" in rows of the letter in that column -- but keep in mind that two columns that are the same "size" for the letter might have very different locations within the column.
The total number of rows in the image is size(YourImage,1)
Poornima Gokhale
Poornima Gokhale 2015년 12월 17일
thanks a lot sir.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image and Video Ground Truth Labeling에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by