1

enter image description here

I would like to create a new interlaced image where the odd rows belong to one image and the even rows to the other image. I am trying to do that with python and openCv and numpy! Reading the one images and with a loop i try to write the values in the odd and even rows. I don't know how to do that. Do you have some tips?p

ΦXocę 웃 Пepeúpa ツ
  • 43,054
  • 16
  • 58
  • 83
白颖捷
  • 11
  • 1

1 Answers1

0

Here is an example

import numpy as np
from matplotlib import pyplot as plt


imgshape = (100,100,3)

blue = np.zeros(imgshape)
red = np.zeros(imgshape)
blue[:,:,2] = np.ones(blue.shape[:2])
red[:,:,0] = np.ones(blue.shape[:2])

mix = np.zeros(imgshape)

oddrows = [i for i in range(blue.shape[0]) if i %2==1]
evenrows = [i for i in range(blue.shape[0]) if i%2==0]

mix[oddrows] = red[oddrows]
mix[evenrows] = blue[evenrows]

plt.imshow(mix)
M. Jajeh
  • 140
  • 3