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

Method get_test_image

test_openocr.py:52–64  ·  view source on GitHub ↗

Get first valid image from directory

(self, image_dir)

Source from the content-addressed store, hash-verified

50 logger.info(f' Output: {self.output_dir}')
51
52 def get_test_image(self, image_dir):
53 """Get first valid image from directory"""
54 if not image_dir.exists():
55 logger.warning(f'Directory not found: {image_dir}')
56 return None
57
58 for ext in ['.jpg', '.jpeg', '.png', '.bmp']:
59 images = list(image_dir.glob(f'*{ext}'))
60 if images:
61 return str(images[0])
62
63 logger.warning(f'No images found in: {image_dir}')
64 return None
65
66 def test_python_api(self):
67 """Test OpenOCR using Python API"""

Callers 2

test_python_apiMethod · 0.95
test_command_lineMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected