@rosepetal/node-red-contrib-image-tools 1.2.2 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/build-prebuild.yml +3 -0
- package/install.sh +8 -0
- package/node-red-contrib-image-tools/lib/node-utils.js +64 -0
- package/node-red-contrib-image-tools/nodes/blend/add-bbs.html +242 -3
- package/node-red-contrib-image-tools/nodes/blend/add-bbs.js +10 -3
- package/node-red-contrib-image-tools/nodes/blend/add-mask.html +282 -4
- package/node-red-contrib-image-tools/nodes/blend/add-mask.js +15 -8
- package/node-red-contrib-image-tools/nodes/blend/add-masks.html +206 -3
- package/node-red-contrib-image-tools/nodes/blend/add-masks.js +10 -3
- package/node-red-contrib-image-tools/nodes/blend/blend.html +332 -4
- package/node-red-contrib-image-tools/nodes/blend/blend.js +10 -3
- package/node-red-contrib-image-tools/nodes/io/folder-in.html +147 -3
- package/node-red-contrib-image-tools/nodes/io/folder-in.js +2 -1
- package/node-red-contrib-image-tools/nodes/io/image-in.html +81 -2
- package/node-red-contrib-image-tools/nodes/io/image-in.js +2 -1
- package/node-red-contrib-image-tools/nodes/io/image-out.html +197 -3
- package/node-red-contrib-image-tools/nodes/io/image-out.js +2 -1
- package/node-red-contrib-image-tools/nodes/mix/advanced-mosaic.html +398 -3
- package/node-red-contrib-image-tools/nodes/mix/advanced-mosaic.js +11 -4
- package/node-red-contrib-image-tools/nodes/mix/concat.html +245 -5
- package/node-red-contrib-image-tools/nodes/mix/concat.js +10 -3
- package/node-red-contrib-image-tools/nodes/mix/mosaic.html +307 -3
- package/node-red-contrib-image-tools/nodes/mix/mosaic.js +10 -3
- package/node-red-contrib-image-tools/nodes/specialized/cropBB.html +217 -4
- package/node-red-contrib-image-tools/nodes/specialized/cropBB.js +11 -2
- package/node-red-contrib-image-tools/nodes/specialized/image-align.html +285 -4
- package/node-red-contrib-image-tools/nodes/specialized/image-align.js +9 -2
- package/node-red-contrib-image-tools/nodes/transform/color-convert.html +169 -6
- package/node-red-contrib-image-tools/nodes/transform/color-convert.js +11 -2
- package/node-red-contrib-image-tools/nodes/transform/crop.html +237 -5
- package/node-red-contrib-image-tools/nodes/transform/crop.js +11 -2
- package/node-red-contrib-image-tools/nodes/transform/draw.html +152 -3
- package/node-red-contrib-image-tools/nodes/transform/draw.js +10 -3
- package/node-red-contrib-image-tools/nodes/transform/filter.html +369 -4
- package/node-red-contrib-image-tools/nodes/transform/filter.js +11 -2
- package/node-red-contrib-image-tools/nodes/transform/padding.html +316 -5
- package/node-red-contrib-image-tools/nodes/transform/padding.js +11 -2
- package/node-red-contrib-image-tools/nodes/transform/resize.html +203 -5
- package/node-red-contrib-image-tools/nodes/transform/resize.js +11 -2
- package/node-red-contrib-image-tools/nodes/transform/rotate.html +164 -5
- package/node-red-contrib-image-tools/nodes/transform/rotate.js +11 -2
- package/package.json +71 -71
- package/scripts/dual-register.js +267 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!-- nodes/blend/add-mask.html -->
|
|
2
2
|
|
|
3
3
|
<script type="text/javascript">
|
|
4
|
-
|
|
4
|
+
var _rpNodeCfg = {
|
|
5
5
|
category:'RP Image',
|
|
6
6
|
color:'#DDA0DD',
|
|
7
7
|
icon:'font-awesome/fa-mask',
|
|
@@ -13,6 +13,9 @@
|
|
|
13
13
|
outputFormat:{value:"raw"},
|
|
14
14
|
outputQuality:{value:90},
|
|
15
15
|
pngOptimize:{value:false},
|
|
16
|
+
webpLossless:{value:false},
|
|
17
|
+
webpSmartSubsample:{value:false},
|
|
18
|
+
webpEffort:{value:""},
|
|
16
19
|
// Debug configuration
|
|
17
20
|
debugEnabled:{value:false},
|
|
18
21
|
debugWidth:{value:200},
|
|
@@ -21,7 +24,7 @@
|
|
|
21
24
|
fillColor:{value:"#ffffff"} // Default white for polygon fill
|
|
22
25
|
},
|
|
23
26
|
inputs:1,outputs:1,
|
|
24
|
-
label:function(){return this.name||"add-mask";},
|
|
27
|
+
label:function(){return this.name||"rp-add-mask";},
|
|
25
28
|
oneditprepare:function(){
|
|
26
29
|
/* path typedInputs */
|
|
27
30
|
$("#node-input-imagePath").typedInput({
|
|
@@ -63,6 +66,11 @@
|
|
|
63
66
|
const format = $("#node-input-outputFormat").val();
|
|
64
67
|
$("#quality-row").toggle(format === "jpg" || format === "webp");
|
|
65
68
|
$("#png-optimize-row").toggle(format === "png");
|
|
69
|
+
// Show WebP advanced options only when WebP is selected
|
|
70
|
+
const isWebp = format === 'webp';
|
|
71
|
+
$("#webp-lossless-row").toggle(isWebp);
|
|
72
|
+
$("#webp-smartsubsample-row").toggle(isWebp);
|
|
73
|
+
$("#webp-effort-row").toggle(isWebp);
|
|
66
74
|
}
|
|
67
75
|
$("#node-input-outputFormat").on("change", updateQualityVisibility);
|
|
68
76
|
updateQualityVisibility(); // initial state
|
|
@@ -98,7 +106,9 @@
|
|
|
98
106
|
$('#node-input-debugEnabled').data('debug-enabled', enabled);
|
|
99
107
|
});
|
|
100
108
|
}
|
|
101
|
-
}
|
|
109
|
+
};
|
|
110
|
+
RED.nodes.registerType('rp-add-mask', _rpNodeCfg);
|
|
111
|
+
RED.nodes.registerType('add-mask', Object.assign({}, _rpNodeCfg, { category: 'deprecated' }));
|
|
102
112
|
|
|
103
113
|
// Debug image display renderer - shared across all image processing nodes
|
|
104
114
|
if (!window.debugImageRendererInitialized) {
|
|
@@ -210,7 +220,7 @@
|
|
|
210
220
|
}
|
|
211
221
|
</script>
|
|
212
222
|
|
|
213
|
-
<script type="text/x-red" data-template-name="add-mask">
|
|
223
|
+
<script type="text/x-red" data-template-name="rp-add-mask">
|
|
214
224
|
<div class="form-row">
|
|
215
225
|
<label><i class="fa fa-picture-o"></i> Image</label>
|
|
216
226
|
<input type="text" id="node-input-imagePath" style="width:70%;">
|
|
@@ -250,7 +260,112 @@
|
|
|
250
260
|
<input type="checkbox" id="node-input-pngOptimize" style="display:inline-block; width:auto; vertical-align:baseline;">
|
|
251
261
|
<label for="node-input-pngOptimize" style="width:auto; margin-left:5px;">Compress PNG (slower, smaller file)</label>
|
|
252
262
|
</div>
|
|
263
|
+
<div class="form-row" id="webp-lossless-row" style="display: none;">
|
|
264
|
+
<label for="node-input-webpLossless"><i class="fa fa-lock"></i> Lossless</label>
|
|
265
|
+
<input type="checkbox" id="node-input-webpLossless" style="display:inline-block; width:auto; vertical-align:baseline;">
|
|
266
|
+
<label for="node-input-webpLossless" style="width:auto; margin-left:5px;">Encode WebP without loss</label>
|
|
267
|
+
</div>
|
|
268
|
+
<div class="form-row" id="webp-smartsubsample-row" style="display: none;">
|
|
269
|
+
<label for="node-input-webpSmartSubsample"><i class="fa fa-magic"></i> Smart Subsample</label>
|
|
270
|
+
<input type="checkbox" id="node-input-webpSmartSubsample" style="display:inline-block; width:auto; vertical-align:baseline;">
|
|
271
|
+
<label for="node-input-webpSmartSubsample" style="width:auto; margin-left:5px;">Better chroma downsampling (lossy only)</label>
|
|
272
|
+
</div>
|
|
273
|
+
<div class="form-row" id="webp-effort-row" style="display: none;">
|
|
274
|
+
<label for="node-input-webpEffort"><i class="fa fa-tachometer"></i> Effort</label>
|
|
275
|
+
<input type="number" id="node-input-webpEffort" min="0" max="6" placeholder="4" style="width: 70px;">
|
|
276
|
+
<span style="margin-left: 10px; color: #666;">0-6 (higher = smaller file, slower)</span>
|
|
277
|
+
</div>
|
|
278
|
+
|
|
279
|
+
<!-- Debug Configuration -->
|
|
280
|
+
<div class="form-row">
|
|
281
|
+
<label for="node-input-debugEnabled"><i class="fa fa-bug"></i> Debug</label>
|
|
282
|
+
<input type="checkbox" id="node-input-debugEnabled" style="display:inline-block; width:auto; vertical-align:baseline;">
|
|
283
|
+
<label for="node-input-debugEnabled" style="width:auto; margin-left:5px;">Show processed image</label>
|
|
284
|
+
</div>
|
|
285
|
+
<div class="form-row" id="debug-width-row" style="display: none;">
|
|
286
|
+
<label for="node-input-debugWidth"><i class="fa fa-arrows-h"></i> Debug Width</label>
|
|
287
|
+
<input type="text" id="node-input-debugWidth" style="width: 120px;">
|
|
288
|
+
<input type="hidden" id="node-input-debugWidthType">
|
|
289
|
+
<span style="margin-left: 10px; color: #666;">pixels</span>
|
|
290
|
+
</div>
|
|
291
|
+
|
|
292
|
+
<hr/>
|
|
293
|
+
|
|
294
|
+
<div class="form-row">
|
|
295
|
+
<label for="node-input-maskStrength"><i class="fa fa-adjust"></i> Mask Strength</label>
|
|
296
|
+
<input type="range" id="node-input-maskStrength" min="0" max="100" value="50" style="width: 200px;">
|
|
297
|
+
<span id="strength-value" style="margin-left: 10px; font-weight: bold;">50%</span>
|
|
298
|
+
<div style="margin-top: 5px; font-size: 11px; color: #666;" id="strength-label">
|
|
299
|
+
Balanced mask application
|
|
300
|
+
</div>
|
|
301
|
+
<div style="margin-top: 5px; font-size: 10px; color: #999;">
|
|
302
|
+
0% = No mask effect | 50% = Balanced | 100% = Full mask effect
|
|
303
|
+
</div>
|
|
304
|
+
</div>
|
|
305
|
+
|
|
306
|
+
<div class="form-row">
|
|
307
|
+
<label for="node-input-fillColor"><i class="fa fa-eyedropper"></i> Fill Color</label>
|
|
308
|
+
<input type="color" id="node-input-fillColor" value="#ffffff" style="width: 60px; height: 30px;">
|
|
309
|
+
<span style="margin-left: 10px; color: #666;">Color to fill polygon mask</span>
|
|
310
|
+
</div>
|
|
311
|
+
</script>
|
|
312
|
+
|
|
313
|
+
<script type="text/x-red" data-template-name="add-mask">
|
|
314
|
+
<div class="form-row">
|
|
315
|
+
<label><i class="fa fa-picture-o"></i> Image</label>
|
|
316
|
+
<input type="text" id="node-input-imagePath" style="width:70%;">
|
|
317
|
+
<input type="hidden" id="node-input-imagePathType">
|
|
318
|
+
</div>
|
|
319
|
+
|
|
320
|
+
<div class="form-row">
|
|
321
|
+
<label><i class="fa fa-draw-polygon"></i> Polygon Path</label>
|
|
322
|
+
<input type="text" id="node-input-polygonPath" style="width:70%;">
|
|
323
|
+
<input type="hidden" id="node-input-polygonPathType">
|
|
324
|
+
</div>
|
|
325
|
+
|
|
326
|
+
<div class="form-row">
|
|
327
|
+
<label><i class="fa fa-sign-out"></i> Output</label>
|
|
328
|
+
<input type="text" id="node-input-outputPath" style="width:70%;">
|
|
329
|
+
<input type="hidden" id="node-input-outputPathType">
|
|
330
|
+
</div>
|
|
331
|
+
|
|
332
|
+
<div class="form-row">
|
|
333
|
+
<label for="node-input-outputFormat"><i class="fa fa-file-image-o"></i> Output Format</label>
|
|
334
|
+
<select id="node-input-outputFormat" style="width: 200px;">
|
|
335
|
+
<option value="raw">Raw (fastest)</option>
|
|
336
|
+
<option value="jpg">JPEG</option>
|
|
337
|
+
<option value="png">PNG</option>
|
|
338
|
+
<option value="webp">WebP</option>
|
|
339
|
+
</select>
|
|
340
|
+
</div>
|
|
341
|
+
|
|
342
|
+
<div class="form-row" id="quality-row">
|
|
343
|
+
<label for="node-input-outputQuality"><i class="fa fa-sliders"></i> Quality</label>
|
|
344
|
+
<input type="number" id="node-input-outputQuality" min="1" max="100" value="90" style="width: 70px;">
|
|
345
|
+
<span style="margin-left: 10px; color: #666;">1-100 (JPG/WebP only)</span>
|
|
346
|
+
</div>
|
|
253
347
|
|
|
348
|
+
<div class="form-row" id="png-optimize-row" style="display: none;">
|
|
349
|
+
<label for="node-input-pngOptimize"><i class="fa fa-compress"></i> PNG Optimize</label>
|
|
350
|
+
<input type="checkbox" id="node-input-pngOptimize" style="display:inline-block; width:auto; vertical-align:baseline;">
|
|
351
|
+
<label for="node-input-pngOptimize" style="width:auto; margin-left:5px;">Compress PNG (slower, smaller file)</label>
|
|
352
|
+
</div>
|
|
353
|
+
<div class="form-row" id="webp-lossless-row" style="display: none;">
|
|
354
|
+
<label for="node-input-webpLossless"><i class="fa fa-lock"></i> Lossless</label>
|
|
355
|
+
<input type="checkbox" id="node-input-webpLossless" style="display:inline-block; width:auto; vertical-align:baseline;">
|
|
356
|
+
<label for="node-input-webpLossless" style="width:auto; margin-left:5px;">Encode WebP without loss</label>
|
|
357
|
+
</div>
|
|
358
|
+
<div class="form-row" id="webp-smartsubsample-row" style="display: none;">
|
|
359
|
+
<label for="node-input-webpSmartSubsample"><i class="fa fa-magic"></i> Smart Subsample</label>
|
|
360
|
+
<input type="checkbox" id="node-input-webpSmartSubsample" style="display:inline-block; width:auto; vertical-align:baseline;">
|
|
361
|
+
<label for="node-input-webpSmartSubsample" style="width:auto; margin-left:5px;">Better chroma downsampling (lossy only)</label>
|
|
362
|
+
</div>
|
|
363
|
+
<div class="form-row" id="webp-effort-row" style="display: none;">
|
|
364
|
+
<label for="node-input-webpEffort"><i class="fa fa-tachometer"></i> Effort</label>
|
|
365
|
+
<input type="number" id="node-input-webpEffort" min="0" max="6" placeholder="4" style="width: 70px;">
|
|
366
|
+
<span style="margin-left: 10px; color: #666;">0-6 (higher = smaller file, slower)</span>
|
|
367
|
+
</div>
|
|
368
|
+
|
|
254
369
|
<!-- Debug Configuration -->
|
|
255
370
|
<div class="form-row">
|
|
256
371
|
<label for="node-input-debugEnabled"><i class="fa fa-bug"></i> Debug</label>
|
|
@@ -285,6 +400,169 @@
|
|
|
285
400
|
</div>
|
|
286
401
|
</script>
|
|
287
402
|
|
|
403
|
+
<script type="text/x-red" data-help-name="rp-add-mask">
|
|
404
|
+
<p><b>rosepetal-add-mask</b> applies a polygon-based mask to a base image using weighted blending with configurable mask strength and fill color. This node generates masks from polygon coordinates (from object detection results) and blends them with the original image.</p>
|
|
405
|
+
|
|
406
|
+
<h3>Details</h3>
|
|
407
|
+
<p>This node performs high-performance polygon-based blending using OpenCV. A binary mask is generated from polygon coordinates using OpenCV's fillPoly function, then applied to the base image as blending weights. The polygon coordinates are expected to be normalized (0-1 range) and are automatically scaled to match the image dimensions.</p>
|
|
408
|
+
|
|
409
|
+
<h3>Properties</h3>
|
|
410
|
+
<dl class="message-properties">
|
|
411
|
+
<dt>Image <span class="property-type">string</span></dt>
|
|
412
|
+
<dd>Message property path containing the base image to which the mask will be applied. Supports <code>msg</code>, <code>flow</code>, or <code>global</code> context via TypedInput.</dd>
|
|
413
|
+
|
|
414
|
+
<dt>Polygon Path <span class="property-type">string</span></dt>
|
|
415
|
+
<dd>Message property path containing the polygon coordinates array. Expected format: array of [x, y] coordinate pairs with normalized values (0.0-1.0 range). Supports <code>msg</code>, <code>flow</code>, or <code>global</code> context via TypedInput.</dd>
|
|
416
|
+
|
|
417
|
+
<dt>Output to <span class="property-type">string</span></dt>
|
|
418
|
+
<dd>Message property path where the masked image will be stored. Supports <code>msg</code>, <code>flow</code>, or <code>global</code> context via TypedInput.</dd>
|
|
419
|
+
|
|
420
|
+
<dt>Output Format <span class="property-type">string</span></dt>
|
|
421
|
+
<dd>Format for the output image: <code>raw</code> (fastest), <code>jpg</code>, <code>png</code>, or <code>webp</code>.</dd>
|
|
422
|
+
|
|
423
|
+
<dt>Quality <span class="property-type">number</span></dt>
|
|
424
|
+
<dd>Compression quality (1-100) for JPEG and WebP formats. Only visible when JPG or WebP is selected.</dd>
|
|
425
|
+
|
|
426
|
+
<dt>Mask Strength <span class="property-type">number</span></dt>
|
|
427
|
+
<dd>Intensity of mask application from 0% to 100%. Controls how strongly the mask affects the final result.</dd>
|
|
428
|
+
|
|
429
|
+
<dt>Fill Color <span class="property-type">color</span></dt>
|
|
430
|
+
<dd>Color to fill the polygon mask (default: white #ffffff). This becomes the mask color for blending with the original image.</dd>
|
|
431
|
+
</dl>
|
|
432
|
+
|
|
433
|
+
<h3>Inputs</h3>
|
|
434
|
+
<p>Requires a base image and polygon coordinates from the specified message property paths:</p>
|
|
435
|
+
<ul>
|
|
436
|
+
<li><b>Base Image:</b> From the path specified in "Image" field (default: <code>msg.payload.image</code>)</li>
|
|
437
|
+
<li><b>Polygon Coordinates:</b> From the path specified in "Polygon Path" field (default: <code>msg.payload.default.masks[0].mask[0]</code>)</li>
|
|
438
|
+
</ul>
|
|
439
|
+
|
|
440
|
+
<p>The base image should follow the standard format:</p>
|
|
441
|
+
<pre>{
|
|
442
|
+
data: Buffer, // Raw pixel data or encoded file buffer
|
|
443
|
+
width: number, // Image width in pixels
|
|
444
|
+
height: number, // Image height in pixels
|
|
445
|
+
channels: number, // Channel count (1=grayscale, 3=RGB, 4=RGBA)
|
|
446
|
+
colorSpace: string, // "GRAY", "RGB", "RGBA", "BGR", "BGRA"
|
|
447
|
+
dtype: string // "uint8", "uint16", "float32"
|
|
448
|
+
}</pre>
|
|
449
|
+
<p>File buffers (JPEG, PNG, WebP, BMP) are automatically detected and decoded.</p>
|
|
450
|
+
|
|
451
|
+
<p>The polygon coordinates should be an array of [x, y] coordinate pairs:</p>
|
|
452
|
+
<pre>[
|
|
453
|
+
[0.30859375, 0.5797164440155029],
|
|
454
|
+
[0.314453125, 0.5797164440155029],
|
|
455
|
+
[0.31640625, 0.5818142294883728],
|
|
456
|
+
// ... more coordinate pairs
|
|
457
|
+
]</pre>
|
|
458
|
+
<p>All coordinates must be normalized to 0.0-1.0 range (percentage of image dimensions).</p>
|
|
459
|
+
|
|
460
|
+
<h3>Outputs</h3>
|
|
461
|
+
<p>Produces a single masked image in the specified format:</p>
|
|
462
|
+
<ul>
|
|
463
|
+
<li><b>Raw format:</b> Complete image object with pixel data and metadata</li>
|
|
464
|
+
<li><b>Encoded formats (JPG/PNG/WebP):</b> File buffer ready for storage or transmission</li>
|
|
465
|
+
</ul>
|
|
466
|
+
<p>Output dimensions match the input image dimensions. The generated mask is automatically sized to match the base image.</p>
|
|
467
|
+
|
|
468
|
+
<h3>Masking Behavior</h3>
|
|
469
|
+
<h4>Polygon-to-Mask Conversion Process</h4>
|
|
470
|
+
<ol>
|
|
471
|
+
<li><b>Coordinate Scaling:</b> Converts normalized coordinates (0-1) to pixel coordinates</li>
|
|
472
|
+
<li><b>Mask Generation:</b> Uses OpenCV fillPoly to create binary mask from polygon</li>
|
|
473
|
+
<li><b>Color Application:</b> Fills polygon area with the specified fill color</li>
|
|
474
|
+
<li><b>Blending:</b> Applies the mask as blending weights scaled by mask strength</li>
|
|
475
|
+
</ol>
|
|
476
|
+
|
|
477
|
+
<h4>Mathematical Formula</h4>
|
|
478
|
+
<p>The masking operation uses weighted blending:</p>
|
|
479
|
+
<pre>pixel_coords = polygon_coords × [image_width, image_height]
|
|
480
|
+
binary_mask = fillPoly(pixel_coords, fill_color)
|
|
481
|
+
blend_weights = mask_strength × normalized_mask
|
|
482
|
+
result = image × (1 - blend_weights) + mask_color × blend_weights</pre>
|
|
483
|
+
|
|
484
|
+
<h3>Automatic Image Processing</h3>
|
|
485
|
+
<h4>Dimension Handling</h4>
|
|
486
|
+
<ul>
|
|
487
|
+
<li><b>Same Size:</b> Direct processing with no resizing</li>
|
|
488
|
+
<li><b>Different Sizes:</b> Both images resized to max(width1, width2) × max(height1, height2)</li>
|
|
489
|
+
<li><b>Aspect Ratio:</b> Preserved during resize operations to prevent distortion</li>
|
|
490
|
+
</ul>
|
|
491
|
+
|
|
492
|
+
<h4>Color Space Conversion</h4>
|
|
493
|
+
<ul>
|
|
494
|
+
<li><b>Automatic Detection:</b> Color spaces detected from image metadata or inferred from channel count</li>
|
|
495
|
+
<li><b>Smart Conversion:</b> Images converted to compatible format for processing</li>
|
|
496
|
+
<li><b>Quality Preservation:</b> Lossless conversions maintain image quality throughout processing</li>
|
|
497
|
+
</ul>
|
|
498
|
+
|
|
499
|
+
<h3>Examples</h3>
|
|
500
|
+
<h4>Logo Watermarking</h4>
|
|
501
|
+
<p>Apply a logo with transparent background:</p>
|
|
502
|
+
<ul>
|
|
503
|
+
<li>Image: Main content</li>
|
|
504
|
+
<li>Mask: Logo with black background</li>
|
|
505
|
+
<li>Background Color: Black (#000000)</li>
|
|
506
|
+
<li>Mask Strength: 80-90% for strong branding</li>
|
|
507
|
+
<li>Tolerance: 5-15% for clean edges</li>
|
|
508
|
+
</ul>
|
|
509
|
+
|
|
510
|
+
<h4>Artistic Overlays</h4>
|
|
511
|
+
<p>Create artistic effects with texture masks:</p>
|
|
512
|
+
<ul>
|
|
513
|
+
<li>Image: Photo or artwork</li>
|
|
514
|
+
<li>Mask: Texture or pattern with background</li>
|
|
515
|
+
<li>Background Color: Dominant background color</li>
|
|
516
|
+
<li>Mask Strength: 30-60% for subtle effects</li>
|
|
517
|
+
<li>Tolerance: 20-40% for smooth blending</li>
|
|
518
|
+
</ul>
|
|
519
|
+
|
|
520
|
+
<h4>Selective Enhancement</h4>
|
|
521
|
+
<p>Apply effects to specific image regions:</p>
|
|
522
|
+
<ul>
|
|
523
|
+
<li>Image: Original photo</li>
|
|
524
|
+
<li>Mask: Region selector (white areas to enhance)</li>
|
|
525
|
+
<li>Background Color: Black (#000000)</li>
|
|
526
|
+
<li>Mask Strength: 70-100% for strong effects</li>
|
|
527
|
+
<li>Tolerance: 5-10% for precise control</li>
|
|
528
|
+
</ul>
|
|
529
|
+
|
|
530
|
+
<h3>Node Interactions</h3>
|
|
531
|
+
<ul>
|
|
532
|
+
<li><b>Upstream:</b> Works with <code>image-in</code>, <code>array-in</code>, or any nodes producing image/mask pairs</li>
|
|
533
|
+
<li><b>Downstream:</b> Connect to image writers, further processing nodes, or display components</li>
|
|
534
|
+
<li><b>Chaining:</b> Can be chained for complex multi-layer masking effects</li>
|
|
535
|
+
<li><b>Flow Integration:</b> Supports flow and global context for cross-node data sharing</li>
|
|
536
|
+
</ul>
|
|
537
|
+
|
|
538
|
+
<h3>Error Handling</h3>
|
|
539
|
+
<ul>
|
|
540
|
+
<li><b>Missing Images:</b> Clear warnings when either input image is missing or invalid</li>
|
|
541
|
+
<li><b>Dimension Mismatch:</b> Automatic resizing with performance-optimized interpolation</li>
|
|
542
|
+
<li><b>Color Space Issues:</b> Intelligent conversion with format preservation</li>
|
|
543
|
+
<li><b>Memory Management:</b> Efficient processing of large images with automatic cleanup</li>
|
|
544
|
+
<li><b>Parameter Validation:</b> Range checking for all numeric parameters</li>
|
|
545
|
+
</ul>
|
|
546
|
+
|
|
547
|
+
<h3>Performance</h3>
|
|
548
|
+
<ul>
|
|
549
|
+
<li><b>C++ Backend:</b> High-performance OpenCV implementation with SIMD optimizations</li>
|
|
550
|
+
<li><b>Memory Efficient:</b> Minimal memory allocation with intelligent buffer reuse</li>
|
|
551
|
+
<li><b>Parallel Processing:</b> Multi-threaded operations for large images</li>
|
|
552
|
+
<li><b>Status Timing:</b> Real-time metrics showing conversion, processing, and encoding times</li>
|
|
553
|
+
<li><b>Optimized Builds:</b> Compiled with <code>-O3</code>, <code>-march=native</code> for maximum performance</li>
|
|
554
|
+
</ul>
|
|
555
|
+
|
|
556
|
+
<h3>Advanced Features</h3>
|
|
557
|
+
<ul>
|
|
558
|
+
<li><b>Live Preview:</b> Debug mode shows masked result in real-time</li>
|
|
559
|
+
<li><b>Color Precision:</b> Advanced color matching with configurable tolerance</li>
|
|
560
|
+
<li><b>Batch Processing:</b> Efficient handling of multiple image/mask pairs</li>
|
|
561
|
+
<li><b>Context Integration:</b> Full support for flow and global context storage</li>
|
|
562
|
+
<li><b>Format Flexibility:</b> Seamless conversion between raw and encoded formats</li>
|
|
563
|
+
</ul>
|
|
564
|
+
</script>
|
|
565
|
+
|
|
288
566
|
<script type="text/x-red" data-help-name="add-mask">
|
|
289
567
|
<p><b>rosepetal-add-mask</b> applies a polygon-based mask to a base image using weighted blending with configurable mask strength and fill color. This node generates masks from polygon coordinates (from object detection results) and blends them with the original image.</p>
|
|
290
568
|
|
|
@@ -152,7 +152,9 @@ module.exports = function (RED) {
|
|
|
152
152
|
const outputFormat = config.outputFormat || 'raw';
|
|
153
153
|
const outputQuality = parseInt(config.outputQuality) || 90;
|
|
154
154
|
const pngOptimize = config.pngOptimize || false;
|
|
155
|
-
|
|
155
|
+
const useSharpWebp = outputFormat === 'webp' && NodeUtils.hasAdvancedWebpOptions(config);
|
|
156
|
+
const cppFormat = useSharpWebp ? 'raw' : outputFormat;
|
|
157
|
+
|
|
156
158
|
// Color processing
|
|
157
159
|
const fillColor = config.fillColor || '#ffffff';
|
|
158
160
|
|
|
@@ -165,17 +167,21 @@ module.exports = function (RED) {
|
|
|
165
167
|
}
|
|
166
168
|
|
|
167
169
|
/* ▸ Single call to the C++ addon --------------------------------- */
|
|
168
|
-
|
|
170
|
+
let { image: result, timing = {} } =
|
|
169
171
|
await Cpp.addMask(
|
|
170
|
-
baseImg,
|
|
171
|
-
polygon,
|
|
172
|
-
maskStrength,
|
|
172
|
+
baseImg,
|
|
173
|
+
polygon,
|
|
174
|
+
maskStrength,
|
|
173
175
|
fillR, fillG, fillB,
|
|
174
|
-
|
|
175
|
-
outputQuality,
|
|
176
|
+
cppFormat,
|
|
177
|
+
outputQuality,
|
|
176
178
|
pngOptimize
|
|
177
179
|
);
|
|
178
180
|
|
|
181
|
+
if (useSharpWebp) {
|
|
182
|
+
result = await NodeUtils.encodeWebpAdvanced(result, config);
|
|
183
|
+
}
|
|
184
|
+
|
|
179
185
|
/* ▸ Write the result back to msg ---------------------------------- */
|
|
180
186
|
RED.util.setMessageProperty(msg, config.outputPath || 'payload', result);
|
|
181
187
|
|
|
@@ -238,5 +244,6 @@ module.exports = function (RED) {
|
|
|
238
244
|
});
|
|
239
245
|
}
|
|
240
246
|
|
|
241
|
-
RED.nodes.registerType('add-mask', AddMaskNode);
|
|
247
|
+
RED.nodes.registerType('rp-add-mask', AddMaskNode);
|
|
248
|
+
RED.nodes.registerType('add-mask', AddMaskNode); // legacy compat
|
|
242
249
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!-- nodes/blend/add-masks.html -->
|
|
2
2
|
|
|
3
3
|
<script type="text/javascript">
|
|
4
|
-
|
|
4
|
+
var _rpNodeCfg = {
|
|
5
5
|
category:'RP Image',
|
|
6
6
|
color:'#DDA0DD',
|
|
7
7
|
icon:'font-awesome/fa-masks',
|
|
@@ -13,6 +13,9 @@
|
|
|
13
13
|
outputFormat:{value:"raw"},
|
|
14
14
|
outputQuality:{value:90},
|
|
15
15
|
pngOptimize:{value:false},
|
|
16
|
+
webpLossless:{value:false},
|
|
17
|
+
webpSmartSubsample:{value:false},
|
|
18
|
+
webpEffort:{value:""},
|
|
16
19
|
// Debug configuration
|
|
17
20
|
debugEnabled:{value:false},
|
|
18
21
|
debugWidth:{value:200},
|
|
@@ -21,7 +24,7 @@
|
|
|
21
24
|
classColorMappings:{value:[]} // Array of {className, color} objects
|
|
22
25
|
},
|
|
23
26
|
inputs:1,outputs:1,
|
|
24
|
-
label:function(){return this.name||"add-masks";},
|
|
27
|
+
label:function(){return this.name||"rp-add-masks";},
|
|
25
28
|
oneditprepare:function(){
|
|
26
29
|
const node = this;
|
|
27
30
|
let classMappingIndex = 0;
|
|
@@ -65,6 +68,11 @@
|
|
|
65
68
|
const format = $("#node-input-outputFormat").val();
|
|
66
69
|
$("#quality-row").toggle(format === "jpg" || format === "webp");
|
|
67
70
|
$("#png-optimize-row").toggle(format === "png");
|
|
71
|
+
// Show WebP advanced options only when WebP is selected
|
|
72
|
+
const isWebp = format === 'webp';
|
|
73
|
+
$("#webp-lossless-row").toggle(isWebp);
|
|
74
|
+
$("#webp-smartsubsample-row").toggle(isWebp);
|
|
75
|
+
$("#webp-effort-row").toggle(isWebp);
|
|
68
76
|
}
|
|
69
77
|
$("#node-input-outputFormat").on("change", updateQualityVisibility);
|
|
70
78
|
updateQualityVisibility(); // initial state
|
|
@@ -427,7 +435,9 @@
|
|
|
427
435
|
|
|
428
436
|
this.classColorMappings = mappings;
|
|
429
437
|
}
|
|
430
|
-
}
|
|
438
|
+
};
|
|
439
|
+
RED.nodes.registerType('rp-add-masks', _rpNodeCfg);
|
|
440
|
+
RED.nodes.registerType('add-masks', Object.assign({}, _rpNodeCfg, { category: 'deprecated' }));
|
|
431
441
|
|
|
432
442
|
// Debug image display renderer - shared across all image processing nodes
|
|
433
443
|
if (!window.debugImageRendererInitialized) {
|
|
@@ -539,6 +549,107 @@
|
|
|
539
549
|
}
|
|
540
550
|
</script>
|
|
541
551
|
|
|
552
|
+
<script type="text/x-red" data-template-name="rp-add-masks">
|
|
553
|
+
<div class="form-row">
|
|
554
|
+
<label><i class="fa fa-picture-o"></i> Image</label>
|
|
555
|
+
<input type="text" id="node-input-imagePath" style="width:70%;">
|
|
556
|
+
<input type="hidden" id="node-input-imagePathType">
|
|
557
|
+
</div>
|
|
558
|
+
|
|
559
|
+
<div class="form-row">
|
|
560
|
+
<label><i class="fa fa-list"></i> Masks Array</label>
|
|
561
|
+
<input type="text" id="node-input-masksPath" style="width:70%;">
|
|
562
|
+
<input type="hidden" id="node-input-masksPathType">
|
|
563
|
+
</div>
|
|
564
|
+
|
|
565
|
+
<div class="form-row">
|
|
566
|
+
<label><i class="fa fa-sign-out"></i> Output</label>
|
|
567
|
+
<input type="text" id="node-input-outputPath" style="width:70%;">
|
|
568
|
+
<input type="hidden" id="node-input-outputPathType">
|
|
569
|
+
</div>
|
|
570
|
+
|
|
571
|
+
<div class="form-row">
|
|
572
|
+
<label for="node-input-outputFormat"><i class="fa fa-file-image-o"></i> Output Format</label>
|
|
573
|
+
<select id="node-input-outputFormat" style="width: 200px;">
|
|
574
|
+
<option value="raw">Raw (fastest)</option>
|
|
575
|
+
<option value="jpg">JPEG</option>
|
|
576
|
+
<option value="png">PNG</option>
|
|
577
|
+
<option value="webp">WebP</option>
|
|
578
|
+
</select>
|
|
579
|
+
</div>
|
|
580
|
+
|
|
581
|
+
<div class="form-row" id="quality-row">
|
|
582
|
+
<label for="node-input-outputQuality"><i class="fa fa-sliders"></i> Quality</label>
|
|
583
|
+
<input type="number" id="node-input-outputQuality" min="1" max="100" value="90" style="width: 70px;">
|
|
584
|
+
<span style="margin-left: 10px; color: #666;">1-100 (JPG/WebP only)</span>
|
|
585
|
+
</div>
|
|
586
|
+
|
|
587
|
+
<div class="form-row" id="png-optimize-row" style="display: none;">
|
|
588
|
+
<label for="node-input-pngOptimize"><i class="fa fa-compress"></i> PNG Optimize</label>
|
|
589
|
+
<input type="checkbox" id="node-input-pngOptimize" style="display:inline-block; width:auto; vertical-align:baseline;">
|
|
590
|
+
<label for="node-input-pngOptimize" style="width:auto; margin-left:5px;">Compress PNG (slower, smaller file)</label>
|
|
591
|
+
</div>
|
|
592
|
+
<div class="form-row" id="webp-lossless-row" style="display: none;">
|
|
593
|
+
<label for="node-input-webpLossless"><i class="fa fa-lock"></i> Lossless</label>
|
|
594
|
+
<input type="checkbox" id="node-input-webpLossless" style="display:inline-block; width:auto; vertical-align:baseline;">
|
|
595
|
+
<label for="node-input-webpLossless" style="width:auto; margin-left:5px;">Encode WebP without loss</label>
|
|
596
|
+
</div>
|
|
597
|
+
<div class="form-row" id="webp-smartsubsample-row" style="display: none;">
|
|
598
|
+
<label for="node-input-webpSmartSubsample"><i class="fa fa-magic"></i> Smart Subsample</label>
|
|
599
|
+
<input type="checkbox" id="node-input-webpSmartSubsample" style="display:inline-block; width:auto; vertical-align:baseline;">
|
|
600
|
+
<label for="node-input-webpSmartSubsample" style="width:auto; margin-left:5px;">Better chroma downsampling (lossy only)</label>
|
|
601
|
+
</div>
|
|
602
|
+
<div class="form-row" id="webp-effort-row" style="display: none;">
|
|
603
|
+
<label for="node-input-webpEffort"><i class="fa fa-tachometer"></i> Effort</label>
|
|
604
|
+
<input type="number" id="node-input-webpEffort" min="0" max="6" placeholder="4" style="width: 70px;">
|
|
605
|
+
<span style="margin-left: 10px; color: #666;">0-6 (higher = smaller file, slower)</span>
|
|
606
|
+
</div>
|
|
607
|
+
|
|
608
|
+
<!-- Debug Configuration -->
|
|
609
|
+
<div class="form-row">
|
|
610
|
+
<label for="node-input-debugEnabled"><i class="fa fa-bug"></i> Debug</label>
|
|
611
|
+
<input type="checkbox" id="node-input-debugEnabled" style="display:inline-block; width:auto; vertical-align:baseline;">
|
|
612
|
+
<label for="node-input-debugEnabled" style="width:auto; margin-left:5px;">Show processed image</label>
|
|
613
|
+
</div>
|
|
614
|
+
<div class="form-row" id="debug-width-row" style="display: none;">
|
|
615
|
+
<label for="node-input-debugWidth"><i class="fa fa-arrows-h"></i> Debug Width</label>
|
|
616
|
+
<input type="text" id="node-input-debugWidth" style="width: 120px;">
|
|
617
|
+
<input type="hidden" id="node-input-debugWidthType">
|
|
618
|
+
<span style="margin-left: 10px; color: #666;">pixels</span>
|
|
619
|
+
</div>
|
|
620
|
+
|
|
621
|
+
<hr/>
|
|
622
|
+
|
|
623
|
+
<div class="form-row">
|
|
624
|
+
<label for="node-input-globalMaskStrength"><i class="fa fa-adjust"></i> Global Mask Strength</label>
|
|
625
|
+
<input type="range" id="node-input-globalMaskStrength" min="0" max="100" value="50" style="width: 200px;">
|
|
626
|
+
<span id="strength-value" style="margin-left: 10px; font-weight: bold;">50%</span>
|
|
627
|
+
<div style="margin-top: 5px; font-size: 11px; color: #666;" id="strength-label">
|
|
628
|
+
Balanced mask application
|
|
629
|
+
</div>
|
|
630
|
+
<div style="margin-top: 5px; font-size: 10px; color: #999;">
|
|
631
|
+
0% = No mask effect | 50% = Balanced | 100% = Full mask effect
|
|
632
|
+
</div>
|
|
633
|
+
</div>
|
|
634
|
+
|
|
635
|
+
<div class="form-row">
|
|
636
|
+
<label><i class="fa fa-palette"></i> Class Color Mappings</label>
|
|
637
|
+
<div id="class-mappings-container" style="margin-top: 10px;">
|
|
638
|
+
<!-- Dynamic class mapping rows will be inserted here -->
|
|
639
|
+
</div>
|
|
640
|
+
<div style="margin-top: 10px;">
|
|
641
|
+
<button type="button" id="add-class-mapping" class="editor-button">
|
|
642
|
+
<i class="fa fa-plus"></i> Add Class Mapping
|
|
643
|
+
</button>
|
|
644
|
+
</div>
|
|
645
|
+
<div style="margin-top: 5px; font-size: 11px; color: #666;">
|
|
646
|
+
<i class="fa fa-arrows-v"></i> Drag to reorder priority.
|
|
647
|
+
<strong>First = highest priority</strong> when masks overlap.
|
|
648
|
+
Undefined classes use auto-generated colors.
|
|
649
|
+
</div>
|
|
650
|
+
</div>
|
|
651
|
+
</script>
|
|
652
|
+
|
|
542
653
|
<script type="text/x-red" data-template-name="add-masks">
|
|
543
654
|
<div class="form-row">
|
|
544
655
|
<label><i class="fa fa-picture-o"></i> Image</label>
|
|
@@ -579,6 +690,21 @@
|
|
|
579
690
|
<input type="checkbox" id="node-input-pngOptimize" style="display:inline-block; width:auto; vertical-align:baseline;">
|
|
580
691
|
<label for="node-input-pngOptimize" style="width:auto; margin-left:5px;">Compress PNG (slower, smaller file)</label>
|
|
581
692
|
</div>
|
|
693
|
+
<div class="form-row" id="webp-lossless-row" style="display: none;">
|
|
694
|
+
<label for="node-input-webpLossless"><i class="fa fa-lock"></i> Lossless</label>
|
|
695
|
+
<input type="checkbox" id="node-input-webpLossless" style="display:inline-block; width:auto; vertical-align:baseline;">
|
|
696
|
+
<label for="node-input-webpLossless" style="width:auto; margin-left:5px;">Encode WebP without loss</label>
|
|
697
|
+
</div>
|
|
698
|
+
<div class="form-row" id="webp-smartsubsample-row" style="display: none;">
|
|
699
|
+
<label for="node-input-webpSmartSubsample"><i class="fa fa-magic"></i> Smart Subsample</label>
|
|
700
|
+
<input type="checkbox" id="node-input-webpSmartSubsample" style="display:inline-block; width:auto; vertical-align:baseline;">
|
|
701
|
+
<label for="node-input-webpSmartSubsample" style="width:auto; margin-left:5px;">Better chroma downsampling (lossy only)</label>
|
|
702
|
+
</div>
|
|
703
|
+
<div class="form-row" id="webp-effort-row" style="display: none;">
|
|
704
|
+
<label for="node-input-webpEffort"><i class="fa fa-tachometer"></i> Effort</label>
|
|
705
|
+
<input type="number" id="node-input-webpEffort" min="0" max="6" placeholder="4" style="width: 70px;">
|
|
706
|
+
<span style="margin-left: 10px; color: #666;">0-6 (higher = smaller file, slower)</span>
|
|
707
|
+
</div>
|
|
582
708
|
|
|
583
709
|
<!-- Debug Configuration -->
|
|
584
710
|
<div class="form-row">
|
|
@@ -625,6 +751,83 @@
|
|
|
625
751
|
</div>
|
|
626
752
|
</script>
|
|
627
753
|
|
|
754
|
+
<script type="text/x-red" data-help-name="rp-add-masks">
|
|
755
|
+
<p><b>rosepetal-add-masks</b> applies multiple polygon-based masks to a base image using weighted blending with configurable mask strength and class-based color mapping. This node processes arrays of mask objects with automatic color assignment for different classes.</p>
|
|
756
|
+
|
|
757
|
+
<h3>Details</h3>
|
|
758
|
+
<p>This node performs high-performance multi-polygon-based blending using OpenCV. Binary masks are generated from polygon coordinates using OpenCV's fillPoly function, then applied to the base image as blending weights. Each mask can have a different color based on its class name. The polygon coordinates are expected to be normalized (0-1 range) and are automatically scaled to match the image dimensions.</p>
|
|
759
|
+
|
|
760
|
+
<h3>Properties</h3>
|
|
761
|
+
<dl class="message-properties">
|
|
762
|
+
<dt>Image <span class="property-type">string</span></dt>
|
|
763
|
+
<dd>Message property path containing the base image to which the masks will be applied (default: <code>msg.image</code>). Supports <code>msg</code>, <code>flow</code>, or <code>global</code> context via TypedInput.</dd>
|
|
764
|
+
|
|
765
|
+
<dt>Masks Array <span class="property-type">string</span></dt>
|
|
766
|
+
<dd>Message property path containing the masks array (default: <code>msg.array</code>). Expected structure: direct array of mask objects with <code>polygons</code> coordinates and <code>tag</code> property. Supports <code>msg</code>, <code>flow</code>, or <code>global</code> context via TypedInput.</dd>
|
|
767
|
+
|
|
768
|
+
<dt>Output to <span class="property-type">string</span></dt>
|
|
769
|
+
<dd>Message property path where the masked image will be stored (default: <code>msg.payload</code>). Supports <code>msg</code>, <code>flow</code>, or <code>global</code> context via TypedInput.</dd>
|
|
770
|
+
|
|
771
|
+
<dt>Output Format <span class="property-type">string</span></dt>
|
|
772
|
+
<dd>Format for the output image: <code>raw</code> (fastest), <code>jpg</code>, <code>png</code>, or <code>webp</code>.</dd>
|
|
773
|
+
|
|
774
|
+
<dt>Quality <span class="property-type">number</span></dt>
|
|
775
|
+
<dd>Compression quality (1-100) for JPEG and WebP formats. Only visible when JPG or WebP is selected.</dd>
|
|
776
|
+
|
|
777
|
+
<dt>Global Mask Strength <span class="property-type">number</span></dt>
|
|
778
|
+
<dd>Intensity of mask application from 0% to 100%. Controls how strongly all masks affect the final result.</dd>
|
|
779
|
+
|
|
780
|
+
|
|
781
|
+
<dt>Class Color Mappings <span class="property-type">array</span></dt>
|
|
782
|
+
<dd>Dynamic list of tag name to color mappings. Each mapping defines a specific color for masks with that tag. Supports adding and removing mappings.</dd>
|
|
783
|
+
</dl>
|
|
784
|
+
|
|
785
|
+
<h3>Input Structure</h3>
|
|
786
|
+
<p>The masks array should follow this exact structure (direct array of mask objects):</p>
|
|
787
|
+
<pre>[
|
|
788
|
+
{
|
|
789
|
+
"tag": "bottle",
|
|
790
|
+
"polygons": [[[0.107, 0.141], [0.211, 0.141], [0.211, 0.930], [0.107, 0.930]]],
|
|
791
|
+
"confidence": 0.9697,
|
|
792
|
+
"color": "rgb(144,133,227)", // Ignored - use class color mappings instead
|
|
793
|
+
"classId": 0, // Ignored
|
|
794
|
+
"raw_boxes": [...], // Ignored
|
|
795
|
+
"area": 0.072 // Ignored
|
|
796
|
+
},
|
|
797
|
+
{
|
|
798
|
+
"tag": "mountain",
|
|
799
|
+
"polygons": [[[0.283, 0.158], [0.391, 0.158], [0.391, 0.963], [0.283, 0.963]]],
|
|
800
|
+
"confidence": 0.9648
|
|
801
|
+
}
|
|
802
|
+
]</pre>
|
|
803
|
+
<p><b>Note:</b> Only <code>tag</code> and <code>polygons</code> fields are used. Other fields (color, classId, raw_boxes, area, confidence) are ignored.</p>
|
|
804
|
+
|
|
805
|
+
<h3>Key Features</h3>
|
|
806
|
+
<ul>
|
|
807
|
+
<li><b>Dynamic Color Management:</b> Add/remove tag color mappings with real-time validation</li>
|
|
808
|
+
<li><b>Auto-Color Generation:</b> Consistent random colors for undefined tags using maximally different color algorithm</li>
|
|
809
|
+
<li><b>Duplicate Detection:</b> Visual warnings for duplicate tags and similar colors</li>
|
|
810
|
+
<li><b>Multi-Layer Blending:</b> Proper compositing of multiple masks with weight normalization</li>
|
|
811
|
+
<li><b>Structure Validation:</b> Comprehensive validation of direct array structure</li>
|
|
812
|
+
</ul>
|
|
813
|
+
|
|
814
|
+
<h3>Color Management</h3>
|
|
815
|
+
<p>Colors are assigned using this priority order:</p>
|
|
816
|
+
<ol>
|
|
817
|
+
<li><b>User-defined mapping:</b> Colors explicitly set in the tag color mappings</li>
|
|
818
|
+
<li><b>Auto-generated:</b> Maximally different colors for undefined tags</li>
|
|
819
|
+
<li><b>Default fallback:</b> White color (#ffffff)</li>
|
|
820
|
+
</ol>
|
|
821
|
+
|
|
822
|
+
<h3>Performance</h3>
|
|
823
|
+
<ul>
|
|
824
|
+
<li><b>C++ Backend:</b> High-performance OpenCV implementation with SIMD optimizations</li>
|
|
825
|
+
<li><b>Batch Processing:</b> Efficient handling of multiple masks in single operation</li>
|
|
826
|
+
<li><b>Memory Efficient:</b> Optimized buffer handling and intermediate result reuse</li>
|
|
827
|
+
<li><b>Weight Normalization:</b> Prevents over-saturation when masks overlap</li>
|
|
828
|
+
</ul>
|
|
829
|
+
</script>
|
|
830
|
+
|
|
628
831
|
<script type="text/x-red" data-help-name="add-masks">
|
|
629
832
|
<p><b>rosepetal-add-masks</b> applies multiple polygon-based masks to a base image using weighted blending with configurable mask strength and class-based color mapping. This node processes arrays of mask objects with automatic color assignment for different classes.</p>
|
|
630
833
|
|