SHARE
TWEET

Untitled

a guest Jun 18th, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. clc;
  2. close all;
  3. clear all;
  4.  
  5.  
  6. %Problem 1a Meanmask
  7. I=imread('Circuit.jpg'); % Load the image
  8. MeanFilter=I;
  9.  
  10. N=3;
  11. n=N*N;
  12. % Generate a random mask whose samples sums up to 01
  13. mask_val = (diff([0,sort(randi([0,100-n],1,n-1)),100-n])+ones(1,n))/100;
  14. mask = reshape(mask_val,[N N]);
  15. % Apply the mask
  16. R3MeanFilter= apply_mask(MeanFilter,mask);
  17.  
  18. %NEED TO CHANGE FROM AVERAGING mask TO STANDARD
  19. N=5;
  20. n=N*N;
  21. % Generate a random mask whose samples sums up to 01
  22. mask_val= (diff([0,sort(randi([0,100-n],1,n-1)),100-n])+ones(1,n))/100;
  23. mask=reshape(mask_val,[N N]);
  24. % Apply the mask
  25. R5MeanFilter= apply_mask(MeanFilter,mask);
  26.  
  27. figure;
  28. subplot(1,3,1);
  29. imshow(MeanFilter);
  30. title('Original Image');
  31. subplot(1,3,2)
  32. imshow(R3MeanFilter);
  33. title('3*3 Averaging mask');
  34. subplot(1,3,3)
  35. imshow(R5MeanFilter);
  36. title('5*5 Averaging mask');
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top