필터 지우기
필터 지우기

Help with word segmentation

조회 수: 4 (최근 30일)
shru s
shru s 2017년 6월 8일
답변: Akshay Raj 2020년 1월 8일
I have the following image
I have been trying to segment it into 2 words but i have not been able to. could anyone please help me with this.

채택된 답변

Rik
Rik 2017년 6월 8일
A quick and dirty method that may not always work is this:
IM=imread('li.jpg');
IM=IM(321:472,97:1106,:);%crop white field
IM_BW=mean(IM,3)/255;%convert to grey scale double
IM_projection=logical(max(IM_BW,[],1));
idx_end=find(diff(IM_projection)<0);%col index where a letter ends
idx_start=find(diff(IM_projection)>0);%col index where a letter ends
%This may not be true if the letters are kerned
distance=idx_start(2:end)-idx_end(1:(end-1));
split_col_idx=idx_end([distance>50 false])+1;%50 is a threshold distance
%split_col_idx contains the column where you should split the words
The result here is that you should split at columns 465 and 713 in the cropped image, which is indeed after the y and the s.
  댓글 수: 3
Rik
Rik 2017년 6월 8일
Experience. Learn from your mistakes and the mistakes from others. Muck about, just trying stuff. As long as it is not your job to develop Matlab code, it is OK to make stupid mistakes, so make them and learn from them.
If you want more advice (and with more helpful resources), check out this post.
(and if my answer helped you, please hit the button to accept it)
As for saving the separate files, check out the function imwrite. You can open the documentation by typing doc imwrite in the Matlab command prompt. If you are unsure of how to actually split the file, have a look at my second line of code. (that's another free tip: steal and adapt code from others (but do give them credit when you share your adapted version))
shru s
shru s 2017년 6월 11일
Thank you so much for your help!

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

추가 답변 (1개)

Akshay  Raj
Akshay Raj 2020년 1월 8일
I WANT TO EXTRACT WORD LEVEL AND NEED TO SAVE THOSE WORDS IN A FOLDER ANYBODY KNOWS PLESE HELP ME OUT

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by