Reputation: 4688
Hello i'm having problem with segmentation of the following picture below. It's coloured character which needs to be recognized. I'm using sharpening, wiener deblurring and wiener smoothing. After that i'm segmenting the picture with fuzzy-c means clustering (3-class). But in the case of letter E the best i get is without sharpenin,deblurring and smoothing, just with thresholded fcm segmentation. I should however get a better result than this, where i could combine those two parts as a whole (not just upper white part with the other half black).
How could i solve this problem to be more robust and to work with other images also, for example the 5 in the picture? The outcome of 5 is with sharpening, debluring and smoothing, on top of fcm clustering. How could i make it more connected maybe?
I would really appreciate any help i could get, please, oh and I'm doing this in matlab...so it would be nice to get any help from there, thank you!
EDIT:
My following code is this: function [bw,level]=fcmthresh(IM,sw) if (nargin<1) error('You must provide an image.'); elseif (nargin==1) sw=0; elseif (sw~=0 && sw~=1) error('sw must be 0 or 1.'); end
data=reshape(IM,[],1);
[center,member]=fcm(data,3);
[center,cidx]=sort(center);
member=member';
member=member(:,cidx);
[maxmember,label]=max(member,[],2);
if sw==0
level=(max(data(label==1))+min(data(label==2)))/2;
else
level=(max(data(label==2))+min(data(label==3)))/2;
end
bw=im2bw(IM,level);
function img=wienerDeblur(im)
ImgNoisyBlurry = im2double(im);
PSF = fspecial('laplacian'); %LEN, THETA add parameters for 'motion'
noise_var = 0.0001; %0.0001
estimated_nsr = noise_var / var(ImgNoisyBlurry(:));
wnr3 = deconvwnr(ImgNoisyBlurry, PSF, estimated_nsr);
img = wnr3;
end
H = fspecial('unsharp');
im = imfilter(im,H,'replicate');
im = wienerDeblur(im);
im = wienerSmoothing(im);
Thats all of the code, plus i'm using just fcmthres for letter E, cause it works the best. I read about morphological image processing (dilation, erosion) so that might do the trick perhaps.
Are there any better technics for image contrasting and noise removal?
Upvotes: 4
Views: 2319
Reputation: 18560
after you have it in black and white you can use Singular Value Decomposition (http://en.wikipedia.org/wiki/Singular_value_decomposition) and you can probably compare the singular values.
For noise removal set the smaller singular values to 0.
Upvotes: 0
Reputation: 169
You can try canny edge detection on h-channel (try all channels and compare) (rgb2hsv) followed by morphological operations to close curves and fill (imfill) the curves of numbers and letters. I dont have access to matlab now, but have had success with this on a similar problem.
http://www.mathworks.se/help/techdoc/ref/rgb2hsv.html http://www.mathworks.se/help/toolbox/images/ref/edge.html http://www.mathworks.se/help/toolbox/images/ref/imfill.html
Upvotes: 1