MCPcopy Create free account
hub / github.com/Topdu/OpenOCR / checkImageIsValid

Function checkImageIsValid

tools/create_lmdb_dataset.py:39–47  ·  view source on GitHub ↗
(imageBin)

Source from the content-addressed store, hash-verified

37
38
39def 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
50def writeCache(env, cache):

Callers 1

createDatasetFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected