i want to segment the horizontal row of characters from a image for which i am using code given below to the images i cant get why working process is "stucking after the histogram process" and after some time it start again with taking image as input and showing it's histogram and taking too much time then repeating the same. some one please help me to code it correctly i can't find where there is error and i am also confused at
darkPixels = h< 1500; % Threshold label
line of code i am not very sure what value i need to take whether it be h< 1500 or something else Please help with regards
% Find the dark lanes that define the zones between the lines with letters on them.
% Rather than find the letters themselves, we will find the dark spaces between the lines.
% Then we will go from the center of each one of those to the center of the next one down the page.
darkPixels = h< 1500; % Threshold label
[labeledRegions, numberOfRegions] = bwlabel(darkPixels);
fprintf('Number of regions = %d\n', numberOfRegions);
% Find centroids
measurements = regionprops(labeledRegions, 'Centroid');
% Get them into an array
allCentroids = [measurements.Centroid];
xCentroids = int32(allCentroids(1:2:end));
yCentroids = int32(allCentroids(2:2:end));
fprintf('I found %d black spaces between the lines of text\n', length(yCentroids));
% Now you can just crop out some line of text you're interested in, into a separate image:
plotLocation = 12;
for band = 1 : numberOfRegions-1
row1 = xCentroids(band);
row2 = yCentroids(band+1);
thisLine = a(row1 : row2, :);
pause(3)
subplot(10, 2, plotLocation);
pause(3)
imshow(thisLine, []);
pause(3)
plotLocation = plotLocation + 2;
end

