Ability to set font size and color in setOSD and createOSD methods.#326
Conversation
| ${options.fontSize ? `<sch:FontSize>${options.fontSize}</sch:FontSize>` : ""} | ||
| ${options.fontColor ? ` | ||
| <sch:FontColor> | ||
| ${'<sch:Color Z="' + options.fontColor.Z + '" Y="' + options.fontColor.Y + '" X="' + options.fontColor.X + '"/>'} |
There was a problem hiding this comment.
Maybe add Colorspace="http://www.onvif.org/ver10/colorspace/RGB" here? Or add optional param to choose between YCbCr and RGB?
There was a problem hiding this comment.
Added new options parameter - colorspace.
Supporting YCbCr and RGB.
| * @param {string} [options.timeFormat] Time to overlay. Must be used with dateFormat, otherwise plaintext will be used. | ||
| * @param {number} [options.fontSize] The text font size. | ||
| * @param {object} [options.fontColor] The color of the text font (OSDColor), should be object with properties - X, Y, Z. | ||
| * @param {Cam~GetOSDOptionsCallback} callback |
There was a problem hiding this comment.
You can add your example here:
* @example
* await cam.createOSD({
* videoSourceConfigurationToken: "VideoSourceConfigToken-01-0",
* OSDToken: "OSDDateTimeToken-0",
* position: "LowerLeft",
* timeFormat: "HH:mm:ss",
* dateFormat: "YYYY-MM-DD",
* fontSize: 1,
* fontColor: {
* X: 82,
* Y: 90,
* Z: 240,
* }
* });
There was a problem hiding this comment.
Added example to create osd.
| * @param {string} [options.timeFormat] Time to overlay. Must be used with dateFormat, otherwise plaintext will be used. | ||
| * @param {number} [options.fontSize] The text font size. | ||
| * @param {object} [options.fontColor] The color of the text font (OSDColor), should be object with properties - X, Y, Z. | ||
| * @param {Cam~GetOSDOptionsCallback} callback |
There was a problem hiding this comment.
And here link to createOSD method:
* @see {Cam~createOSD}
There was a problem hiding this comment.
Added the link to create osd method.
adding extra validation to the font color parameters. adding documentation and example to the function parameters.
|
I have added an optional parameter - 'colorspace', allowing support for both YCbCr and RGB. The default setting is RGB.
and fix the request for the support (with extra validation to the parameters X,Y,Z) - I added extra documentation to the font color parameter. I added example to the parameters for createOSD method. I added the link to create osd method in the setOSD method.
|
|
@RotemDoar Great, thanks! Nice and detailed comments 😸 |
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.