Hello this is in python! Please write this code of merging two images together. Please read the rules. 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). def merge(self, image_left, image_right, column): """ Merge image_left and image_right at column (column) image_left: the input image 1 image_right: the input image 2 column: column at which the images should be merged returns the merged image at column

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Hello this is in python! Please write this code of merging two images together. Please read the rules.

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).

def merge(self, image_left, image_right, column):
"""
Merge image_left and image_right at column (column)

image_left: the input image 1
image_right: the input image 2
column: column at which the images should be merged

returns the merged image at column
"""

# add your code here

 


# Please do not change the structure
return image_left # Currently the original image is returned, please replace this with the merged image

Expert Solution
Algorithm

Step 1: Create instances of type Image for both left image and right image.

Step 2: Prompt and accept column at which the images must be merged from user and invoke the merge() function by passing the left image, right image and column.

Step 3: Define the merge() function. Determine the size of left and right images.

Step 4: Create new image whose dimension matches with the left image. Paste the left image.

Step 5: Crop the right image from column c+1 onward till the end.

Step 6: Paste the extracted portion of right image in the new image at column c+1. Thus,  new_image contains the first c columns of left image and from columns c+1 till remaining columns of right image.

Step 7: Return the newly constructed image. Display the image

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Similar questions
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY