Chat with us, powered by LiveChat A Code to Merge 2 Images of The Computer Scientist Grace Hopper Analysis | Credence Writers
+1(978)310-4246 [email protected]

Description

1. Image Merging:

Write code to merge two images of the computer scientist

Grace Hopper

. In 1952,

Grace Hopper

and her team created the first compiler for computer languages.

The inputs to your function are: (i) image left: grace_1.png (size: 350 Rows X 340 Cols), (ii) image right: grace_2.png (size: 350 Rows X 340 Cols), (iii) image column (c) at which the images should be merged.

  • image_op/operations.py: Edit the function merge

    • Define a new image as follows: the first c columns (default value = 155) should be equal to the first c columns of the left image (grace_1.png). The remaining columns should be equal to the columns greater than c from the right image (grace_2.png).

2. Intensity Scaling:

Write code to scale the intensity of the left section of the merged image by a scaling factor of alpha and the right section by a scaling factor of beta.


Image Scaling

: Image/Intensity scaling is a linear image operation where each pixel is multiplied by a scaling factor. The scaling factor is a value between 0 and 1.

The inputs to your function are: (i) input image, (ii) image column at which left section ends, (iii) alpha: scaling factor for the left section (0 <= alpha <= 1) and (iv) beta: scaling factor for the right section ((0 <= beta <= 1).

  • image_op/operations.py: Edit the function intensity_scaling.

3. Centralizing pixel intensities:

Write code to centralize the intensities of the two sections of the image.

Centralizing Pixels: When merging, the two images can have very different overall brightness values. Here the goal is to make sure that the average intensities of the left section and the right section are equal and centralized (= 128). After centralizing pixels, the average of all the pixels in the left section will be ~128 and the average of all the pixels in the right section will be ~128 as well.

Let M be the input image. Let l be all the intensities in the left section of the image and r all the intensities in the right section of the image.

Steps:

  1. Compute average intensity of left pixels. (ml).
  2. Compute offset. (ol = 128 – ml).
  3. For each pixel Ml(x,y) in the left section add the offset. (Ml(x,y) + ol).
  4. Compute average intensity of right pixels. (mr).
  5. Compute offset. (or = 128 – mr).
  6. For each pixel Mr(x,y) in the right section add the offset. (Mr(x,y) + or).

Note: After applying the operation, some pixels may end up being < 0 or > 255. Clip these pixels, such that any value greater than 255 is assigned a value of 255, and any value less than 0 will be assigned a value of 0.

The inputs to your function are: (i) image, (ii) image column at which left section ends.

  • image_op/operations.py: Edit the function centralize_pixel.

    • Do not use np.mean to compute the averages.

Assignment – 0
? Image Manipulation
1. Merging
2. Scaling
3. Intensity Centralization
Merging
? Merge two images horizontally to create a new image.
? Input:
? Image left
? Image right
? Column at which to merge the images
Column = 155
Image left
Image right
Output
Intensity Scaling
? Scaling: multiply each pixel in the image using a constant value called
as scaling factor. Scaling factor is a value between 0 and 1.
? Input:
?
?
?
?
Image
Column at which left section ends and right section begins
Scaling factor for left section (alpha)
Scaling factor for right section (beta)
Column = 155
(left image) * alpha(0.25)
Output
(right image) * beta(0.9)
Intensity Centralization
? The two images can have very different overall brightness values.
? The goal is to make sure that the average intensities of the left section
and the right section are equal and centralized (= ~128).
? After centralizing pixels, the average of all the pixels in the left section
and right section will be ~128
? Input:
? Image
? Column at which left section ends and right section begins
1. Compute average intensity of left pixels
(?? )
2. Compute offset. (?? = 128 – ?? )
3. For each pixel ?(?, ?) in the left section
add the offset. (?(?, ?) + ?? )
Output
Column = 155
1. Compute average intensity of right
pixels (?? )
2. Compute offset. (?? = 128 – ?? )
3. For each pixel ?(?, ?) in the right section
add the offset. (?(?, ?) + ?? )
Assignment – 0
1. Merging (10 Pts.)
2. Intensity Scaling (10 Pts)
3. Intensity Centralizing (10 Pts)
Total: 30 Pts.
Submission Instructions
? Must use the starter code available in Github
? Submission allowed only through Github
? You will receive an email with invitation to join Github classroom
? Start by reading the readme.md file.
? Instructions are available here
? Github will automatically save the last commit as a submission
before the deadline

Purchase answer to see full
attachment