Remove dots from image

8 次查看(过去 30 天)
Costa berley
Costa berley 2022-1-5
回答: DGM 2022-1-6
Hey i have an RGB Image with shapes and clutter of black dots.
tried to convert to gray and use mask but then got stuck with removing the mask from original RGB image.
I need to remove the dots and the image to remain color( i need to write a code that searches the shapes later)

采纳的回答

DGM
DGM 2022-1-6
This is a simple way. Select all low-chroma regions and fill with white.
A = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/853710/pic1.jpg');
Ayiq = rgb2ntsc(A);
mask = hypot(Ayiq(:,:,2),Ayiq(:,:,3))<0.1;
mask = repmat(mask,[1 1 3]);
A(mask) = 255;
imshow(A)
The compression artifacts from the use of a JPG format make the color selection more difficult than it really should be. Clearing the entire background instead of just the dots helps by getting rid of all the artifact halos surrounding the objects.

更多回答(0 个)

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by