Skip to content

Update ImageConvert.py #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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