vprdb.providers.color_image_provider
1# Copyright (c) 2023, Ivan Moskalenko, Anastasiia Kornilova 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14import cv2 15 16from dataclasses import dataclass 17from nptyping import NDArray, Shape, UInt8 18from pathlib import Path 19 20 21@dataclass(frozen=True) 22class ColorImageProvider: 23 """Color image provider is a wrapper for color images""" 24 25 path: Path 26 """Path to the file on the hard drive""" 27 28 @property 29 def color_image(self) -> NDArray[Shape["*, *, 3"], UInt8]: 30 """Returns image in OpenCV format""" 31 return cv2.imread(str(self.path), cv2.IMREAD_COLOR)
@dataclass(frozen=True)
class
ColorImageProvider:
22@dataclass(frozen=True) 23class ColorImageProvider: 24 """Color image provider is a wrapper for color images""" 25 26 path: Path 27 """Path to the file on the hard drive""" 28 29 @property 30 def color_image(self) -> NDArray[Shape["*, *, 3"], UInt8]: 31 """Returns image in OpenCV format""" 32 return cv2.imread(str(self.path), cv2.IMREAD_COLOR)
Color image provider is a wrapper for color images