Fusing one rgb image with one grayscale image using imfuse function

7 Ansichten (letzte 30 Tage)
HYZ
HYZ am 14 Jul. 2022
Bearbeitet: DGM am 14 Jul. 2022
Hi, I used imfuse to combine one rgb image with one grayscale image. After fusing, the rgb image became dimmer. Please suggest how I can increase the intensity of the rgb image.
I used final_image=imfuse(image_rgb, image_gray, 'blend');

Akzeptierte Antwort

DGM
DGM am 14 Jul. 2022
Bearbeitet: DGM am 14 Jul. 2022
The contribution of either image is reduced by half, because that's what a 50% opacity blend is. It's the simple arithmetic mean of two images. Imfuse() can't do any other proportion. It's a simple, inflexible visual comparison tool, not an image composition tool.
Assuming that your images have the same page geometry, and assuming you're using R2016b or newer:
A = imread('cameraman.tif'); % single-channel
B = imread('cmantifBG.png'); % RGB
alph = 0.3;
blended = alph*im2double(A) + (1-alph)*im2double(B);
blended = im2uint8(blended);
montage({A B blended})
If you want something other than simple linear alpha blending, you'll have to elaborate with an example image and a description of what the output should look like.
There are other methods of combining two images, but what's appropriate depends on the object contrast/polarity and which objects are important.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by