且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

MATLAB:查找图像中特定rgb像素值的索引/计数

更新时间:2023-02-26 14:49:20

实际上非常简单。这样的东西

It's actually pretty simple. Something like this

count = sum(im(:, :, 1) == 255 & im(:, :, 2) == 255 & im(:, :, 3) == 255);

将为您提供此类像素的计数。如果需要,用 find 替换 sum 以获取这些像素的索引。

will give you the count of such pixels. Replace sum with find to get the indices of those pixels if you need that.