Hello, I try do background subtraction using python, and I have problem to
save each pixel to jagged array...
*My jagged array is:*
m_samples=[]
height, width, depth=cap.shape
c_black=np.zeros( (height,width), dtype=np.uint8)
for i in range(0,NUM_SAMPLES,1):
m_samples.append(c_black)
*And my code to access each pixel from frame is:*
NUM_SAMPLES =18
c_xoff= [-1, 0, 1, -1, 1, -1, 0, 1, 0]
c_yoff= [-1, 0, 1, -1, 1, -1, 0, 1, 0]
for i in range(0,width,1):
for j in range(0,height,1):
for k in range(0,NUM_SAMPLES,1):
random=numpy.random.randint(0,9)
row=i+c_yoff[random]
if(row<0):
row=0
if(row>=width):
row=width-1
col=j+c_xoff[random]
if(col<0):
col=0
if(col>=height):
col=height-1
_____________=getPixel(frame,row,col)
what I want to fill in ____ is m_samples[k] in coordinate (i,j), but I
don't know how to write it in python?
Thanks for your help...
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor