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 CenterFile Exchange에서 3-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