struck with this code

5 vues (au cours des 30 derniers jours)
Jim
Jim le 8 Juin 2012
Hi,
I need to know , how this code is working
windowSize = 8;
Filter = filter(ones(1,windowSize)/windowSize,1,cog(:));
cog1 = Filter (10:end,:);
Can any one explain me about this code
Thanks in advance

Réponses (2)

Guilherme
Guilherme le 8 Juin 2012
Hello
You are basically filtering the data from the "cog" vector using a Digital Filter, which is done with the command:
Filter = filter(ones(1,windowSize)/windowSize,1,cog(:));
In this case, the filter in question is a FIR with the coefficients specified from the command :
ones(1,windowSize)/windowSize
The last command just copies a part from the filtered data into another vector (starting from 10 to the end). You can read more about FIR filters on http://en.wikipedia.org/wiki/Finite_impulse_response if you have any question about them. You can also check each command's help on MATLAB, they are very useful and well-described. Try:
help fitler
help ones

Image Analyst
Image Analyst le 8 Juin 2012
It blurs the image in a sliding 8 element wide box. The "cog" image will be blurred horizontally only, not vertically. Then you are extracting the top 10 rows of the blurred image into another image called cog1.

Catégories

En savoir plus sur Image Processing Toolbox dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by