MATLAB Answers

Apply mask to RGB image. If mask is RGB as well do i have to seperet the mask to its channels too?

조회 수: 15(최근 30일)
fadams18 1 Feb 2020
댓글: fadams18 1 Feb 2020
Hello I want to apply this mask onto this RGB color to use in NMF
transport_mask.png ... transport_clean.png transport_input.png
function [ R, B,G ] = Split_Image( )
X_red = Q.*R;
X_gre = Q.*G;
X_blu = Q.*B;
So I want to inprint the left image on the right image to get an output in the third image.
How ever in my case i will have a red blue green channel with the masks.
I will then process these 3 images seperately using nmf and combine them after to reconstuct the original image
How ever when i run my code i get the same image below for all channels. What am i doing wrongly

  댓글 수: 0

로그인 to comment.

채택된 답변

Subhadeep Koley
Subhadeep Koley 1 Feb 2020
Hi, refer the code below.
function [ R, B, G ] = Split_Image()
input = im2double(imread('transport_clean.png'));
figure; imshow(input, []); title('Input image');
mask = imcomplement(im2double(rgb2gray(imread('transport_mask.png'))));
added = input + mask *0.3;
R = added(:, :, 1);
G = added(:, :, 2);
B = added(:, :, 3);
figure; imshow(added, []); title('Mask over the input image');

  댓글 수: 5

표시 이전 댓글 수: 2
fadams18 1 Feb 2020
Last point please, Im confused on how u added the mask. you did
Input + mask
Im used to
mask .* input
Whats the difference please.
Subhadeep Koley
Subhadeep Koley 1 Feb 2020
Yes, you're used to multiply the mask with the input. However, in my code I have used a technique called Alpha Blending. I have added the mask with the input image where, the mask is modulated with a Alpha (0.3 in this case) value.
If you increase the Alpha value then, the text will be more prominent in the resulting image.

로그인 to comment.

추가 답변(0개)

이 질문에 답변하려면 로그인을(를) 수행하십시오.

Translated by