Picture to sound

import cv2 as cv
import numpy as np
import winsound

cam = cv.VideoCapture(0)

for j in range(100):
    s, im = cam.read() # capture an image
    for k in range(640):
        im[240,k] = [0,0,255]
        im[241,k] = [0,0,255]
        im[242,k] = [0,0,255]
        im[300,k] = [0,0,255]
        im[301,k] = [0,0,255]
        im[302,k] = [0,0,255]
    cv.imshow("Test Picture", im) # display the captured image
    cv.waitKey(100)
cv.destroyAllWindows()
cv.VideoCapture(0).release()

line = im[243:299,0:640,1]
cv.imshow("line", line) # display the scan window
cv.waitKey(3000)

ave = np.mean(line)

code = []
for j in range(64):
    block = line[:,j*10:j*10+10]
    value = np.mean(block)
    if value > ave:
        code.append(1)
        line[:,j*10:j*10+10] = 255
        winsound.Beep(800,300)
    else:
        code.append(0)
        line[:,j*10:j*10+10] = 0
        winsound.Beep(400,300)
    cv.imshow("line", line) # display the coded line
    cv.waitKey(50)
print code