0

This is my command

'''
data[0] = getData(CMD_PHOTO1, req)
'''
'''
print(data[0])
'''

#I try to read this again but stuck
data[0] = getData(CMD_PHOTO1, req)
print(data[0])
print("P1")
data[1] = data[0]+ getData(CMD_PHOTO2, req)
print(data[1])
print("P2")
s = data[1]
i = np.frombuffer(s,dtype=np.uint8)
im = cv2.imdecode(i,cv2.IMREAD_UNCHANGED)
cv2.imwrite('result.png',im)

[[255, 216, 255, 224, 0, 16, 74, 70, 73, 70, 0, 1, 1, 1, 0, 96, 0, 96, 0, 0, 255, 219, 0, 67, 0, 73, 50, 54, 64, 54, 45, 73, 64, 59, 64, 82, 77, 73, 86, 109, 182, 118, 109, 100, 100, 109, 222, 159, 168, 132, 182, 255, 232, 255, 255, 255, 232, 254, 250, 255, 255, 255, 255, 255, 255, 255, 255, 250, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 219, 0, 67, 1, 77, 82, 82, 109, 95, 109, 213, 118, 118, 213, 255, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 192, 0, 17, 8, 1, 99, 1, 41, 3, 1, 34, 0, 2, 17, 1, 3, 17, 1, 255, 196, 0, 31, 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 255, 196, 0, 181, 16, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 125, 1, 2, 3, 0, 4, 17, 5, 18, 33, 49, 65, 6, 19, 81, 97, 7, 34, 113, 20, 50, 129, 145, 161, 8], 144, 0]

Python needed help on array image image is read from card 1. from this array is image but we try to read it but stuck with 144,0 as last row? Is this is dtype? what type of this 144,0

2.how to made this array in to image?

3.can we use PIL to opencv ? How to?

Thank you again I tried for severe time but wont work please recommend me thanks you.

we got a error as below TypeError: a bytes-like object is required, not 'list'

  • The first two bytes are `ff`, `d8` in hex which is a JPEG marker. So you have a JPEG-encoded image. You can either save the bytes to a file with `.jpg` extension, or wrap it in a `io.BytesIO` and use PIL's `Image.open(io.BytesIO(yourThing))` – Mark Setchell Jun 19 '20 at 18:30
  • Or you can use OpenCV `imdecode()` like here... https://stackoverflow.com/a/62364915/2836621 – Mark Setchell Jun 19 '20 at 18:34
  • ###I try to read from smartcard image please help I am newbie – pjclient client Jun 20 '20 at 01:12
  • Your device seems to be giving you a list, or even a list of lists. Your list starts correctly for a JPEG with hex `ff`, `d8` (255, 216) but you don't seem to have the entire list because it should end with `ff`, `d9` (255, 217)`. I am not familiar with your device, but when you recover that list, my linked answer should work. – Mark Setchell Jun 20 '20 at 07:21

0 Answers0