Well I need help completing this interlacing function that takes two images and alternates their rows into a new image. I tried doing som
Code:
import sys, os
import numpy as np
import cv2
def interlace(evens, odds):
'''Reconstruct the image by alternating rows of evens and odds.
evens - a numpy array of shape (rows, columns, 3) containing the even rows
of the output image.
odds - a numpy array of shape (rows, columns, 3) containing the odd rows
of the output image.
This function should return an image. Row 0 of the output image should be
row 0 of evens. Row 1 of the output image should be row 0 of odds. Then
row 1 of evens, then row 1 of odds, and so on.
The resulting image will have as many rows as image 1 and 2 combined, equal
to both in number of columns, and have 3 channels.
'''
i=0
outimg = np.zeros([800,600] , 'uint8')
# Implement your function here ---------------------------------------------
while i <= (len(evens) + len(odds)):
outimg[2*i] = evens[i]
outimg[2*i + 1] = odds[i]
i+=1
#---------------------------------------------------------------------------
return outimg