What does 'imfuse' exactly do and how does it differ from 'imadd'?

32 views (last 30 days)
cniv_we on 15 Dec 2017
Edited: Michal Dobai on 15 Dec 2017
I know imfuse creates a composite image from two images and I got the result I wanted. However, I do not know how imfuse does exactly work.
- What kind of transformation function does it use? Wavelet? Fourier? I couldn't find any information regarding this on MATLAB.
- Also, if I understand correctly, does imadd only add two images (or matrices) -let's say A and B- in normal way? i.e. pixel i in image A has RGB vector [0 30 12] and pixel i in image B has RGB vector [15 2 13], then by using C = imadd(A,B) would create pixel i = [15 32 25] in image C. Is that correct?

Michal Dobai on 15 Dec 2017
Edited: Michal Dobai on 15 Dec 2017
imfuse can combine input images in several different ways. You can select one of them by setting method argument. Default method is 'falsecolor'.
This method converts both images to gray-scale and scale values of pixels the way, that darkest pixel is represented by 0 and brightest by value of 1. You can choose scaling mode by argument Scaling. Default mode is independent. That means both images are scaled separately. You can also choose 'joint' scaling, when only one darkest an one brightest value is chosen for both images, as if they were together in the same image. By setting Scaling to 'none' you can turn off scaling completely.
Each gray-scale image is then put into different color channel ( green-magenta by default).
All of this is described quite well in documentation . If you need some specific low-level implementation details, you can always read source code in imfuse.m located here: fullfile(matlabroot,'toolbox','images','images','imfuse.m').
---
As for imadd, it pretty much does what you described. One more thing, though:
"If X and Y are integer arrays, elements in the output that exceed the range of the integer type are truncated, and fractional values are rounded."
Again, whole functionality is described in documentation , even with some nice examples.

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!

Translated by