![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/172487/image.png)
how to segment/crop words from a line in an image in matlab?
1 次查看(过去 30 天)
显示 更早的评论
Hello, Im trying to segment/crop words from the line in an image.(this line is obtained by segmenting line from paragraph)
How do i achieve this?Please help me with the code. Here is the input image.
Thank you in advance.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/153219/image.png)
0 个评论
采纳的回答
harjeet singh
2016-1-13
use this code
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/172487/image.png)
clear all
close all
clc
img=imread('line2.png');
img1=bwareaopen(~img,100);
se=strel('disk',7);
img2=imdilate(img1,se);
[lab,num]=bwlabel(img2);
figure(1)
for i=1:num
[r,c]=find(lab==i);
img4=img(:,min(c):max(c));
subplot(4,4,i)
imshow(img4)
end
更多回答(2 个)
Image Analyst
2016-1-13
I answered this in your comment in the other discussion. http://www.mathworks.com/matlabcentral/answers/67860-crop-an-image-per-words#comment_335177
I took your m-file there and fixed it. Your fixed code is attached.
0 个评论
Akshay Raj
2020-1-8
i need to extarct word level in this image and need to store those segmented image in an folder .please hel me out to do this![dt1.jpg](https://www.mathworks.com/matlabcentral/answers/uploaded_files/260394/dt1.jpeg)
![dt1.jpg](https://www.mathworks.com/matlabcentral/answers/uploaded_files/260394/dt1.jpeg)
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!