Borrar filtros
Borrar filtros

How can I combine the HSV thresholding for 2 range color

3 visualizaciones (últimos 30 días)
SP
SP el 18 de Ag. de 2020
Respondida: Elif Ozkan el 14 de Mzo. de 2022
Hello everyone
I would like to ask the question that how can I combine the two HSV color thresholiding ? Now, I use color thresholding in apps of matlab. Then I use HSV thresholding to threshold white hand and black hand. I would like to detect the hands both black and white but I don't know the way to combine 2 HSV color thresholding.
% Define thresholds for channel 1 based on histogram settings
channel1Min = 0.000;
channel1Max = 1.000;
% Define thresholds for channel 2 based on histogram settings
channel2Min = 0.000;
channel2Max = 1.000;
% Define thresholds for channel 3 based on histogram settings
channel3Min = 0.000;
channel3Max = 0.600;
..............................................................................................................................................................................................................................................
% Define thresholds for channel 1 based on histogram settings
channel1Min = 0.000;
channel1Max = 1.000;
% Define thresholds for channel 2 based on histogram settings
channel2Min = 0.060;
channel2Max = 1.000;
% Define thresholds for channel 3 based on histogram settings
channel3Min = 0.000;
channel3Max = 0.805;
Assume I threshold for black hand and white hand (the first is black and the second is white). I woud like to ask how can I combine it ?
Thank you for you answer.

Respuestas (1)

Elif Ozkan
Elif Ozkan el 14 de Mzo. de 2022
Hello Sp,
I hope this is not too late. I assume you use SliderBW for thresholding. Black and white gives you two different image, lets say sliderBW_white and sliderBW_black. I am using "imadd".
% I is your HSV image
% use your white thresholds here
sliderBW_white = (I(:,:,1) >= channel1Min ) & (I(:,:,1) <= channel1Max) & ...
(I(:,:,2) >= channel2Min ) & (I(:,:,2) <= channel2Max) & ...
(I(:,:,3) >= channel3Min ) & (I(:,:,3) <= channel3Max);
% use black threshold here
sliderBW_black = (I(:,:,1) >= channel1Min ) & (I(:,:,1) <= channel1Max) & ...
(I(:,:,2) >= channel2Min ) & (I(:,:,2) <= channel2Max) & ...
(I(:,:,3) >= channel3Min ) & (I(:,:,3) <= channel3Max);
wholeImage = imadd(sliderBW_white, sliderBW_black); % black and white image in one image

Categorías

Más información sobre Computer Vision with Simulink en Help Center y File Exchange.

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by