Skip to content

Commit 87c87e9

Browse files
committed
add Scaler module
1 parent 2d859c3 commit 87c87e9

4 files changed

Lines changed: 38 additions & 0 deletions

File tree

configs/nikon_d3x.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ module_enable_status:
1414
fcs: True
1515
hsc: True
1616
bcc: True
17+
scl: False
1718

1819
hardware:
1920
raw_width: 6080
@@ -93,3 +94,7 @@ hsc:
9394
bcc:
9495
brightness_offset: 0
9596
contrast_gain: 256 # x256
97+
98+
scl:
99+
width: 6080
100+
height: 4044

configs/test.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ module_enable_status:
1414
fcs: True
1515
hsc: True
1616
bcc: True
17+
scl: False
1718

1819
hardware:
1920
raw_width: 1920
@@ -93,3 +94,7 @@ hsc:
9394
bcc:
9495
brightness_offset: 0
9596
contrast_gain: 256 # x256
97+
98+
scl:
99+
width: 1920
100+
height: 1080

modules/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@
1515
from .gac import GAC
1616
from .hsc import HSC
1717
from .nlm import NLM
18+
from .scl import SCL

modules/scl.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# File: scl.py
2+
# Description: Scaler
3+
# Created: 2021/10/26 22:36
4+
# Author: Qiu Jueqin (qiujueqin@gmail.com)
5+
6+
7+
from functools import partial
8+
import cv2
9+
10+
from .basic_module import BasicModule
11+
12+
13+
class SCL(BasicModule):
14+
def __init__(self, cfg):
15+
super().__init__(cfg)
16+
self.resize = partial(
17+
cv2.resize, dsize=(self.params.width, self.params.height), interpolation=cv2.INTER_LINEAR
18+
)
19+
20+
def execute(self, data):
21+
if 'y_image' and 'cbcr_image' in data:
22+
data['y_image'] = self.resize(data['y_image'])
23+
data['cbcr_image'] = self.resize(data['cbcr_image'])
24+
elif 'rgb_image' in data:
25+
data['rgb_image'] = self.resize(data['rgb_image'])
26+
else:
27+
raise NotImplementedError('can not resize Bayer array')

0 commit comments

Comments
 (0)