mirror of
https://github.com/283375/arcaea-offline-ocr.git
synced 2025-04-18 13:00:18 +00:00
refactor: extractor
This commit is contained in:
parent
da42699ac8
commit
580744b641
@ -0,0 +1,2 @@
|
|||||||
|
from .common import Extractor
|
||||||
|
from .sizes import *
|
@ -1,5 +1,45 @@
|
|||||||
|
import cv2
|
||||||
|
|
||||||
|
from ..crop import crop_xywh
|
||||||
from .sizes.common import Sizes
|
from .sizes.common import Sizes
|
||||||
|
|
||||||
|
|
||||||
class Extractor:
|
class Extractor:
|
||||||
sizes: Sizes
|
def __init__(self, img: cv2.Mat, sizes: Sizes):
|
||||||
|
self.img = img
|
||||||
|
self.sizes = sizes
|
||||||
|
|
||||||
|
def __construct_int_rect(self, rect):
|
||||||
|
return tuple(round(r) for r in rect)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def pure(self):
|
||||||
|
return crop_xywh(self.img, self.__construct_int_rect(self.sizes.pure))
|
||||||
|
|
||||||
|
@property
|
||||||
|
def far(self):
|
||||||
|
return crop_xywh(self.img, self.__construct_int_rect(self.sizes.far))
|
||||||
|
|
||||||
|
@property
|
||||||
|
def lost(self):
|
||||||
|
return crop_xywh(self.img, self.__construct_int_rect(self.sizes.lost))
|
||||||
|
|
||||||
|
@property
|
||||||
|
def score(self):
|
||||||
|
return crop_xywh(self.img, self.__construct_int_rect(self.sizes.score))
|
||||||
|
|
||||||
|
@property
|
||||||
|
def rating_class(self):
|
||||||
|
return crop_xywh(self.img, self.__construct_int_rect(self.sizes.rating_class))
|
||||||
|
|
||||||
|
@property
|
||||||
|
def max_recall(self):
|
||||||
|
return crop_xywh(self.img, self.__construct_int_rect(self.sizes.max_recall))
|
||||||
|
|
||||||
|
@property
|
||||||
|
def clear_status(self):
|
||||||
|
return crop_xywh(self.img, self.__construct_int_rect(self.sizes.clear_status))
|
||||||
|
|
||||||
|
@property
|
||||||
|
def partner_icon(self):
|
||||||
|
return crop_xywh(self.img, self.__construct_int_rect(self.sizes.partner_icon))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user