python - 从字节转换后图像变为蓝色
问题描述
我正在接收以字节为单位的图像并将其转换为 JPG,但大部分颜色都变成了蓝色。代码中是否有可能导致这种情况的东西?
# Image capture and saving
def take_Images(servo):
output_list = []
for i in range(9):
sys.stdout.flush()
# Call image
img = get_Frame_Buffer_Call_Back("sensor.RGB565", "sensor.QVGA", cutthrough=False, silent=False)
if img is not None:
image = Image.open(io.BytesIO(img))
image_visible = cv2.cvtColor(np.array(image), cv2.COLOR_BGR2RGB)
output_list.append(image_visible)
# Move Servo
servo.ChangeDutyCycle(1)
time.sleep(0.05)
servo.ChangeDutyCycle(0)
else:
print("Error!")
servo.stop()
time.sleep(1)
return output_list
解决方案
推荐阅读
- google-cloud-firestore - Firestore:地图字段上的查询(==)
- django - 分页 Django Rest 框架 POST
- node.js - 使用 Node.js 数据创建 POST http.request 的问题在 FormValue 而不是 Body 中传递
- python - 实施 1-ply、2-ply 或 3-ply 搜索 td-gammon
- amazon-web-services - 无法连接到 AWS E2 实例(但安全组允许入站)
- vb.net - 当焦点位于按钮上时,如何禁用 Page Down/Up?
- typescript - tsmockito - 如何模拟一个接受 lambda 参数的函数
- oracle - 克隆服务器后Oracle数据库连接问题
- ruby-on-rails - 如何在 Ruby 中生成 OAuth 2 客户端 ID 和密钥
- java - 通用添加方法