Color the the image
Show older comments
Hi all,
How can I do the script for the 2 input images to produce the output image?
Accepted Answer
More Answers (1)
Mahesh Taparia
on 28 Feb 2022
Hi
This problem can be solve by adding the image of both the letter 'U' and 'H' and doing some color changing. At first, split the image from middle to 2 images of letter 'U' and 'H'. For example, consider the code below:
a=rgb2gray(imread('uh.png'));
sz = size(a);
u = a(:,1:sz(2)/2);
h = a(:,sz(2)/2+1:end);
Then add the images of both the letters and change the color as per requirement. Use 'insertText' function to add text inside the image, you can change the text color, box color, etc. For more information, you can refer its documentation here. For example, consider the below code
uh = u+h;
I = zeros(162,160,3);
I(:,:,1) = uh; % To keep red background, you can change the color as per need
I = insertText(I,[35,7],'Output 2: UH Red');
figure;imshow(I)
Hope it will help!
1 Comment
Tu Nguyen
on 28 Feb 2022
Categories
Find more on Image Arithmetic in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

