-
Notifications
You must be signed in to change notification settings - Fork 182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
render_model.py帧数据缓存到内存后人脸会糊 #88
Comments
可以每次开始强行指定从起始帧开始:video.set(cv2.CAP_PROP_POS_FRAMES, 0)
…________________________________
发件人: lddcdut ***@***.***>
发送时间: 2025年1月1日 11:35
收件人: kleinlee/DH_live ***@***.***>
抄送: Subscribed ***@***.***>
主题: [kleinlee/DH_live] render_model.py帧数据缓存到内存后人脸会糊 (Issue #88)
在reset_charactor方法中我将视频所有帧全部读出来了,然后存到frames对象中
获取视频所有帧
self.__cap_input.set(cv2.CAP_PROP_POS_FRAMES, 0)
while True:
ret, frame = self.__cap_input.read()
if ret:
self.frames.append(frame)
else:
break
在interface方法中直接通过索引获取帧数据,避免每次去读取,但是运行一段时间后脸部会糊,打印了下日志,视频第一轮循环完成后,第二轮ret, frame = self.__cap_input.read()读出来的frame和frames[0]的值就不一致了。这是什么原因啊。
def interface(self, mouth_frame):
if self.frame_index % self.vid_frame_count == 0:
self.__cap_input.set(cv2.CAP_PROP_POS_FRAMES, 0)
self.frame_list_index = 0
ret, frame_read = self.__cap_input.read()
epoch = self.frame_index // len(self.__mat_list)
if epoch % 2 == 0:
new_index = self.frame_index % len(self.__mat_list)
else:
new_index = -1 - self.frame_index % len(self.__mat_list)
frame = self.frames[self.frame_list_index]
if not np.array_equal(frame_read, frame):
# 第二轮开始,输出就为False了
print(np.array_equal(frame_read, frame))
―
Reply to this email directly, view it on GitHub<#88>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AHQTKZZLW4GRAR5B3BKXI532INPB5AVCNFSM6AAAAABUOGNTXWVHI2DSMVQWIX3LMV43ASLTON2WKOZSG43DIOBRGY2DOMA>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
通过read()这种方式不会出问题,但只要把frame放到内存,就算强制指定从起始帧开始,一段时间后都会糊脸。百思不得其解。。。 |
. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
在reset_charactor方法中我将视频所有帧全部读出来了,然后存到frames对象中
获取视频所有帧
在interface方法中直接通过索引获取帧数据,避免每次去读取,但是运行一段时间后脸部会糊,打印了下日志,视频第一轮循环完成后,第二轮ret, frame = self.__cap_input.read()读出来的frame和frames[0]的值就不一致了。这是什么原因啊。
The text was updated successfully, but these errors were encountered: