Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function [ image_avaraged ] = filter_avarage( image, avaraging_area )
- if mod(avaraging_area, 2) == 0 || avaraging_area < 3
- exception = MException('VerifyOutput:OutOfBounds', ...
- 'Results are outside the allowable limits');
- throw(exception);
- end
- image_avaraged = image;
- for y = 1 + floor(avaraging_area / 2):size(image, 1) - floor(avaraging_area / 2),
- for x = 1 + floor(avaraging_area / 2):size(image, 2) - floor(avaraging_area / 2),
- area = image(y - floor(avaraging_area / 2):y + floor(avaraging_area / 2), ...
- x - floor(avaraging_area / 2):x + floor(avaraging_area / 2));
- avarage = sum(sum(area)) / (avaraging_area.^2);
- image_avaraged(y, x) = avarage;
- end
- end
- end
Add Comment
Please, Sign In to add comment