@@ -2137,7 +2137,9 @@ def loadFile(self, filePath=None, isAdjustScale=True):
21372137
21382138 if unicodeFilePath and os .path .exists (unicodeFilePath ):
21392139 self .canvas .verified = False
2140- cvimg = cv2 .imdecode (np .fromfile (unicodeFilePath , dtype = np .uint8 ), 1 )
2140+ cvimg = cv2 .imdecode (
2141+ np .fromfile (unicodeFilePath , dtype = np .uint8 ), cv2 .IMREAD_COLOR
2142+ )
21412143 height , width , depth = cvimg .shape
21422144 cvimg = cv2 .cvtColor (cvimg , cv2 .COLOR_BGR2RGB )
21432145 image = QImage (
@@ -2939,7 +2941,7 @@ def autoRecognition(self):
29392941 self .init_key_list (self .Cachelabel )
29402942
29412943 def reRecognition (self ):
2942- img = cv2 .imdecode (np .fromfile (self .filePath , dtype = np .uint8 ), 1 )
2944+ img = cv2 .imdecode (np .fromfile (self .filePath , dtype = np .uint8 ), cv2 . IMREAD_COLOR )
29432945 if self .canvas .shapes :
29442946 self .result_dic = []
29452947 self .result_dic_locked = (
@@ -3023,7 +3025,7 @@ def reRecognition(self):
30233025 QMessageBox .information (self , "Information" , "Draw a box!" )
30243026
30253027 def singleRerecognition (self ):
3026- img = cv2 .imdecode (np .fromfile (self .filePath , dtype = np .uint8 ), 1 )
3028+ img = cv2 .imdecode (np .fromfile (self .filePath , dtype = np .uint8 ), cv2 . IMREAD_COLOR )
30273029 for shape in self .canvas .selectedShapes :
30283030 box = [[int (p .x ()), int (p .y ())] for p in shape .points ]
30293031 if len (box ) > 4 :
@@ -3495,7 +3497,9 @@ def saveRecResult(self):
34953497 idx = self .getImglabelidx (key )
34963498 try :
34973499 img_path = os .path .dirname (base_dir ) + "/" + key
3498- img = cv2 .imdecode (np .fromfile (img_path , dtype = np .uint8 ), - 1 )
3500+ img = cv2 .imdecode (
3501+ np .fromfile (img_path , dtype = np .uint8 ), cv2 .IMREAD_COLOR
3502+ )
34993503 for i , label in enumerate (self .PPlabel [idx ]):
35003504 if label ["difficult" ]:
35013505 continue
@@ -3645,7 +3649,7 @@ def format_shape(s):
36453649 self .actions .save .setEnabled (True )
36463650
36473651 def expandSelectedShape (self ):
3648- img = cv2 .imdecode (np .fromfile (self .filePath , dtype = np .uint8 ), 1 )
3652+ img = cv2 .imdecode (np .fromfile (self .filePath , dtype = np .uint8 ), cv2 . IMREAD_COLOR )
36493653 for shape in self .canvas .selectedShapes :
36503654 box = [[int (p .x ()), int (p .y ())] for p in shape .points ]
36513655 if len (box ) > 4 :
0 commit comments