@@ -126,8 +126,8 @@ def cvPassHomeDialog(self, frame: cv.Mat, framePoint: FramePoint) -> bool:
126126 _ , roiDialogBgBin = cv .threshold (roiDialogGray , 100 , 255 , cv .THRESH_BINARY )
127127 meanDialogTextBin : float = cv .mean (roiDialogTextBin )[0 ]
128128 meanDialogBgBin : float = cv .mean (roiDialogBgBin )[0 ]
129- hasDialogBg : bool = meanDialogBgBin < 20 and meanDialogBgBin > 0.1
130- hasDialogText : bool = meanDialogTextBin < 10 and meanDialogTextBin > 0.1
129+ hasDialogBg : bool = meanDialogBgBin < 25 and meanDialogBgBin > 0.1
130+ hasDialogText : bool = meanDialogTextBin < 20 and meanDialogTextBin > 0.1
131131
132132 roiUnderDialog = self .underHomeDialogRect .cutRoiToUmat (frame )
133133 roiUnderDialogGray = cv .cvtColor (roiUnderDialog , cv .COLOR_BGR2GRAY )
@@ -152,8 +152,8 @@ def cvPassDialog(self, frame: cv.Mat, framePoint: FramePoint) -> bool:
152152 _ , roiDialogBgBin = cv .threshold (roiDialogGray , 100 , 255 , cv .THRESH_BINARY )
153153 meanDialogTextBin : float = cv .mean (roiDialogTextBin )[0 ]
154154 meanDialogBgBin : float = cv .mean (roiDialogBgBin )[0 ]
155- hasDialogBg : bool = meanDialogBgBin < 20 and meanDialogBgBin > 0.1
156- hasDialogText : bool = meanDialogTextBin < 10 and meanDialogTextBin > 0.1
155+ hasDialogBg : bool = meanDialogBgBin < 25 and meanDialogBgBin > 0.1
156+ hasDialogText : bool = meanDialogTextBin < 20 and meanDialogTextBin > 0.1
157157
158158 isValidDialog = hasDialogBg and hasDialogText
159159
@@ -166,7 +166,7 @@ def cvPassDialog(self, frame: cv.Mat, framePoint: FramePoint) -> bool:
166166 def cvPassWhitescreen (self , frame : cv .Mat , framePoint : FramePoint ) -> bool :
167167 roiWhitescreen = self .whitescreenRect .cutRoiToUmat (frame )
168168 roiWhitescreenGray = cv .cvtColor (roiWhitescreen , cv .COLOR_BGR2GRAY )
169- _ , roiWhitescreenBgBin = cv .threshold (roiWhitescreenGray , 220 , 255 , cv .THRESH_BINARY_INV )
169+ _ , roiWhitescreenBgBin = cv .threshold (roiWhitescreenGray , 170 , 255 , cv .THRESH_BINARY_INV )
170170 _ , roiWhitescreenTextBin = cv .threshold (roiWhitescreenGray , 20 , 255 , cv .THRESH_BINARY_INV )
171171 meanWhitescreenBgBin : float = cv .mean (roiWhitescreenBgBin )[0 ]
172172 meanWhitescreenTextBin : float = cv .mean (roiWhitescreenTextBin )[0 ]
@@ -186,7 +186,7 @@ def cvPassBlackscreen(self, frame: cv.Mat, framePoint: FramePoint) -> bool:
186186 _ , roiBlackscreenBlackBgBin = cv .threshold (roiBlackscreenGray , 10 , 255 , cv .THRESH_BINARY )
187187 _ , roiBlackscreenDimBgBin = cv .threshold (roiBlackscreenGray , 100 , 255 , cv .THRESH_BINARY )
188188 _ , roiBlackscreenTextBin = cv .threshold (roiBlackscreenGray , 240 , 255 , cv .THRESH_BINARY )
189- roiBlackscreenTextBinDialate = cv .morphologyEx (roiBlackscreenTextBin , cv .MORPH_DILATE , kernel = cv .getStructuringElement (cv .MORPH_RECT , (5 , 5 )))
189+ roiBlackscreenTextBinDialate = cv .morphologyEx (roiBlackscreenTextBin , cv .MORPH_DILATE , kernel = cv .getStructuringElement (cv .MORPH_RECT , (9 , 9 )))
190190 roiBlackscreenDimBgBinExcludeText = cv .bitwise_and (roiBlackscreenDimBgBin , cv .bitwise_not (roiBlackscreenTextBinDialate ))
191191
192192 meanBlackscreenBlackBgBin : float = cv .mean (roiBlackscreenBlackBgBin )[0 ]
0 commit comments