フィルターのクリア

Change the black background to blue (same as the image color)

7 ビュー (過去 30 日間)
Mohamed Elbeialy
Mohamed Elbeialy 2020 年 5 月 2 日
コメント済み: Image Analyst 2020 年 5 月 3 日

回答 (1 件)

Image Analyst
Image Analyst 2020 年 5 月 2 日
Try this (untested)
% Extract the individual red, green, and blue color channels.
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);
% Get a mask for pure black.
blackMask = redChannel == 0 & greenChannel == 0 & blueChannel == 0;
% Make black blue
redChannel(blackMask) = 0;
greenChannel(blackMask) = 0;
blueChannel(blackMask) = 255;
% Recombine separate color channels into a single, true color RGB image.
rgbImage = cat(3, redChannel, greenChannel, blueChannel);
imshow(rgbImage);
  1 件のコメント
Image Analyst
Image Analyst 2020 年 5 月 3 日
I'd probably take a histogram of each color channel. Ignore bin 1 because that will be zero. YOu need to find the gray level of the second most common gray level. That will be the purple. Then assign that to the black mask regions.

サインインしてコメントする。

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by