pixel based classification .

I have to do pixel based classification. for that I have used texture feature of entire image (like wavelet,lows). now I have to get neighbourwood sliding window(3,5,7) of this image and replace central pixel with the avg of neighbour and calulate mean,varience, energy of this and make a feature vector where rows are sample space and column are feature space. So far I have got the wavelet trasform how to procced for windowing process?
my approch- calculate texture (wavelet trasform) take nxn(3,5,7) neighbourhood calculate energy,mean,skewness,kurtosis in nXn neighbourhood(dont know how to get?)

 Accepted Answer

Adam
Adam on 31 Aug 2016
Edited: Adam on 31 Aug 2016
doc nlfilter
should help for a 2d image. It contains an example for median. Mean, variance, etc will be similar.

5 Comments

ashu
ashu on 31 Aug 2016
Edited: ashu on 1 Sep 2016
Thanks adam, I am going to try it , I got matrix after nlfilter how to get feature space of every pixel by calculating mean,var of nlfilter output,I need to get sample and feature space of it.
I'm going to assume you really didn't mean "replace the avg of neighbour with central pixel" and actually meant "replace the central pixel with the average of its neighbours."
For that, you can use imfilter() or conv2():
windowSize = 5;
kernel = one(windowSize)/ windowSize^2;
meanImage = conv2(grayImage, kernel, 'same');
meanImage = imfilter(grayImage, kernel); % Alternative
That will be much faster than nlfilter. For the others you'll still need nlfilter.
ashu
ashu on 1 Sep 2016
Edited: ashu on 1 Sep 2016
I will edit that, thanks for your comment Image analyst. I have calculated mean,varience of the meanImage which is coming row vector 1x1480 for 42 Image, I am using 42 images so the feature vector for (mean,var feature)it will be 42x1480 right? am I doing something wrong I need this feat vec for classification (I have read about pixel based classification that rows should be sample space of pixels whereas cols should be feature space),the feat vec I am getting too big feat_vec,is it wrong approach for pixel based feature extraction? please suggest
You need to give a dimension/direction. See the help. If you don't, they give the computations on a "per column" basis, which is why you ended up with a row vector.
To get the value for an entire image:
meanOfEntireImage = mean(grayImage(:)); % or
meanOfEntireImage = mean2(grayImage);
For a 2D array you can use mean2(), std2(), medfilt2().
Thanks for instant reply Image analyst I am going to try this.

Sign in to comment.

More Answers (0)

Categories

Asked:

on 31 Aug 2016

Edited:

on 1 Sep 2016

Community Treasure Hunt

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

Start Hunting!