Cognitive-Face-Python icon indicating copy to clipboard operation
Cognitive-Face-Python copied to clipboard

Add type bytes, then You can read image file by yourself.

Open LuxunHuang opened this issue 7 years ago • 2 comments

I add a type bytes, then user can read file by itself. For example, I use opencv to capture image from ipcam, then change it type from ndarray to bytes.

I = ipcam.getframe()
I = cv2.resize(I, (720, 480))
Ibyte = cv2.imencode(".jpg", I)[1].tostring()

LuxunHuang avatar Oct 12 '18 10:10 LuxunHuang

Hi @LuxunHuang, thanks for your contribution.

  1. Could you please also take care of the comments in this query?
  2. Can you confirm this works both under Python 3.6 (& 3.7) and Python 2.7?

lebronJ avatar Oct 16 '18 05:10 lebronJ

@LuxunHuang when I use this patch, I get stat: embedded null character in path because the os.path.isfile(image) comes before your check; and image at that point is bytes. Just need to have your elif block come before the isfile check

lefnire avatar Feb 16 '19 00:02 lefnire