Guest User

Untitled

a guest
Jun 18th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. function [ image_medianed ] = filter_median( image, median_area )
  2. if mod(median_area, 2) == 0 || median_area < 3
  3. exception = MException('VerifyOutput:OutOfBounds', ...
  4. 'Results are outside the allowable limits');
  5. throw(exception);
  6. end
  7. image_medianed = image;
  8. for y = 1 + floor(median_area / 2):size(image, 1) - floor(median_area / 2),
  9. for x = 1 + floor(median_area / 2):size(image, 2) - floor(median_area / 2),
  10. area = image(y - floor(median_area / 2):y + floor(median_area / 2), ...
  11. x - floor(median_area / 2):x + floor(median_area / 2));
  12. image_medianed(y, x) = median(reshape(area, [], 1));
  13. end
  14. end
  15. end
Add Comment
Please, Sign In to add comment