generated from Hazel/python-project
Compare commits
2 Commits
bb6eafbc74
...
ff2088c1d0
Author | SHA1 | Date | |
---|---|---|---|
ff2088c1d0 | |||
e104a8f45c |
@ -1,6 +1,6 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Union
|
from typing import Union, List
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import json
|
import json
|
||||||
|
|
||||||
@ -15,6 +15,7 @@ class RawImage:
|
|||||||
|
|
||||||
self.meta_file = self._get_path("boxes.json")
|
self.meta_file = self._get_path("boxes.json")
|
||||||
self.meta_data = self.read_meta()
|
self.meta_data = self.read_meta()
|
||||||
|
|
||||||
self.image = self.get_image()
|
self.image = self.get_image()
|
||||||
|
|
||||||
def _get_path(self, ending: str, original_suffix: bool = False) -> Path:
|
def _get_path(self, ending: str, original_suffix: bool = False) -> Path:
|
||||||
@ -37,3 +38,11 @@ class RawImage:
|
|||||||
|
|
||||||
def get_image(self) -> np.ndarray:
|
def get_image(self) -> np.ndarray:
|
||||||
return cv2.imread(str(self.file))
|
return cv2.imread(str(self.file))
|
||||||
|
|
||||||
|
@property
|
||||||
|
def bounding_boxes(self) -> List[List[int]]:
|
||||||
|
_key = "bounding_boxes"
|
||||||
|
if _key not in self.meta_data:
|
||||||
|
self.meta_data[_key] = []
|
||||||
|
|
||||||
|
return self.meta_data[_key]
|
||||||
|
@ -18,4 +18,5 @@ def select_bounding_boxes(to_detect: str):
|
|||||||
fromCenter=False
|
fromCenter=False
|
||||||
)
|
)
|
||||||
|
|
||||||
print(bounding_boxes)
|
raw_image.bounding_boxes.extend(bounding_boxes)
|
||||||
|
raw_image.write_meta()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user