相关疑难解决方法(0)

在Matlab中仅将黑色转换为白色

我知道这个关于同时将黑色转换为白色和白色转换为黑色的线索.我想只将黑色转换为白色.我知道这个线程是关于这样做我要问的但是我不明白出了什么问题.

图片

在此输入图像描述

rgbImage = imread('ecg.png');
grayImage = rgb2gray(rgbImage); % for non-indexed images
level = graythresh(grayImage); % threshold for converting image to binary, 
binaryImage = im2bw(grayImage, level); 
% Extract the individual red, green, and blue color channels.
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);
% Make the black parts pure red.
redChannel(~binaryImage) = 255;
greenChannel(~binaryImage) = 0;
blueChannel(~binaryImage) = 0;
% Now recombine to form the output image. …
Run Code Online (Sandbox Code Playgroud)

rgb matlab image colors image-processing

8
推荐指数
2
解决办法
3179
查看次数

标签 统计

colors ×1

image ×1

image-processing ×1

matlab ×1

rgb ×1