MATLAB vision.ShapeInserter() 函数给出有关 CustomBorderColor 属性的警告

MATLAB vision.ShapeInserter() function gives warning about CustomBorderColor attribute

我正在尝试创建两个形状以插入到视频帧中。每当

blueBox = vision.ShapeInserter('Shape','Rectangles',...
                          'BorderColor','Custom',...
                          'CustomBorderColor',uint8([0 0 255]));

greenCircle = vision.ShapeInserter('Shape','Circles',...
                          'BorderColor','Custom',...
                          'Fill', true,...
                          'CustomBorderColor',uint8([200 255 50]));

每当我 运行 脚本 MATLAB 都会警告我 CustomBorderColor 属性。奇怪的是它给出了 greenCircle 的警告消息而不是 blueBox.

Warning: The CustomBorderColor property is not relevant in this configuration of the System object.

In C:\Program Files\MATLAB\R2012a\toolbox\matlab\system+matlab+system\pvParse.p>pvParse at 25 In C:\Program Files\MATLAB\R2012a\toolbox\matlab\system+matlab+system\SystemProp.p>SystemProp.parseInputs at 639 In C:\Program Files\MATLAB\R2012a\toolbox\matlab\system+matlab+system\SystemProp.p>SystemProp.setProperties at 138 In C:\Program Files\MATLAB\R2012a\toolbox\vision\vision+vision\ShapeInserter.p>ShapeInserter.ShapeInserter at 254

然后我尝试修改代码如下:

greenCircle =vision.ShapeInserter('Shape','Circles', ...
                                  'Fill', true, ...
                                  'FillColor', 'Custom', ...
                                  'CustomFillColor', uint8([0 1 3]), ...
                                  'BorderColor','Custom', ...
                                  'CustomBorderColor',uint8([200 255 50])); 

但仍然收到警告消息:

Warning: The CustomBorderColor property is not relevant in this configuration of the System object.

In C:\Program Files\MATLAB\R2012a\toolbox\matlab\system+matlab+system\pvParse.p>pvParse at 25 In C:\Program Files\MATLAB\R2012a\toolbox\matlab\system+matlab+system\SystemProp.p>SystemProp.parseInputs at 639 In C:\Program Files\MATLAB\R2012a\toolbox\matlab\system+matlab+system\SystemProp.p>SystemProp.setProperties at 138 In C:\Program Files\MATLAB\R2012a\toolbox\vision\vision+vision\ShapeInserter.p>ShapeInserter.ShapeInserter at 254

这是什么原因?

您收到此警告是因为您针对 greenCircle'Fill' 设置为 true。您可以使用 'FillColor''CustomFillColor' 来设置实心圆的颜色。

此外,如果您的 MATLAB 版本为 R2014a 或更高版本,您可以使用 insertShape 函数代替 vision.ShapeInserter。功能更易用