Péter Gergely Dániel
[Add & Upd] Derived all modules/abstract modules from BaseModule; Derived all module output types from DataObject; Added batch processing support for all modules and pipeline
64fab87 Download src/preprocessing/channel_splitter.py from slityak/kpo: direct link, hf CLI and curl.
- Browser
- Download file 630 Bytes
-
https://huggingface.co/spaces/slityak/kpo/resolve/main/src/preprocessing/channel_splitter.py
- Command line
-
hf download hf://spaces/slityak/kpo/src/preprocessing/channel_splitter.py
-
curl -L -o channel_splitter.py https://huggingface.co/spaces/slityak/kpo/resolve/main/src/preprocessing/channel_splitter.py
630 Bytes
| """ | |
| Színcsatorna mentén szétosztó modul. | |
| Színes képet 3 szürkeskálás képpé alakít (r, g, b) sorrendben. | |
| """ | |
| from typing import List | |
| import cv2 | |
| import numpy as np | |
| from core.base_processor import PreprocessingModule | |
| from core import DataObject | |
| from constraints import TypeConstraint | |
| class ChannelSplitter(PreprocessingModule): | |
| def __init__(self): | |
| super().__init__(name="ChannelSplitter") | |
| self.add_constraint(TypeConstraint(np.uint8)) | |
| def _process(self, input: DataObject) -> List[DataObject]: | |
| r, g, b=cv2.split(input.data) | |
| return [DataObject(r), DataObject(g), DataObject(b)] |