Skip to content

Commit

Permalink
修复一个闪退bug
Browse files Browse the repository at this point in the history
  • Loading branch information
fire-keeper committed Aug 4, 2019
1 parent 6ef1ad7 commit bc394d4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions BlindWatermark/BlindWatermark.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,14 +310,14 @@ def extract(self,filename,out_wm_name):
extract_wm_Y[wm_index] = extract_wm_Y.copy()
extract_wm_U[wm_index] = extract_wm_U.copy()
extract_wm_V[wm_index] = extract_wm_V.copy()
cv2.imwrite(out_wm_name,extract_wm.reshape(64,64))
cv2.imwrite(out_wm_name,extract_wm.reshape(self.wm_shape[0],self.wm_shape[1]))

path,file_name = os.path.split(out_wm_name)
if not os.path.isdir(os.path.join(path,'Y_U_V')):
os.mkdir(os.path.join(path,'Y_U_V'))
cv2.imwrite(os.path.join(path,'Y_U_V','Y'+file_name),extract_wm_Y.reshape(64,64))
cv2.imwrite(os.path.join(path,'Y_U_V','U'+file_name),extract_wm_U.reshape(64,64))
cv2.imwrite(os.path.join(path,'Y_U_V','V'+file_name),extract_wm_V.reshape(64,64))
cv2.imwrite(os.path.join(path,'Y_U_V','Y'+file_name),extract_wm_Y.reshape(self.wm_shape[0],self.wm_shape[1]))
cv2.imwrite(os.path.join(path,'Y_U_V','U'+file_name),extract_wm_U.reshape(self.wm_shape[0],self.wm_shape[1]))
cv2.imwrite(os.path.join(path,'Y_U_V','V'+file_name),extract_wm_V.reshape(self.wm_shape[0],self.wm_shape[1]))


if __name__=="__main__":
Expand Down
8 changes: 4 additions & 4 deletions GUI/BlindWatermark/BlindWatermark.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,14 +327,14 @@ def extract(self,filename,out_wm_name):
extract_wm_Y[wm_index] = extract_wm_Y.copy()
extract_wm_U[wm_index] = extract_wm_U.copy()
extract_wm_V[wm_index] = extract_wm_V.copy()
cv2.imwrite(out_wm_name,extract_wm.reshape(64,64))
cv2.imwrite(out_wm_name,extract_wm.reshape(self.wm_shape[0],self.wm_shape[1]))

path,file_name = os.path.split(out_wm_name)
if not os.path.isdir(os.path.join(path,'Y_U_V')):
os.mkdir(os.path.join(path,'Y_U_V'))
cv2.imwrite(os.path.join(path,'Y_U_V','Y'+file_name),extract_wm_Y.reshape(64,64))
cv2.imwrite(os.path.join(path,'Y_U_V','U'+file_name),extract_wm_U.reshape(64,64))
cv2.imwrite(os.path.join(path,'Y_U_V','V'+file_name),extract_wm_V.reshape(64,64))
cv2.imwrite(os.path.join(path,'Y_U_V','Y'+file_name),extract_wm_Y.reshape(self.wm_shape[0],self.wm_shape[1]))
cv2.imwrite(os.path.join(path,'Y_U_V','U'+file_name),extract_wm_U.reshape(self.wm_shape[0],self.wm_shape[1]))
cv2.imwrite(os.path.join(path,'Y_U_V','V'+file_name),extract_wm_V.reshape(self.wm_shape[0],self.wm_shape[1]))
self.valueChanged.emit(100)

if __name__=="__main__":
Expand Down

0 comments on commit bc394d4

Please sign in to comment.