(imageBin)
| 37 | |
| 38 | |
| 39 | def checkImageIsValid(imageBin): |
| 40 | if imageBin is None: |
| 41 | return False |
| 42 | imageBuf = np.frombuffer(imageBin, dtype=np.uint8) |
| 43 | img = cv2.imdecode(imageBuf, cv2.IMREAD_GRAYSCALE) |
| 44 | imgH, imgW = img.shape[0], img.shape[1] |
| 45 | if imgH * imgW == 0: |
| 46 | return False |
| 47 | return True |
| 48 | |
| 49 | |
| 50 | def writeCache(env, cache): |