HW3, Problem 3.7. EECS 203A. UCI. Fall 2004

Nasser Abbasi

When performing any of these arithmetic operations on the images, we do it pixel by pixel. i.e. when we add image f to image g we are adding the gray level at pixel i image f to the gray level at pixel i in image g. In all these case I assume the images are of the same size.

This problem gave a very hard time. At first I thought that we need to put conditions on the probability distribution of gray levels in each image. But even if (Subscript[p, f]) and (Subscript[p, g]) are both uniform, I can not say that the probability distribution of image f + g will be uniform. So I am putting conditions instead on the image itself

(a) f + g: It is possible to find histogram of f + gin terms of (Subscript[h, g]) and (Subscript[h, f])under any one of these conditions:

1. f = g   (i.e two images are same size and same gray level)
Steps to find histogram  (Subscript[h, f + g]) for this condition:
For each peak in (Subscript[h, g])at gray level i move it to the right to gray level 2  i 
The result is  (Subscript[h, f + g])
    
2. f is a binary image (2 gray levels only), and g is the binary inverse image of f (i.e. if pixel i is 0 in image f then the same pixel i is 1 in image g) 
Steps to find histogram  (Subscript[h, f + g]) for this condition:
(Subscript[h, f + g]) will have one peak, at gray level 1 that is twice as large (twice the frequency) as peak of gray level 1 (or 0) in (Subscript[h, g]) (or (Subscript[h, f]))
     
3. g = N × f where N is some integer. i.e. the images differ from each others only by the intensity level. i.e  (Subscript[h, g]) peaks are shifted to the right version of (Subscript[h, f]) peaks and the peaks in (Subscript[h, g]) are spread out.  
Steps to find histogram  (Subscript[h, f + g]) for this condition:
Starting from left to right in (Subscript[h, f]), number each peak. Call this number n = 1.  . K where K is the total number of peaks.
Both (Subscript[h, g]) and (Subscript[h, f])will have the same K but will be located at different gray levels.
Then For each peak n in (Subscript[h, f]), with gray level (Subscript[h, f])(n) add a new peak in (Subscript[h, f + g]) with same height (frequency) as peak n , but at a gray level of (Subscript[h, f])(n) + N (Subscript[h, f])(n)
 
    
(b) f - g This case is the same as case (a), since we can let \(TraditionalForm\`\(g\^'\) = \(-g\)\) and then consider \(TraditionalForm\`f + \(g\^'\)\), where \(TraditionalForm\`\(g\^'\)\)is the negative of image g

(c) f×g  It is possible to find histogram of f + gin terms of (Subscript[h, g]) and (Subscript[h, f])under any one of these conditions:
 
1. f = g   (i.e two images are same size and same gray level). 
To build the histogram (Subscript[h, f + g])do:
Starting from left to right in (Subscript[h, f]), number each peak. Call this number n = 1.  . K where K is the number of peaks.
Both (Subscript[h, g]) and (Subscript[h, f])will have the same K since the same image.
Then For each peak n in (Subscript[h, f]), with gray level (Subscript[h, f])(n) build a new peak in (Subscript[h, f + g]) with same height (frequency) as peak n , but at gray level shifted to the right to new gray level of (Subscript[h, f])(n)× (Subscript[h, f])(
          n) 

2. f is a binary image (2 gray levels only), and g is the binary inverse image of f (i.e. if pixel i is 0 in image f then the same pixel i is 1 in image g) .
Then histogram (Subscript[h, f + g]) will be one peak at gray level 0 (all black image)

(d) f÷g It is possible to find histogram of f + gin terms of (Subscript[h, g]) and (Subscript[h, f])under any one of these conditions:

1. f = g   (i.e two images are same size and same gray level). 
The histogram (Subscript[h, f + g]) in this case will be all at one gray level 1. (All black) (Assuming black is at gray level 1.) 
If Black is at gray level 0 and white at 255, then it is not possible to divide any 2 images with each others since we will get a divide by zero error.

2. Can not divide binary images (assuming we assign 0 and 1 for the gray level)