def captureFrame(self, offset = None, folderName = 0):
self.folderName = folderName
self.stream = picamera.array.PiYUVArray(self.camera)
self.camera.capture(self.stream, 'yuv')
self.camera._set_led(True)
self.pixelObjList = []
self.objIDCntr = 0
self.pixelObjList.append(PixelObj.PixelObj(self.getNextObjId(), self.proccessingHeight))
rows = []
for _ in range(self.height):
rows.append(range(self.width))
for j, j_ in enumerate(range(self.width - 1,-1,-1)): #flip image horizontally
for i, i_ in enumerate(range(self.height - 1, -1, -1)): #flip vertically
rows[j][i] = self.stream.array[j_][i_][0]
# We need to crop the image to a 96 x 96 image if the cropAroundOffset value it True
if self.cropAroundOffset and offset is not None:
croppedRows = []
for _ in range(self.proccessingHeight):
croppedRows.append(range(self.proccessingWidth))
for j in range(self.proccessingHeight):
for i in range(self.proccessingWidth):
croppedRows[j][i] = rows[j + offset.y][i + offset.x]
rows = croppedRows
self.savePNG('raw.png', rows)
self.processFrame_5(self.processFrame_4(self.processFrame_3(self.processFrame_1(rows), self.processFrame_2(rows))))
# - - - - - - - - - - - - - - - -
# - - - PROCESS FRAME 1 - - - - -
# - - - - - - - - - - - - - - - -
评论列表
文章目录