What does this instruction returns.

1 次查看(过去 30 天)
[hueChannel,~,~] = rgb2hsv(videoFrame)

回答(1 个)

Jos (10584)
Jos (10584) 2016-2-18
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.

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by