Skip to content

Commit

Permalink
Update ImageConvert.py
Browse files Browse the repository at this point in the history
fix issue ArduCAM#6
  • Loading branch information
gernot-hochmuth authored Nov 3, 2023
1 parent 5e84900 commit 44c8957
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ImageConvert.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ def RGB565ToMat(data,Width,Height):
arr = 0xFF000000 + ((arr & 0xF800) << 8) + ((arr & 0x07E0) << 5) + ((arr & 0x001F) << 3)

arr.dtype = np.uint8
iamge = arr.reshape(Height,Width,4)
return cv2.flip(iamge,0)
image = arr.reshape(Height,Width,4)
return cv2.flip(image,0)

def dBytesToMat(data,bitWidth,Width,Height):
arr = np.frombuffer(data,dtype=np.uint16)
Expand Down Expand Up @@ -59,7 +59,7 @@ def convert_color(image,color_mode):
image = cv2.cvtColor(image,COLOR_BayerGB2BGR)
if color_mode == 3:
image = cv2.cvtColor(image,COLOR_BayerBG2BGR)
if color_mode < 0 and color_mode > 3:
if color_mode < 0 or color_mode > 3:
image = cv2.cvtColor(image,COLOR_BayerGB2BGR)
return image
def convert_image(data,cfg,color_mode):
Expand Down

0 comments on commit 44c8957

Please sign in to comment.