Info

此问题已关闭。 请重新打开它进行编辑或回答。

My task is to segment the line into individual words and display all the words separately. Please help me..

1 次查看(过去 30 天)
clc;
clear all;
close all;
warning off;
lin = imread('C:\Users\Sabari\Desktop\proj2\image\line.jpg');
subplot(2,2,1);imshow(lin);
verticalProjection = sum(lin,1);
subplot(2,2,2);
plot(verticalProjection, 'b-');
grid on;
binarySignal = verticalProjection < 100;
% Get rid of runs less than 20
binarySignal = bwareaopen(binarySignal, 20);
% Label and find centroids of remaining big gaps
[labeledSignal,numberOfRegions] = bwlabel(binarySignal);
measurements = regionprops(labeledSignal, 'Centroid');
% Extract word 1 as a new image.
plotLocation = 12;
for band = 1 : numberOfRegions-1
% row1 = yCentroids(band);
% row2 = yCentroids(band+1);
word1 = lin(:, 1:measurements(1).Centroid);
subplot(2,2,3);imshow(word1);
imwrite(word1,'word.jpg');
% subplot(10, 2, plotLocation);
imshow(word1, []);
plotLocation = plotLocation + 2;
end

回答(0 个)

此问题已关闭。

Community Treasure Hunt

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

Start Hunting!

Translated by