Info

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

remove dead spaces between peaks in progection

1 view (last 30 days)
Mariam Alharthi
Mariam Alharthi on 21 Dec 2016
Closed: MATLAB Answer Bot on 20 Aug 2021
I make a vertical projection of a handwritten word image by using this code:
imread('a1.bmp');
verticalProjection = sum(ans,1); %vertical projection
subplot(2,2,1);imshow(ans);
subplot(2,2,3);plot(verticalProjection, 'b-');
grid on;
darkPixels = verticalProjection < 1; %threshold
[labeldRegions, numberOfRegions] = bwlabel(darkPixels); %label
fprintf('Number of regions = %d\n', numberOfRegions);
and this is an output:
I want to remove (crop) the dead spaces which are 2 spaces here in this image in order to remove these spaces from image itself (between part of a word) and get the word image without spaces as an output. any one can help me please?

Answers (0)

Community Treasure Hunt

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

Start Hunting!