フィルターのクリア

plot noise

4 ビュー (過去 30 日間)
ahmed
ahmed 2012 年 2 月 7 日
回答済み: Sanchari 2024 年 7 月 25 日 3:30
Hi,
Please, what the name of the function that plot this noise, I want to understand the work of this function, what is the appropriate titles of the horizontal and vertical coordinates after the plot the noise?
% Noisy step
step = 1+[ones([32 64]) ; zeros([32 64])];
noise = 0.1 * randn(size(step));
im = (step + noise);
im = double(im);
figure(1), clf;
subplot(1,2,1); imshow(im,[0,3]);
figure(2); clf; ;
plot(im(:,32));

回答 (1 件)

Sanchari
Sanchari 2024 年 7 月 25 日 3:30
Hello Ahmed,
The code provided here generates and plots a noisy step image. Here is a breakdown of the code and the appropriate titles for the horizontal and vertical coordinates:
1. Generating the Step Image: The following code creates a 64x64 matrix "step" where the top half (32 rows) is filled with ones, and the bottom half (32 rows) is filled with zeros. Adding 1 to the entire matrix makes the top half filled with 2s and the bottom half filled with 1s.
step = 1 + [ones([32 64]) ; zeros([32 64])];
2. Adding Noise: This adds Gaussian noise with a standard deviation of 0.1 to the step image. The "randn" function generates normally distributed random numbers. The resulting noisy image is stored in "im".
noise = 0.1 * randn(size(step));
im = (step + noise);
im = double(im);
3. Displaying the Noisy Step Image: This displays the noisy step image using the "imshow" function. The [0, 3] range specifies the display range for the image.
figure(1), clf;
subplot(1,2,1); imshow(im, [0, 3]);
4. Plotting a Column of the Noisy Image: This plots the values of the 32nd column of the noisy image. The "plot" function is used to create the plot.
figure(2); clf;
plot(im(:,32));
When plotting the noisy step image and the column of the noisy image, appropriate titles for the horizontal and vertical coordinates can help in understanding the data. Here's a sample code including the same:
% Generate the step image
step = 1 + [ones([32 64]) ; zeros([32 64])];
% Add Gaussian noise
noise = 0.1 * randn(size(step));
im = (step + noise);
im = double(im);
% Display the noisy step image
figure(1), clf;
subplot(1,2,1);
imshow(im, [0, 3]);
title('Noisy Step Image');
xlabel('Pixel Column');
ylabel('Pixel Row');
% Plot the values of the 32nd column of the noisy image
figure(2); clf;
plot(im(:,32));
title('Intensity Values of the 32nd Column');
xlabel('Pixel Row Index');
ylabel('Intensity Value');
Output for the above code:
Hope this helps!

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by