How to Remove Noise

17 views (last 30 days)
agung pratama
agung pratama on 21 Jul 2020
Edited: Purvaja on 31 Jan 2025 at 8:09
Hello Guys, I'm a newbie in MATLAB and then I have some project. Here are some pictures I transform into a 3D graphic. The result is full of noise. I read there are some filtering images like Gaussian, Laplace, Canny, Sobel etc. But how I can apply them to my picture so it's become better to transform into the 3D plot.
% I use this code to make the 3D plot
a = imread('edge_final.jpg');
b = rgb2gray (a);
surf(b,'EdgeColor','none')
colorbar;
colormap(jet(50));

Answers (1)

Purvaja
Purvaja on 31 Jan 2025 at 8:02
Edited: Purvaja on 31 Jan 2025 at 8:09
I understand that you want to reduce the noise in your images. We can approach this by using image processing techniques in MATLAB as you have listed in your question. I have approached this using the “imgaussfiltfunction and removing background using threshold in the MATLAB R2024b . Refer to the following code for steps:
1. Load the image
2. Applying a Gaussian Filter
smoothedImage = imgaussfilt(b, 4);
3. Remove background using thresholding
thresholdValue = 100;
backgroundRemoved = smoothedImage;
backgroundRemoved(backgroundRemoved < thresholdValue) = 0;
4. Generate the 3D plot and Display images
We see the following results:
  • The plot for image “Cerah.jpg”. We can see noise is reduced and only the required pixels are retained, forming a 3D image.
  • Here, I have presented a top view and a zoomed-in image that removes the background pixels. This gives us a clearer understanding of the 3D image obtained.
  • The given plot is for “2.jpg” image, where we can see significant reduction in noise and smoothed image.
  1. Gaussian Filtering:The function “imgaussfilt” implements Gaussian Filtering that reduces image noise by averaging pixel values and creating a blurring effect using appropriate kernel. Applying larger kernel size enables more smoothing so choose kernel accordingly.
  2. Background Filtering:Background filtering is performed using background subtraction where pixels having value less than the “thresholdValueis removed. It helps in enhancing contrast between object and background, all reduces background noise.
For more clarification on the functions used, you can refer to the following resources:
For Gaussian Filtering referimgaussfilt” function:
Or you can access release specific documentation using this command in your MATLAB command window:
web(fullfile(docroot, 'images/ref/imgaussfilt.html'))
Hope this helps you!

Community Treasure Hunt

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

Start Hunting!