This answer for this Question in StackOverflow.
Morhpological Closing Theory Link
Matlab Code
% Read Image
img = imread('Noisy_Text.jpg');
% Structuring Element
SE=zeros(3,3);
SE(1,1)=1;
SE(1,3)=1;
SE(2,2)=1;
SE(3,1)=1;
SE(3,3)=1;
% Morphological Closing
Imdilte=imclose(img,SE);
% Plot the Results
figure();
subplot(1,2,1);
imshow(Imdilte)
subplot(1,2,2);
imshow(img);