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

Learning Goal: I’m working on a python exercise and need an explanation and answer to help me learn.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 mergeDefine 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:Compute average intensity of left pixels. (ml).
Compute offset. (ol = 128 – ml).
For each pixel Ml(x,y) in the left section add the offset. (Ml(x,y) + ol).
Compute average intensity of right pixels. (mr).
Compute offset. (or = 128 – mr).
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.
Note:Do not use any in-built functions from opencv and numpy (E.g: np.mean). In general, you can use function from math library.Only Functions allowed for this part are: np.array(), np.matrix(), np.zeros(), np.ones(), cv2.imread(), cv2.namedWindow(), cv2.waitKey().Please do not change the code structure
Usage:- python dip_hw0.py -ir -il -c -a -b
– Example: python dip_hw0.py -il grace_1.png -ir grace_2.png -c 155 -a 0.2 -b 0.8
Please make sure the code runs when you run the above command from prompt/terminal
All the output images and files are saved to “output/” folder
Two images are provided for testing: grace_1.jpg and grace_2.pngPS. Please do not change dip_hw0.py, requirements.txt, and Jenkinsfile.

Pages (275 words)
Standard price: \$0.00
Client Reviews
4.9
Sitejabber
4.6
Trustpilot
4.8
Our Guarantees
100% Confidentiality
Information about customers is confidential and never disclosed to third parties.
Original Writing
We complete all papers from scratch. You can get a plagiarism report.
Timely Delivery
No missed deadlines – 97% of assignments are completed in time.
Money Back