function pmax pmin pn improd IMPROD Computes the product of two images

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
function [p, pmax, pmin, pn] = improd(f, g)
%IMPROD Computes the product of two images.
%[P, PMAX, PMIN, PN] = IMPROD(F, G) outputs the element-by-
%element product of two input images, F and G, the product
%maximum and minimum values, and a normalized product array with
%values in the range [0, 1]. The input images must be of the same
%size. They can be of classes uint8, uint16, or double. The outputs
%are of class double.
fd = double(f);
gd = double(g);
p = fd .* gd;
pmax = max(p(:));
pmin = min(p(:));
pn = mat2gray(p);