
como utilizar una función en un nuevo script
Publicado por Jose manuel (5 intervenciones) el 17/05/2018 19:20:57
Hola, tengo una funcion llamada: function [BW,maskedRGBImage] = createMask(RGB)
en donde tengo el código para extraer tonalidades de color verde:
¿Cómo puedo utilizarla en otro script?
en donde tengo el código para extraer tonalidades de color verde:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
I = RGB;
% Define thresholds for channel 1 based on histogram settings
channel1Min = 24.000;
channel1Max = 137.000;
% Define thresholds for channel 2 based on histogram settings
channel2Min = 31.000;
channel2Max = 140.000;
% Define thresholds for channel 3 based on histogram settings
channel3Min = 0.000;
channel3Max = 119.000;
% Create mask based on chosen histogram thresholds
BW = (I(:,:,1) >= channel1Min ) & (I(:,:,1) <= channel1Max) & ...
(I(:,:,2) >= channel2Min ) & (I(:,:,2) <= channel2Max) & ...
(I(:,:,3) >= channel3Min ) & (I(:,:,3) <= channel3Max);
% Initialize output masked image based on input image.
maskedRGBImage = RGB;
% Set background pixels where BW is false to zero.
maskedRGBImage(repmat(~BW,[1 1 3])) = 0;
¿Cómo puedo utilizarla en otro script?
Valora esta pregunta


0