Skip to content

Commit 700a4d6

Browse files
authored
Merge pull request #1310 from DDMAL/column-split-fix
Added an extra input and output for an RGB image in Column Splitting, mainly to be used as an input for Interactive Classifier.
2 parents af5cacd + 1473d04 commit 700a4d6

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

rodan-main/code/rodan/jobs/column_split/base.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class ColumnSplit(RodanTask):
3535
{'name': 'Background Layer', 'minimum': 0, 'maximum': 1, 'resource_types': ['image/rgba+png']},
3636
{'name': 'Music Notes Layer', 'minimum': 1, 'maximum': 1, 'resource_types': ['image/rgba+png']},
3737
{'name': 'Text Layer', 'minimum': 1, 'maximum': 1, 'resource_types': ['image/rgba+png']},
38+
{'name': 'RGB Image', 'minimum': 0, 'maximum': 1, 'resource_types': ['image/rgb+png']},
3839
{'name': 'Layer 4', 'minimum': 0, 'maximum': 1, 'resource_types': ['image/rgba+png']},
3940
{'name': 'Layer 5', 'minimum': 0, 'maximum': 1, 'resource_types': ['image/rgba+png']},
4041
{'name': 'Layer 6', 'minimum': 0, 'maximum': 1, 'resource_types': ['image/rgba+png']},
@@ -49,6 +50,7 @@ class ColumnSplit(RodanTask):
4950
{'name': 'Background Layer', 'minimum': 0, 'maximum': 1, 'resource_types': ['image/rgba+png']},
5051
{'name': 'Music Notes Layer', 'minimum': 1, 'maximum': 1, 'resource_types': ['image/rgba+png']},
5152
{'name': 'Text Layer', 'minimum': 1, 'maximum': 1, 'resource_types': ['image/rgba+png']},
53+
{'name': 'RGB Image', 'minimum': 0, 'maximum': 1, 'resource_types': ['image/rgb+png']},
5254
{'name': 'All Layers', 'minimum': 0, 'maximum': 1, 'resource_types': ['image/rgba+png']},
5355
{'name': 'Layer 5', 'minimum': 0, 'maximum': 1, 'resource_types': ['image/rgba+png']},
5456
{'name': 'Layer 6', 'minimum': 0, 'maximum': 1, 'resource_types': ['image/rgba+png']},
@@ -113,7 +115,8 @@ def run_my_task(self, inputs, settings, outputs):
113115
layer = inputs[key][0]['resource_path']
114116
img = cv.imread(layer,cv.IMREAD_UNCHANGED)
115117
layer_stacked = get_stacked_image(img,ranges)
116-
layers.append(img)
118+
if key != 'RGB Image':
119+
layers.append(img)
117120
if key in outputs:
118121
outfile = outputs[key][0]['resource_path']
119122
cv.imwrite(outfile+".png",layer_stacked)

rodan-main/code/rodan/jobs/column_split/column_split.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ def get_split_ranges(img,splits):
9696
return ranges
9797

9898
# takes ranges in x, and stacks them vertically
99+
# works for both RGB and RGBA images by adding white pixels regardless of amt of channels -
100+
# constant_values=255 pads with (255, 255, 255) for 3, (255, 255, 255, 255) for 4
99101
def get_stacked_image(img,ranges):
100102
chunks = []
101103
max = 0

0 commit comments

Comments
 (0)