For Programmers: Free Programming Magazines  


Home > Archive > Matlab > March 2007 > A filter function using if..









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author A filter function using if..
nikos

2007-03-25, 4:18 am

i want to make a filter using nlfilter.

the exable from Matlab says:

A=imread('cameraman.tif');
fun=@(x) median(x(:));
B=nlfilter(A,[5 5],fun);
imshow(a),figure,imshow(B);

The output value of the function fun is the median value.

i want to do the following:

If mean value is greater than median
the function fun returns the mean
else
the function fun returns the median

CAN ANYONE HELP ME WITH THIS?
Markus

2007-03-31, 7:09 pm

Write an m-file fun.m and put your functionality in it. Anonymous
functions are horribly slow, by the way.

Markus
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com