Binarizing image with single pixels

1 回表示 (過去 30 日間)
Mat
Mat 2024 年 1 月 29 日
回答済み: Animesh 2024 年 1 月 30 日
I have some photos of random pixels marked on a low noisy background. I want to binarize the image, in order to have a clear array of 0s and 1s, and I would like to make each spot as one element of the matrix.
What I did was to grayscale the image, and then try to binarize it. Unfortunately, it is not enough. Adding Adaptive histeresys equalisation (Ae = adapthisteq(Ag);) makes it worst. Maybe strel function could help?
Thanks
This is my code. I think code will be similar to datamatrix and QR code reading.
Thank you
if dim ~= 1
Ag = rgb2gray(photo);
else
Ag = photo;
end
Ab=imbinarize(Ag);

回答 (1 件)

Animesh
Animesh 2024 年 1 月 30 日
Hi @Mat
If you're working with an image that has random pixels against a faintly noisy background and wish to detect those random pixels, you can employ morphological operations to enhance the features of the spots and distinguish them from the background noise.
A suggested approach you can try is:
Step 1: Convert the image to greyscale (if not already).
Step 2: Apply a filter to reduce noise.
Step 3: Binarize the image using thresholding.
Step 4: Use morphological operations to clean up the image and isolate the spots.
You can refer to the following documentation on morphological operations:

カテゴリ

Help Center および File Exchange3-D Volumetric Image Processing についてさらに検索

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by