MATLAB中的按位滤色器 [英] Bitwise color filter in MATLAB

查看:141
本文介绍了MATLAB中的按位滤色器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否存在执行以下操作的MATLAB函数:

Is there a MATLAB function that does the following:

对于图像输入,它告诉我比我选择的特定颜色深多少比例的位.

For an image input, it tells me what proportion of the bits are darker than a particular color of my choosing.

因此,如果我输入棋盘的图像并使用灰色,则输出大约为一半. (不过,我需要以这种方式处理的图像并不是那么简单)

So if I entered an image of a chess board and used the color gray, the output would be roughly one half. (the image I need to process in this way is not that simple, though)

推荐答案

function CompareMap = BitWiseCompare('filename',c) % c = [R , G , B];
A = imread('filename');
CompareMap = zeros([size(A,1),size(A,2)]);
CompareMap = (A(:,:,1) < c(1)).*(A(:,:,2) < c(2)).*(A(:,:,3) < c(3));
end

例如,

带有CompareMap = BitWiseCompare('filename',[220 100 120]);给出

CompareMap = BitWiseCompare('filename',[220 130 150]);

这篇关于MATLAB中的按位滤色器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆