Removal of background mirror copies of objects .
18 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi, I need help removing the mirrored reflections in this image. I also want to remove those magenta color regions. I tried to clean this image of a liquid jet spray, but I couldn't eliminate the background reflections —even though I used a black background screen during shooting. Ideally, the background should appear black, and in the magenta regions the spray should be appear . I'm new to MATLAB image processing, so please help me i have uploaded the orignal image and processed image using below code..
clc; clear; close all;
I = im2double(imread('Bottom 1mm 50V 1C000000.T000.D000.P000.H000.LA.JPG'));
figure; imshow(I);
title('Original Image with Magenta Reflections');
lab = rgb2lab(I);
magentaMask = (lab(:,:,2) > 20) & (lab(:,:,3) < 5);
figure; imshow(magentaMask);
title('Detected Magenta Regions');
I_clean = I;
for c = 1:3
I_clean(:,:,c) = regionfill(I(:,:,c), magentaMask);
end
imshow(I); title('Before Cleaning');
imshow(I_clean); title('After Magenta Removal');
imwrite(I_clean, 'cleaned_image_noMagenta.jpg');
disp('Cleaned image saved as cleaned_image_noMagenta.jpg');
0 commentaires
Réponses (1)
Image Analyst
le 19 Oct 2025 à 14:57
The background is no good. In my experience, something like back paper or posterboard is still too reflective. Try a background of black velvet. Go to the fabric store and look at black velvet. It should be plentiful, expecially at this time of year! There are different kinds of velvet and velveteen. Some are more shiny than others. Buy a yard of a few different types of the darkest ones and try them out. You may also need to try different kinds of lighting (source sizes and geometries) to find the optimal lighting solution.
If that doesn't completely get rid of the background reflections you might try putting a polarizer in front of the lights and a rotatable polarizer in front of the camera lens. Rotate until the reflection is minimized.
If you're stuck with screenshot with magenta burned into it, you can use the Color Thresholder app to create a mask for it. Otherwise if it's pure magenta, try this
[r, g, b] = imsplit(rgbImage);
magentaMask = (r == 255) & (g == 0) & (b == 255);
% Turn magenta pixels to pure white.
g(magentaMask) = 255;
rgbImage = cat(3, r, g, b);
0 commentaires
Voir également
Catégories
En savoir plus sur Read, Write, and Modify Image dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!