Closed RotemDoar closed 5 months ago
@agsh
I have added an optional parameter - 'colorspace', allowing support for both YCbCr and RGB. The default setting is RGB. (see line 1259 in createOSD and line 1334 in setOSD).
* @param {string} [options.colorspace] Colorspace - RGB or YCbCr. Default RGB.
and fix the request for the support (with extra validation to the parameters X,Y,Z) - (line 1304 and 1369)
${ options.fontColor && options.fontColor.X && options.fontColor.Y && options.fontColor.Z ?
`
<sch:FontColor>
${ '<sch:Color Z="' + options.fontColor.Z + '" Y="' + options.fontColor.Y + '" X="' + options.fontColor.X + '" Colorspace="' + `${ options.colorspace === "YCbCr" ? "http://www.onvif.org/ver10/colorspace/YCbCr" : "http://www.onvif.org/ver10/colorspace/RGB" }` + '"/>' }
</sch:FontColor>` : "" }
I added extra documentation to the font color parameter.
* @param {object} [options.fontColor] The color of the text font (OSDColor), should be object with properties - X, Y, Z.
* @param {float} [options.fontColor.X] For RGB means R value, For YCbCr means Y value.
* @param {float} [options.fontColor.Y] For RGB means G value, For YCbCr means Cb value.
* @param {float} [options.fontColor.Z] For RGB means B value, For YCbCr means Cr value.
I added example to the parameters for createOSD method.
* await cam.createOSD({
* position: "LowerLeft",
* timeFormat: "HH:mm:ss",
* dateFormat: "YYYY-MM-DD",
* fontSize: 1,
* colorspace: "RGB",
* fontColor: {
* X: 1,
* Y: 0.7,
* Z: 0.9,
* }
* });
I added the link to create osd method in the setOSD method.
* @see {Cam~createOSD}
@RotemDoar Great, thanks! Nice and detailed comments :smile_cat:
I implemented the capability to adjust font size and color within both the 'setOSD' and 'createOSD' methods.
While working, I recognized the necessity to customize font attributes like size and color in the screen display.
Upon reviewing the Onvif MediaBinding spec (both media and media2 versions) - https://www.onvif.org/ver10/media/wsdl/media.wsdl https://www.onvif.org/ver20/media/wsdl/media.wsdl I found that in the setOSD and createOSD function it is possible to set the font color and size.
To adding the ability, I introduced new parameters to the method options for setting font size and color in the 'setOSD' and 'createOSD' functions defined in media.js file:
And in the request body as part of the TextString I added :
Example of request options while I run the changes for one of my cameras -
As a result the font color configuration (X,Y,Z) changed the OSD color to red with minimum size of the font .
Moreover, I enhanced the 'create OSD' method to include the functionality of setting custom position, date, and time, aligning with the capabilities offered in the 'set OSD' method.