文档检测
This commit is contained in:
16
object_detection/doc_detect.py
Normal file
16
object_detection/doc_detect.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import numpy as np
|
||||
|
||||
from object_detection import CornerNet_Saccade
|
||||
from util import image_util
|
||||
|
||||
|
||||
def capture_target_area(image, target="book"):
|
||||
detector = CornerNet_Saccade()
|
||||
bboxes = detector(image)
|
||||
target_images = []
|
||||
keep_inds = bboxes[target][:, -1] > 0.5
|
||||
for bbox in bboxes[target][keep_inds]:
|
||||
bbox = bbox[0:4].astype(np.int32)
|
||||
bbox = np.clip(bbox, 0, None)
|
||||
target_images.append(image_util.capture(image, bbox))
|
||||
return target_images
|
||||
Reference in New Issue
Block a user