# Matlab Program to Process Digital Image Assignment Solution.

## Instructions

Objective
Write a matlab program to process digital image in matlab.

## Requirements and Specifications

Source Code

```function imAve(fname, M)     %% First, read the image     A = imread(fname);     %% Convert image to double     A = im2double(A);     %% Now, create a 3D matrix to store the matrices     A_noise = zeros(M, size(A,1), size(A,2), 3);     %% Now, create M noisy images     for m = 1:M         %% Create Noisy Image         A1 = imnoise(A, 'gaussian');         %% Store this noisy image in the 3D matrix         A_noise(m, :, :, :) = A1;     end     %% Now,average all noisy images     Aavg = squeeze(sum(A_noise(:, :, :, :), 1))/M;     %% Finally, select randomly one of the noisy images and plot it along with the avg image     idx = randi(M);     %% Plot     figure     subplot(1,3,1)     imshow(A)     title(sprintf('Original Image (M = %d)', M))     subplot(1,3,2)     imshow(squeeze(A_noise(idx, :, :, :)));     title(sprintf('Noisy (M = %d)', M))     subplot(1,3,3)     imshow(Aavg)     title(sprintf('Average Image (M = %d)', M)) end```