Image colors are not correct
risingblock opened this issue · 2 comments
risingblock commented
Hi, I tried loading an image in Python and sending it.
It works, but the image appears very blue.
Here is my code:
from PIL import Image
from x64.Release import softcam
def main():
dt = 1/60
cam = softcam.camera(1920, 1280, 60)
image = Image.open('./test.jpg')
image = image.convert('RGB')
# Here, you can wait for an application to connect to this camera.
while not cam.wait_for_connection(timeout=1):
pass
while True:
# send the image
cam.send_frame(image)
if __name__ == '__main__':
main()
What shows up in Zoom (virtual camera):
https://i.imgur.com/3ljVlsU.jpg
Any idea why? Is it related to the color table of the image? I tried converting to RGB, not sure what else I should do.
Thanks
risingblock commented
Got this to work by converting the image to BGR format.
bgr_image = cv2.cvtColor(np.array(image), cv2.COLOR_RGB2BGR)
tshino commented
Yes, the API is expecting that the color component order is BGR!
This is due to following the DirectShow convention and maximizing camera application compatibility.
I didn't notice such incompatibility between OpenCV and Pillow. I will add a note on it to the README!
Thank you for your information!