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 “imgaussfilt” function 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
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.
- 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.
- Background Filtering:Background filtering is performed using background subtraction where pixels having value less than the “thresholdValue” is 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 refer “imgaussfilt” 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!