Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
My task is to segment the line into individual words and display all the words separately. Please help me..
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (0)
Diese Frage ist geschlossen.
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!