【问题标题】:colormap on webcam video capture网络摄像头视频捕获上的颜色图
【发布时间】:2012-10-11 10:03:57
【问题描述】:

我目前正在为一个满足我的网络摄像头项目的 matlab 工作。这是我的代码:

vid = videoinput('winvideo');
vidRes = get(vid, 'VideoResolution');
nBands = get(vid, 'NumberOfBands');
hImage = image( zeros(vidRes(2), vidRes(1), nBands));
preview(vid, hImage);
colormap cool;

视频在网络摄像头中显示。但是 colormap cool; 在视频中似乎没有效果。我尝试用虚拟图像替换视频,colormap cool; 生效。

我有什么方法可以控制视频的颜色图吗?

【问题讨论】:

    标签: matlab video webcam color-mapping


    【解决方案1】:

    彩色图像(包括视频帧)使用 3 通道 R G B 定义。当您只有 1 个信息通道并将单个值映射到 3 通道 RGB 值时,使用颜色图。

    例如:

    img1 = rand(20,20,3);
    imagesc(img); 
    colormap hot; % This does nothing because the image has 3 channels
    
    img2 = rand(20,20);
    imagesc(img);
    colormap hot; % This works because a colormap is being used to map the 1 channel to a color
    

    如果您想为视频使用颜色图,则必须选择 R、G 或 B 通道,或者将单个通道创建为多个通道的组合。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-04-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-06-25
    • 2011-03-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多