Clear Filters
Clear Filters

Info

This question is closed. Reopen it to edit or answer.

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

1 view (last 30 days)
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

Answers (0)

This question is closed.

Community Treasure Hunt

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

Start Hunting!