What does this instruction returns.

1 visualización (últimos 30 días)
Neelum Dave
Neelum Dave el 18 de Feb. de 2016
Respondida: Jos (10584) el 18 de Feb. de 2016
[hueChannel,~,~] = rgb2hsv(videoFrame)

Respuestas (1)

Jos (10584)
Jos (10584) el 18 de Feb. de 2016
Apparently, the function rgb2hsv can return three output arguments. This line of code explicitly ignores the last two. A similar result can be obtained by implicitly ignoring them, by just retrieving one output.
hueChannel = rgb2hsv(videoFrame)
The use of the ~ is more commonly used to retrieve later output arguments and ignoring the earlier ones. As an example:
A = [1 4 5 3] ;
[maxValue, maxIndex] = max(A) % retrieve both
[~, maxIndex] = max(A) % use this if you are only interested in the second output
You have to look in the help of rgb2hsv to see what the first output variable will hold exactly.

Community Treasure Hunt

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

Start Hunting!

Translated by