- Fix i definition in last_consecutive
- Update flags in rotate
This commit is contained in:
linarphy 2023-05-10 14:12:51 +02:00
parent 17e0cc3fd8
commit 76550fc1ec
No known key found for this signature in database
GPG key ID: 3D4AAAC3AD16E79C

View file

@ -191,6 +191,7 @@ def last_consecutive( list_ ):
if not isinstance( list_ , list ) and not isinstance( list_ , np.ndarray ): if not isinstance( list_ , list ) and not isinstance( list_ , np.ndarray ):
raise ValueError( 'list_ must be a list, ' + type( list_ ) + ' given' ) raise ValueError( 'list_ must be a list, ' + type( list_ ) + ' given' )
first , lower , greater = list_[0] , 0 , len( list_ ) first , lower , greater = list_[0] , 0 , len( list_ )
i = lower + ( greater - lower ) // 2
while greater - lower != 1: while greater - lower != 1:
i = lower + ( greater - lower ) // 2 i = lower + ( greater - lower ) // 2
if list_[ i ] - first != i: # outside of the consecutive list if list_[ i ] - first != i: # outside of the consecutive list
@ -210,4 +211,4 @@ def rotate( image , angle ):
height , width = image.shape[ : 2 ] height , width = image.shape[ : 2 ]
cX , cY = ( width // 2 , height // 2 ) cX , cY = ( width // 2 , height // 2 )
matrix = cv2.getRotationMatrix2D( ( cX , cY ) , angle , 1 ) matrix = cv2.getRotationMatrix2D( ( cX , cY ) , angle , 1 )
return cv2.warpAffine( image , matrix , ( width , height ) , flags = cv2.INTER_LINEAR ) return cv2.warpAffine( image , matrix , ( width , height ) , flags = cv2.INTER_NEAREST )