how to remove specific area of an image
12 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
QuestionsAccount
il 1 Nov 2020
Commentato: QuestionsAccount
il 12 Nov 2020
hi everyone!
i want to remove only the specific area of my image i.e the floor (but not the whole floor).
for more explanation i attach the image actually i want to remove only the portions of my image that i marked with X sign and the rest of the grass in the middle and the humans remains still there in the image.
Can anyone help in code of doing the above metnion thing. i will be really thankful for that.
Note: background subtraction will not going to solve my problem i need something else more efficent and that fullfil my requirment as well..
2 Commenti
Image Analyst
il 1 Nov 2020
Explain what "remove" means to you. Do you want to crop to the grass's bounding box? Do you want to erase the sidewalk (set it to zero)? You can't just "remove" it since images must remain rectangular not trapezoidal.
Risposta accettata
Subhadeep Koley
il 4 Nov 2020
Hi, you can use the interactive Color Thresholder app to achieve what you want. After performing segmentation, this app also generates the equivalent MATLAB code. Below is an example of the code generated by the Color Thresholder app.
I = imread('original.jpg');
% Define thresholds for channel 1 based on histogram settings
channel1Min = 203.000;
channel1Max = 245.000;
% Define thresholds for channel 2 based on histogram settings
channel2Min = 202.000;
channel2Max = 234.000;
% Define thresholds for channel 3 based on histogram settings
channel3Min = 197.000;
channel3Max = 227.000;
% Create mask based on chosen histogram thresholds
sliderBW = (I(:,:,1) >= channel1Min ) & (I(:,:,1) <= channel1Max) & ...
(I(:,:,2) >= channel2Min ) & (I(:,:,2) <= channel2Max) & ...
(I(:,:,3) >= channel3Min ) & (I(:,:,3) <= channel3Max);
BW = sliderBW;
% Initialize output masked image based on input image.
maskedRGBImage = I;
% Set background pixels where BW is true to zero.
maskedRGBImage(repmat(BW,[1 1 3])) = 0;
figure
montage({I, BW, maskedRGBImage}, 'Size', [1 3])
title('RGB image | Segmentation mask | Segmented image')
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Image Processing Toolbox in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!