-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
38 changed files
with
251 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
__title__ = "officialeye" | ||
__description__ = "An AI-powered generic document-analysis tool." | ||
__url__ = "https://officialeye.zerobone.net" | ||
__version__ = "1.1.3" | ||
__version__ = "1.1.4" | ||
__author__ = "Alexander Mayorov" | ||
__author_email__ = "[email protected]" | ||
__license__ = "GPL-3.0" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from typing import Dict | ||
|
||
import cv2 | ||
|
||
from officialeye._internal.context.context import Context | ||
from officialeye._internal.error.errors.template import ErrTemplateInvalidInterpretation | ||
from officialeye._internal.interpretation.method import InterpretationMethod | ||
from officialeye._internal.interpretation.serializable import Serializable | ||
|
||
|
||
class FileMethod(InterpretationMethod): | ||
|
||
METHOD_ID = "file" | ||
|
||
def __init__(self, context: Context, config_dict: Dict[str, any]): | ||
super().__init__(context, FileMethod.METHOD_ID, config_dict) | ||
|
||
self._path = self.get_config().get("path") | ||
|
||
def interpret(self, feature_img: cv2.Mat, template_id: str, feature_id: str, /) -> Serializable: | ||
|
||
feature = self._context.get_template(template_id).get_feature(feature_id) | ||
|
||
feature_class_generator = feature.get_feature_class().get_features() | ||
|
||
# check if the generator generates at least two elements | ||
if sum(1 for _ in zip(range(2), feature_class_generator)) == 2: | ||
raise ErrTemplateInvalidInterpretation( | ||
"while applying the '{FileMethod.METHOD_ID}' interpretation method.", | ||
f"This method cannot be applied if there are at least two features inheriting the feature class defining this method." | ||
) | ||
|
||
cv2.imwrite(self._path, feature_img) | ||
|
||
return None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.