Question

In: Electrical Engineering

Generate a noisy image by adding salt and pepper noise to a clean image (try to...

Generate a noisy image by adding salt and pepper noise to a clean image (try to add moderate to low level of noise).

Now, investigate the effects of the following on the noisy image:

The filter size (e.g. 3´3 and 7´7) for the median filter.

Repeated application of a 3´3 median filter for several times

%matlab code is needed

Solutions

Expert Solution

Hello,
          Please find the answer attached as under. Please give a thumbs up rating if you find the answer useful! Have a rocking day ahead!
**** Matlab Code *****

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% median filtering for removing salt and pepper noise

% Read image into workspace
I = imread('eight.tif');

%Add salt and pepper noise.
J = imnoise(I,'salt & pepper',0.02);
%Use a median filter to filter out the noise.
K1 = medfilt2(J);
K2 = medfilt2(J,[7 7]);
K3 = medfilt2(J,[9 9]);

%Display all results
figure;
subplot(2,2,1);
imshow(J)
title('original image with noise')
subplot(2,2,2);
imshow(K1)
title('image filtered with 3x3')
subplot(2,2,3);
imshow(K2)
title('image filtered with 7x7')
subplot(2,2,4);
imshow(K3)
title('image filtered with 9x9')

%%%%%%%%%% Progressive filtering with 3x3 filter
figure;
subplot(2,2,1);
imshow(J)
title('original image with noise')
subplot(2,2,2);
imshow(K1)
title('image filtered with 3x3')
K4 = medfilt2(K1);
subplot(2,2,3);
imshow(K4)
title('image filtered with 3x3 twice')
K5 = medfilt2(K4);
subplot(2,2,4);
imshow(K5)
title('image filtered with 3x3 thrice')

**** End of Code ****

Output:

We see that in both the cases of filtering, the final image gets progressively blurred. However, the effect of blurring is more pronounced in the 7x7 and the 9x9 cases. The same also happens when the 3x3 filter is repeatedly applied. Noise removal is optimal in the 3x3 case.


Related Solutions

Balance sheets for Salt Company and Pepper Company on December 31, 2018, follow: Salt Pepper ASSETS...
Balance sheets for Salt Company and Pepper Company on December 31, 2018, follow: Salt Pepper ASSETS Cash $ 95,000 $ 180,000 Receivables 117,000 230,000 Inventories 134,000 231,400 Plant assets   690,000   1,236,500 Total assets $1,036,000  $1,877,900 EQUITIES Accounts payable $ 180,000 $ 255,900 Mortgage payable 152,500 180,000 Common stock, $20 par value 340,000 900,000 Other contributed capital 179,500 270,000 Retained earnings   184,000    272,000 Total equities $1,036,000  $1,877,900 Pepper Company tentatively plans to issue 30,000 shares of its $20 par value stock,...
On August 1, 2014, Salt, Pepper, and Spice agree to liquidate their partnership. Salt has a...
On August 1, 2014, Salt, Pepper, and Spice agree to liquidate their partnership. Salt has a capital balance of $90,000, Pepper has a capital balance of $37,500, and Spice has a capital balance of $30,000. The partners share net income/net loss in a ratio of 4:3:3. Accounts payable amount to $60,000. Assets are shown on the balance sheet at $40,000 of cash and $177,500 of noncash assets. All the noncash assets are sold for $159,500. Prepare entries to sell the...
Pepper Company acquired all of Salt Corporation’s outstanding shares on December     31, 2017 for $750,000 cash.  Pepper...
Pepper Company acquired all of Salt Corporation’s outstanding shares on December     31, 2017 for $750,000 cash.  Pepper will operate Salt as a wholly owned     subsidiary with a separate legal and accounting identity.  Although many of Salt’s     book values approximate fair values, several of its accounts have a fair values that     differ from book values.  In addition, Salt has internally developed assets that remain     unrecorded on its books.  In deriving the acquisition price, Pepper assessed Salt’s     fair and book value differences as follows: Account Book...
Pepper Company acquired all of Salt Corporation’s outstanding shares on December     31, 2017 for $750,000 cash.  Pepper...
Pepper Company acquired all of Salt Corporation’s outstanding shares on December     31, 2017 for $750,000 cash.  Pepper will operate Salt as a wholly owned     subsidiary with a separate legal and accounting identity.  Although many of Salt’s     book values approximate fair values, several of its accounts have a fair values that     differ from book values.  In addition, Salt has internally developed assets that remain     unrecorded on its books.  In deriving the acquisition price, Pepper assessed Salt’s     fair and book value differences as follows: Account Book...
Pepper Enterprises owns 95 percent of Salt Corporation. On January 1, 20X1, Salt issued $200,000 of...
Pepper Enterprises owns 95 percent of Salt Corporation. On January 1, 20X1, Salt issued $200,000 of five-year bonds at 115. Annual interest of 12 percent is paid semiannually on January 1 and July 1. Pepper purchased $100,000 of the bonds on July 1, 20X3, at par value. The following balances are taken from the separate 20X3 financial statements of the two companies:   Pepper Enterprises Salt Corporation Investment in Salt Corporation Bonds $ 100,000 Interest Income 6,000 Interest Receivable 6,000 Bonds...
Salt Co. and Pepper Co. are in the same business and sell the same merchandise but...
Salt Co. and Pepper Co. are in the same business and sell the same merchandise but have different inventory systems: Salt’s is perpetual and Pepper’s is periodic. Both companies sell their products at a price of $10 each, and their inventory activity for March of 2020 is presented below. Salt Date Description # of Units Unit Price Total Cost 02/29/20 Beginning Inventory 50 $1 $50 03/08/20 Purchase 1 50 $2 $100 03/15/20 Sale 90 03/22/20 Purchase 2 50 $3 $150...
Pepper Ltd. delivers 500 units of product to Salt Corp. The sales price was $125 per unit, and Pepper’s cost was $75 per unit. Pepper
Pepper Ltd. delivers 500 units of product to Salt Corp. The sales price was $125 per unit, and Pepper’s cost was $75 per unit. Pepper has agreed that Salt may return any unused product within 60 days and receive a full refund. Based on historical experience with Salt, Pepper estimates that 10% of the units will be returned, but Pepper will be able to resell any returned units. Required:1. What is the value of the right to recovery asset?2. What...
On January 1, 20X7, Pepper Company acquired 90 percent of the outstanding common stock of Salt...
On January 1, 20X7, Pepper Company acquired 90 percent of the outstanding common stock of Salt Corporation for $1,242,000. On that date, the fair value of noncontrolling interest was equal to $138,000. The entire differential was related to land held by Salt. At the date of acquisition, Salt had common stock outstanding of $520,000, additional paid-in capital of $200,000, and retained earnings of $540,000. During 20X7, Salt sold inventory to Pepper for $440,000. The inventory originally cost Salt $360,000. By...
On January 1, 20X7, Pepper Company acquired 90 percent of the outstanding common stock of Salt...
On January 1, 20X7, Pepper Company acquired 90 percent of the outstanding common stock of Salt Corporation for $1,242,000. On that date, the fair value of noncontrolling interest was equal to $138,000. The entire differential was related to land held by Salt. At the date of acquisition, Salt had common stock outstanding of $520,000, additional paid-in capital of $200,000, and retained earnings of $540,000. During 20X7, Salt sold inventory to Pepper for $440,000. The inventory originally cost Salt $360,000. By...
A tank initially contains 10 liters of clean water (with no salt in it). Every minute,...
A tank initially contains 10 liters of clean water (with no salt in it). Every minute, a solution containing one liter of water and one gram of salt is added to the tank, and two liters of fluid are drained from the tank. The fluid in the tank is mixed continuously so that the salt is distributed evenly throughout the water in the tank. How many minutes does it take for the tank to contain 2 grams of salt?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT