CN117812193A - Watermark superposition method and electronic equipment - Google Patents

Watermark superposition method and electronic equipment Download PDF

Info

Publication number
CN117812193A
CN117812193A CN202311793977.9A CN202311793977A CN117812193A CN 117812193 A CN117812193 A CN 117812193A CN 202311793977 A CN202311793977 A CN 202311793977A CN 117812193 A CN117812193 A CN 117812193A
Authority
CN
China
Prior art keywords
image
target
watermark
information
preset
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311793977.9A
Other languages
Chinese (zh)
Inventor
余永顺
赵杰磊
张腾飞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Hikvision Digital Technology Co Ltd
Original Assignee
Hangzhou Hikvision Digital Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Hikvision Digital Technology Co Ltd filed Critical Hangzhou Hikvision Digital Technology Co Ltd
Priority to CN202311793977.9A priority Critical patent/CN117812193A/en
Publication of CN117812193A publication Critical patent/CN117812193A/en
Pending legal-status Critical Current

Links

Landscapes

  • Image Processing (AREA)
  • Editing Of Facsimile Originals (AREA)

Abstract

The embodiment of the application provides a watermark superposition method and electronic equipment, and relates to the technical field of video recording. Acquiring watermark superposition information appointed by a user; wherein the watermark superimposition information includes: a target watermark image; acquiring a picture or a video frame derived from preset storage equipment as an initial image to be subjected to watermark superposition; decoding the initial image to obtain decoded initial image data, and obtaining canvas information in the initial image data; replacing the image information of the area for overlapping the target watermark image in the canvas information with the image information of the target watermark image to obtain target image data overlapped with the target watermark image; performing specified processing matched with preset processing requirements on the target image data to obtain a target image; wherein, the preset processing requirements include: and (3) displaying and/or exporting. By applying the method provided by the embodiment of the application, the watermark can be obtained in the image exported by the preset storage device.

Description

Watermark superposition method and electronic equipment
Technical Field
The present disclosure relates to the field of video recording technologies, and in particular, to a watermark superposition method and an electronic device.
Background
The image acquisition device may perform image acquisition on the designated area and store the acquired image. The image acquisition device may be instructed to output the image in order to facilitate subsequent processing of the image stored by the image acquisition device. For example, the NVR (Network Video Recorder ) is instructed to transfer the collected video data to a preset hard disk for permanent storage, or to display on a preset display window, or the like. In general, images or videos stored by an image acquisition device may be referred to as video recordings.
Because of the display requirement, when the video is led out from the image acquisition equipment, the watermark can be superimposed in the video, so that each frame of video picture displayed is a video picture comprising the watermark when the video is displayed every time later; for example, when a video is derived from the NVR, the acquisition time and the acquisition location of the video may be superimposed as watermarks in the video, so that each frame of picture played during each subsequent play of the video displays the acquisition time and the acquisition location of the video.
Based on this, how to superimpose watermarks in video is a technical problem to be solved currently.
Disclosure of Invention
An embodiment of the application aims to provide a watermark superposition method and electronic equipment, so as to superimpose a watermark on a video exported by a preset storage device. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present application provides a watermark superimposing method, where the method includes:
acquiring watermark superposition information appointed by a user; wherein the watermark superimposition information includes: a target watermark image;
acquiring a picture or a video frame derived from preset storage equipment as an initial image to be subjected to watermark superposition;
decoding the initial image to obtain decoded initial image data, and obtaining canvas information in the initial image data;
replacing the image information of the area for overlapping the target watermark image in the canvas information with the image information of the target watermark image to obtain target image data overlapped with the target watermark image;
performing specified processing matched with preset processing requirements on the target image data to obtain a target image; wherein, the preset processing requirements include: and (3) displaying and/or exporting.
Optionally, in a specific implementation manner, the watermark superimposing information further includes: the arrangement mode, the image interval and the first size of the target watermark images;
The replacing the image information of the area for overlapping the target watermark image in the canvas information with the image information of the target watermark image to obtain the target image data overlapped with the target watermark image includes:
determining a superposition area of the target watermark image in the canvas information according to the arrangement mode, the image interval and the first size;
and replacing the image information of the overlapping area in the canvas information with the image information of the target watermark image to obtain target image data overlapped with the target watermark image.
Optionally, in a specific implementation manner, the preset processing requirement includes: exporting;
the step of performing the specified processing on the target image data, which is matched with the preset processing requirement, includes:
if the initial image is a picture, performing coding processing under a first format on the target image data to obtain a target image; wherein the first format includes: mJPEG encoding format;
and/or the number of the groups of groups,
if the initial image is a video frame, performing coding processing on the target image data in a first format to obtain a target image; wherein the second format includes: h.264 coding format.
Optionally, in a specific implementation manner, the method further includes:
detecting whether the first quantity of the initial image data in a preset first queue reaches a first preset quantity or not in the decoding process; wherein, each initial image data in the preset first queue is arranged according to the order from the early to the late of the export time;
if yes, stopping the decoding process, and recovering the decoding process when the stopping time length reaches a first preset time length.
Optionally, in a specific implementation manner, the method further includes:
uploading the target image to a preset buffer area for storage.
Optionally, in a specific implementation manner, the method further includes:
detecting whether a second number of target images to be uploaded to the preset buffer area in a preset second queue reaches a second preset number or not; wherein, each target image in the preset second queue is arranged according to the sequence from the early to the late of the image generation time;
if yes, stopping the appointed processing, and recovering the appointed processing when the stopping time length reaches a second preset time length.
Optionally, in a specific implementation manner, the preset processing requirement includes: displaying;
The step of performing the specified processing on the target image data, which is matched with the preset processing requirement, includes:
if the initial image is a picture, converting the target image data into a target image in a third format, and displaying the target image; wherein the third format comprises: RGB format;
and/or the number of the groups of groups,
if the initial image is a video frame, displaying a target video frame represented by the target image data according to a specified video output mode; the specified video output mode comprises the following steps: full screen presentation in a display device for presenting the target image.
Optionally, in a specific implementation manner, the acquiring canvas information in the initial image data includes:
and acquiring the canvas information determined according to the size difference between the preset image size of the target image to be generated and the initial image size of the initial image in the image data.
Optionally, in a specific implementation manner, the target watermark image includes a plurality of watermark characters; the watermark superimposition information further includes: a second size of the watermark image to be superimposed;
the replacing the image information of the area for overlapping the target watermark image in the canvas information with the image information of the target watermark image to obtain the target image data overlapped with the target watermark image includes:
Intercepting an image area with the second size from the target watermark image to serve as the watermark image to be superimposed;
and replacing the image information of the region for overlapping the watermark image to be overlapped with the image information of the watermark image to be overlapped in the canvas information.
Optionally, in a specific implementation manner, the method is applied to an electronic device, and the electronic device includes a region management component and a drawing component;
the obtaining canvas information in the initial image data comprises the following steps:
the region management component creates a region management handle and acquires canvas information in the initial image data by utilizing the region management handle;
the replacing the image information of the area for overlapping the target watermark image in the canvas information with the image information of the target watermark image to obtain the target image data overlapped with the target watermark image includes:
and the drawing component replaces the image information of the area for overlapping the target watermark image in the canvas information with the image information of the target watermark image to obtain target image data overlapped with the target watermark image.
Optionally, in a specific implementation manner, the method is applied to an electronic device, where the electronic device includes a region management component and a scaling module, and the scaling component is bound with the region management component;
in the obtaining the initial image data, according to a preset image size of a target image to be generated and a size difference of an initial image size of the initial image, the determined canvas information includes:
the region management component creates a region management handle and acquires canvas information in the image data by utilizing the region management handle; wherein the canvas information is determined by the scaling component according to a size difference between a preset image size of the target image to be generated and an initial image size of the initial image.
In a second aspect, an embodiment of the present application provides a watermark superimposing apparatus, including:
the information acquisition module is used for acquiring watermark superposition information appointed by a user; wherein the watermark superimposition information includes: a target watermark image;
the initial image acquisition module is used for acquiring a picture or a video frame derived from preset storage equipment and taking the picture or the video frame as an initial image to be subjected to watermark superposition;
The canvas information acquisition module is used for decoding the initial image to obtain decoded initial image data and acquiring canvas information in the initial image data;
the superposition module is used for superposing the image information of the area of the target watermark image in the canvas information and replacing the image information of the target watermark image to obtain target image data superposed with the target watermark image;
the processing module is used for carrying out specified processing matched with preset processing requirements on the target image data to obtain a target image; wherein, the preset processing requirements include: and (3) displaying and/or exporting.
Optionally, in a specific implementation manner, the watermark superimposing information further includes: the arrangement mode, the image interval and the first size of the target watermark images;
the superposition module is specifically configured to:
determining a superposition area of the target watermark image in the canvas information according to the arrangement mode, the image interval and the first size;
and replacing the image information of the overlapping area in the canvas information with the image information of the target watermark image to obtain target image data overlapped with the target watermark image.
Optionally, in a specific implementation manner, the preset processing requirement includes: exporting;
the processing module is specifically configured to:
if the initial image is a picture, performing encoding processing on the target image data in a first format to obtain a target image; wherein the first format includes: mJPEG encoding format; and/or if the initial image is a video frame, performing encoding processing under a second format on the target image data to obtain a target image; wherein the second format includes: h.264 coding format.
Optionally, in a specific implementation manner, the apparatus further includes:
the first detection module is used for detecting whether the first quantity of the initial image data in a preset first queue reaches a first preset quantity or not in the decoding process; if yes, triggering a first stopping module; wherein, each initial image data in the preset first queue is arranged according to the order from the early to the late of the export time;
the first stopping module is configured to stop the decoding process, and resume the decoding process when the stopping time length reaches a first preset time length.
Optionally, in a specific implementation manner, the apparatus further includes:
And the storage module is used for uploading the target image to a preset buffer area for storage.
Optionally, in a specific implementation manner, the apparatus further includes:
the second detection module is used for detecting whether the second number of the target images to be uploaded to the preset buffer area in a preset second queue reaches a second preset number or not; if yes, triggering a second stopping module; wherein, each target image in the preset second queue is arranged according to the sequence from the early to the late of the image generation time;
the second stopping module is configured to stop the specified process, and resume the specified process when the stopping time length reaches a second preset time length.
Optionally, in a specific implementation manner, the preset processing requirement includes: displaying;
the processing module is specifically configured to:
if the initial image is a picture, converting the target image data into a target image in a third format, and displaying the target image; wherein the third format comprises: RGB format; and/or if the initial image is a video frame, displaying a target video frame represented by the target image data according to a specified video output mode; the specified video output mode comprises the following steps: full screen presentation in a display device for presenting the target image.
Optionally, in a specific implementation manner, the canvas information obtaining module is specifically configured to:
and acquiring the canvas information determined according to the size difference between the preset image size of the target image to be generated and the initial image size of the initial image in the image data.
Optionally, in a specific implementation manner, the target watermark image includes a plurality of watermark characters; the watermark superimposition information further includes: a second size of the watermark image to be superimposed;
the superposition module is specifically configured to:
intercepting an image area with the second size from the target watermark image to serve as the watermark image to be superimposed;
and replacing the image information of the region for overlapping the watermark image to be overlapped with the image information of the watermark image to be overlapped in the canvas information.
In a third aspect, an embodiment of the present application provides an electronic device, including:
a memory for storing a computer program;
and the processor is used for realizing the steps of any method embodiment when executing the program stored in the memory.
In a fourth aspect, embodiments of the present application provide a computer-readable storage medium having a computer program stored therein, which when executed by a processor, implements the steps of any of the method embodiments described above.
In a fifth aspect, the present application embodiment also provides a computer program product comprising instructions which, when run on a computer, cause the computer to perform the steps of any of the method embodiments described above.
The beneficial effects of the embodiment of the application are that:
in the above, by applying the scheme provided by the embodiment of the present application, watermark superposition information specified by a user may be first obtained, where the watermark superposition information includes a target watermark image. Then, obtaining a picture or a video frame derived from preset storage equipment as an initial image to be subjected to watermark superposition; then, decoding the initial image to obtain decoded initial image data, and obtaining canvas information in the initial image data; in this way, the image information of the area for overlapping the target watermark image in the canvas information can be replaced by the image information of the target watermark image to obtain the target image data overlapped with the target watermark image, and further, the target image data can be subjected to the appointed processing matched with the preset processing requirement to obtain the target image; wherein, the preset processing requirements include: and (3) displaying and/or exporting.
Based on the above, the scheme provided by the embodiment of the application is applied, the image superposition watermark derived from the preset storage device is realized by replacing the image information of the region to be superposed in the canvas information with the image information of the target watermark image, so that the target watermark image can be superposed in the canvas of the image, the image information of the target watermark image is always included in the target image data obtained by watermark superposition, and the target watermark image is superposed in the target image derived or displayed subsequently. And by carrying out watermark superposition on the image derived from the preset storage device, the image can be traced and traced, and the possibility of piracy of the image is reduced.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following description will briefly introduce the drawings that are required to be used in the embodiments or the description of the prior art, and it is obvious that the drawings in the following description are only some embodiments of the present application, and other embodiments may also be obtained according to these drawings to those skilled in the art.
Fig. 1 is a schematic flow chart of a watermark superimposing method according to an embodiment of the present application;
fig. 2 (a) -fig. 2 (e) are schematic diagrams of watermark images provided in embodiments of the present application, respectively;
fig. 3 is a schematic flow chart of a watermark superimposing example provided in an embodiment of the present application;
fig. 4 is a schematic diagram of an interaction process between units in a watermark superimposing example provided in an embodiment of the present application;
fig. 5 is a schematic diagram of a watermark stacking example provided in an embodiment of the present application;
fig. 6 is a schematic flow chart of another watermark superimposing example provided in an embodiment of the present application;
fig. 7 is a schematic diagram of another watermark superimposing example provided in an embodiment of the present application;
fig. 8 is a schematic diagram of another watermark superimposing example provided in an embodiment of the present application;
fig. 9 is a schematic structural diagram of a watermark superimposing apparatus according to an embodiment of the present application;
Fig. 10 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all, of the embodiments of the present application. Based on the embodiments herein, a person of ordinary skill in the art would be able to obtain all other embodiments based on the disclosure herein, which are within the scope of the disclosure herein.
Because of the display requirement, when the video is derived from the image acquisition device, the watermark can be superimposed in the video, so that each frame of video picture displayed is a video picture comprising the watermark when the video is displayed every time later. Based on this, how to superimpose watermarks in video is a technical problem to be solved currently.
In order to solve the technical problems, embodiments of the present application provide a watermark superimposing method.
The method can be suitable for various application scenes in which watermarks are required to be superimposed on the video exported by the preset storage device, for example, when the factory monitoring video is exported from the NVR, the watermarks are superimposed on the factory monitoring video; when a photographic work is played back in a video camera, a watermark or the like is superimposed on the photographic work.
Moreover, the method can be applied to various electronic devices which can communicate with preset storage devices, such as mobile phones, notebook computers, desktop computers and the like; the electronic device may be an independent electronic device, or may be a device cluster formed by a plurality of electronic devices, hereinafter referred to as an electronic device.
And, the preset storage device may be various devices capable of storing images, for example, a memory card, an NVR, a computer, a mobile phone, and the like.
Based on this, the embodiment of the present application does not specifically limit the application scenario and execution subject of the method.
The watermark superposition method provided by the embodiment of the application can comprise the following steps:
acquiring watermark superposition information appointed by a user; wherein the watermark superimposition information includes: a target watermark image;
acquiring a picture or a video frame derived from preset storage equipment as an initial image to be subjected to watermark superposition;
decoding the initial image to obtain decoded initial image data, and obtaining canvas information in the initial image data;
replacing the image information of the area for overlapping the target watermark image in the canvas information with the image information of the target watermark image to obtain target image data overlapped with the target watermark image;
Performing specified processing matched with preset processing requirements on the target image data to obtain a target image; wherein, the preset processing requirements include: and (3) displaying and/or exporting.
In the above, by applying the scheme provided by the embodiment of the present application, watermark superposition information specified by a user may be first obtained, where the watermark superposition information includes a target watermark image. Then, obtaining a picture or a video frame derived from preset storage equipment as an initial image to be subjected to watermark superposition; then, decoding the initial image to obtain decoded initial image data, and obtaining canvas information in the initial image data; in this way, the image information of the area for overlapping the target watermark image in the canvas information can be replaced by the image information of the target watermark image to obtain the target image data overlapped with the target watermark image, and further, the target image data can be subjected to the appointed processing matched with the preset processing requirement to obtain the target image; wherein, the preset processing requirements include: and (3) displaying and/or exporting.
Based on the above, the scheme provided by the embodiment of the application is applied, the image superposition watermark derived from the preset storage device is realized by replacing the image information of the region to be superposed in the canvas information with the image information of the target watermark image, so that the target watermark image can be superposed in the canvas of the image, the image information of the target watermark image is always included in the target image data obtained by watermark superposition, and the target watermark image is superposed in the target image derived or displayed subsequently. And by carrying out watermark superposition on the image derived from the preset storage device, the image can be traced and traced, and the possibility of piracy of the image is reduced.
The following describes a watermark superimposing method provided in the embodiment of the present application with reference to the accompanying drawings.
Fig. 1 is a schematic flow chart of a watermark superimposing method according to an embodiment of the present application, as shown in fig. 1, the method may include the following steps S101 to S105.
S101: acquiring watermark superposition information appointed by a user;
wherein the watermark superimposition information includes: a target watermark image;
when it is desired to watermark a video, a user may specify watermark overlay information that is desired for watermark overlay, wherein the watermark overlay information includes a target watermark image.
Alternatively, when it is desired to perform watermark superimposition using watermark superimposition information, the user may send a watermark superimposition instruction carrying the watermark superimposition information to the electronic device. Thus, when the electronic equipment receives the watermark superposition instruction, the watermark superposition information carried by the watermark superposition instruction can be obtained, and watermark superposition is performed by using the watermark superposition information.
Optionally, when the electronic device receives the watermark superposition instruction sent by the user, the watermark image library may be displayed on a preset display interface. Thus, the user can select a target watermark image desired for watermark superimposition from the watermark image library, and send watermark superimposition information including the target watermark image to the electronic device by clicking the target watermark image.
The target watermark image is an image including one watermark character, and the watermark character may be set according to actual needs, for example, the device number of the image capturing device, the device number of the electronic device that performs the watermark superimposing method, the personnel identifier of the image capturing personnel, etc., which are all reasonable, and are not specifically limited in the embodiment of the present application.
Illustratively, the watermark character is a "watermark", the target watermark image is an image comprising one watermark character, and the target watermark image is as shown in fig. 2 (a).
Furthermore, the electronic device may acquire watermark superimposition information specified by the user, and perform watermark superimposition using the watermark superimposition information.
Therefore, the personalized requirements of the user can be met by utilizing the watermark superposition information appointed by the user to carry out watermark superposition, and when different videos are subjected to watermark superposition, the watermark superposition can be carried out according to the watermark superposition information appointed by each video by the user, so that the use experience of the user is improved.
S102, acquiring a picture or a video frame derived from preset storage equipment as an initial image to be subjected to watermark superposition;
generally, an image capturing apparatus may perform image capturing of a specified area and store the captured image as a video. The image capture device may then be instructed to output the video for subsequent processing of the video. For example, the image acquisition device may send the stored video to other storage devices for permanent storage; for another example, the image capturing apparatus may play back the video or the like on its own display screen.
The image capturing device may be a video camera, a video recorder, a monocular camera, a multi-view camera, or other devices having an image capturing function, and after capturing an image, the image capturing device stores the captured image in its own storage space, and may be further referred to as a preset storage device.
Accordingly, the process of instructing the image capturing device to output the video may be referred to as a process of deriving the video from a preset storage device. Wherein the recording may be a picture or a video frame.
Due to presentation requirements, it is desirable to watermark recordings derived from a pre-set storage device. The video thus derived is an image with a watermark superimposed thereon, and the video always carries the watermark when the video is subsequently processed. For example, when a video is derived from an NVR, a watermark may be superimposed in the video so that each time the video is subsequently transmitted, the watermark is superimposed in the transmitted video; and each time the video is displayed, the watermark superimposed in the video can be displayed simultaneously.
For example, in the intelligent traffic field, a video recorder may collect a road traffic video of a specified road, and the video recorder may temporarily store the collected road traffic video, and then transmit the road traffic video to a hard disk device so as to permanently store the road traffic video. Furthermore, the collection time of the road traffic video and the serial number of the video recorder can be used as watermarks to be superimposed in the road traffic video, so that the watermark is included in the restored road traffic video when the road traffic video is restored each time; when the traffic command center looks at the road traffic video, the acquisition time of the road traffic video and the number of the video recorder for acquiring the road traffic video can be seen in each frame of video.
Since a video may include pictures or video, and the video is watermarked, that is, each picture or each video frame in the video is watermarked. And then, carrying out watermark superposition on the video exported by the preset storage device, namely, carrying out watermark superposition on the picture or video frame exported by the preset storage device.
Based on this, when it is desired to watermark a picture or video frame derived from a preset storage device, it is possible to first acquire the picture or video frame derived from the preset storage device and take the picture or video frame as an initial image to be watermarked.
That is, when the video is a picture, the video derived from the preset storage device is a picture, and the picture derived from the preset storage device may be obtained and used as an initial image to be subjected to watermark superimposition.
When the video is the video, the video derived from the preset storage device is the video, each video frame of the video derived from the preset storage device can be obtained, and each video frame is respectively used as an initial image to be subjected to watermark superposition.
Optionally, when the electronic device receives the watermark superposition instruction, the image or the video may be derived from a preset storage device in which the communication connection is established, and further, the image or the video frame derived from the preset storage device is used as an initial image to be subjected to watermark superposition.
Wherein, since it is desired to superimpose the watermark on the video outputted from the preset storage device, the watermark superimposing instruction may include a search instruction, a export instruction, a playback instruction, and the like.
For example, when the preset storage device is an NVR, a picture may be retrieved at a device retrieval interface of the NVR, a video is derived from the NVR, a video is played back in a small window, and the like, where the retrieved picture, the derived video, and the video played back in the small window are all video output modes, and further, the retrieved picture, the derived video, and the video played back in the small window should include watermarks. Then, when detecting that the NVR receives the search instruction, the search instruction can be used as a watermark superposition instruction, and a picture indicated by the search instruction is derived from the NVR and used as an initial image to be subjected to watermark superposition; when detecting that the NVR receives the export instruction, the export instruction can be used as a watermark superposition instruction, and a picture indicated by the export instruction is exported from the NVR and used as an initial image to be subjected to watermark superposition; when detecting that the NVR receives the playback instruction, the playback instruction can be used as a watermark superposition instruction, and a picture indicated by the playback instruction is derived from the NVR and used as an initial image to be subjected to watermark superposition.
S103: decoding the initial image to obtain decoded initial image data, and obtaining canvas information in the initial image data;
when an initial image to be subjected to watermark superposition is obtained, the electronic equipment can decode the initial image to obtain decoded initial image data. Wherein, the initial image data obtained by decoding is YUV data.
The decoding format when decoding the initial image to be watermarked is also different, corresponding to the different encoding formats. For example, when an initial image is encoded in accordance with an h.264 (highly compressed digital video codec standard) encoding format, then the decoding manner when the initial image is decoded is the h.264 decoding format.
Optionally, the decoding process under the specified format is performed on the initial image.
Wherein the above specified manner corresponds to the encoding format of the initial image. Since the encoding format of the initial image may be set according to actual needs, the specified mode changes with the change of the encoding format, for example, if the encoding format of the initial image is the h.264 encoding format, the specified format is the h.264 decoding format; if the encoding format of the original image is MJPEG (Motion Joint Photographic Experts Group, technology, i.e., motion still image compression technology), the above specified format is MJPEG decoding format or the like. In this regard, in the present embodiment, the above-described specific format is not limited.
Based on the above, after the electronic device obtains the initial image to be subjected to watermark superposition, a preset decoder may be used to perform decoding processing on the initial image in a specified format, so as to obtain decoded initial image data. The electronic device may then obtain canvas information from the initial image data.
When the original image is subjected to watermark superposition, the desirable superposition effects are as follows: the superimposed watermark is always located in the target image obtained by watermark superimposition of the initial image.
Further, to achieve the above, a watermark may be superimposed in the canvas of the original image. In this way, the canvas subjected to watermark superposition always includes the watermark, and furthermore, the canvas subjected to watermark superposition of the target image always includes the watermark.
Then, after the initial image data is obtained by decoding, canvas information in the initial image data can be obtained, and watermark superposition is carried out on the canvas information.
Further, in some cases, the initial image size of the initial image and the preset image size of the target image to be generated may be different, in which case the initial image size of the initial image may be adjusted based on the preset image size of the target image to be generated to adjust the initial image size of the initial image to the target image size.
Based on this, in an optional specific implementation manner, in step S103, step 11 may include:
step 11: and acquiring the canvas information determined according to the size difference between the preset image size of the target image to be generated and the initial image size of the initial image in the initial image data.
In this specific implementation manner, the preset image size of the target image to be generated and the initial image size of the initial image may be determined first, then, the initial image data is obtained, and the initial image data is updated according to the size difference between the preset image size and the initial image size, so as to determine canvas information.
Optionally, the initial image size in the initial image data may be scaled according to the size difference between the preset image size and the initial image size, so that the size difference between the scaled initial image size and the preset image size is not greater than a preset difference threshold. Thus, since the initial image size in the initial image data is updated, the canvas information in the initial image data is updated accordingly, and the electronic device can acquire the updated canvas information. The preset difference threshold may be set according to actual needs, for example, 0.1 cm.
That is, when the preset image size of the target image to be generated is larger than the initial image size of the initial image, the initial image size may be reduced to a size different from the preset image size by not more than a preset difference threshold according to the size difference between the preset image size and the initial image size; when the preset image size is smaller than the initial image size, the initial image size can be enlarged to the size difference with the preset image size not larger than the preset difference threshold according to the size difference between the preset image size and the initial image size. Thus, after the initial image size of the initial image is updated, canvas information in the initial image information of the initial image is updated. Further, updated canvas information in the initial image data may be obtained.
Optionally, the electronic device may obtain canvas information in the initial image data, and then scale the canvas size obtained in the canvas information according to the preset image size and the size difference of the initial image size, so that the size difference between the canvas size and the preset image size is not greater than a preset difference threshold. Thus, the electronic device can obtain the scaled canvas information.
S104: replacing the image information of the area for overlapping the target watermark image in the canvas information with the image information of the target watermark image to obtain target image data overlapped with the target watermark image;
after obtaining the canvas information, the electronic device may determine an area for superimposing the target watermark image in the canvas information, and then replace the image information of the area with the image information of the target watermark image, so that, since part of the image information in the canvas information is replaced with the image information of the target watermark image, the canvas information includes the image information of the target watermark image, and further, the image information of the target watermark image is included in the target image data.
Alternatively, an area designated by the user for superimposing the target watermark image may be acquired, and then the image information of the area in the canvas information is replaced with the image information of the target watermark image. For example, when it is desired to superimpose the target watermark image in the middle region of the image, the user may determine the region coordinates of the middle region of the image of the target image to be generated based on the preset image size of the target image to be generated, and send a watermark superimposing instruction carrying the region coordinates of the middle region of the image to the electronic device, so that the electronic device may acquire the region coordinates and replace the image information of the region corresponding to the region coordinates in the canvas information with the image information of the target watermark image.
If a target watermark image is superimposed in an initial image, the target watermark image may be ignored due to the small or marginal image area occupied when the initial image with the target watermark image superimposed is displayed, for example, the target watermark image superimposed by the initial image may be ignored when the initial image is played back by a small window. Therefore, based on watermark display needs, a plurality of target watermark images can be superimposed in the initial image, so that the target watermark images are uniformly distributed in the whole initial image.
Based on this, in an optional specific implementation manner, the watermark superimposing information further includes: the arrangement mode, the image interval and the first size of the target watermark images; the step S104 may include the following steps 21-22:
step 21: determining a superposition area of the target watermark image in canvas information according to the arrangement mode, the image interval and the first size;
step 22: and replacing the image information of the overlapping area in the canvas information with the image information of the target watermark image to obtain target image data overlapped with the target watermark image.
In this specific implementation, in order to avoid that the target watermark image included in the target watermark image is so excessive that the generated target image is as shown in fig. 2 (b), there is an overlapping region of each target watermark image in the target image. The user may first determine the arrangement of the target watermark images, the image interval, and the first size in the target images to be generated. Further, watermark superimposition information including the target watermark image, the arrangement of the target watermark image, the image interval, and the first size is transmitted to the electronic device.
Optionally, the user may click the arrangement manner, the image interval and the first size of the target watermark image in the preset arrangement manner, the preset image interval and the preset first size displayed by the electronic device, and the electronic device may determine the arrangement manner, the image interval and the first size of the target watermark image specified by the user based on the click operation of the user.
The arrangement mode of the target watermark images can be set according to actual needs, for example, m×n, a×b, etc.;
the image interval refers to an interval between two adjacent target watermark images, and includes a lateral interval and a longitudinal interval for each target watermark image, and the image interval may be set according to actual needs, for example, may be 5cm, 4cm, and the like.
The first size may be set according to a preset image size, the arrangement manner, and an image interval of the target watermark image to be generated, for example, when the preset image size of the target watermark image to be generated is 10cm×15cm, the arrangement manner is 2*3, and the transverse interval is 2cm and the longitudinal interval is 3cm, the first size may be 2cm×3cm.
In this way, the electronic device may obtain the arrangement, the image interval, and the first size of the target watermark images specified by the user. After the electronic device obtains the target watermark image, the superposition area of the target watermark in the canvas information can be determined according to the arrangement mode, the image interval and the first size of the target watermark image, and then the image information of the superposition area in the canvas information is replaced by the image information of the target watermark image, so that the target image data superposed with the target watermark image is obtained.
For example, when the arrangement is n×m, the horizontal interval is 2 times the width in the first dimension of the target watermark image, and the vertical interval is 1.5 times the length in the first dimension of the target watermark image, the superimposed areas of the respective target watermark images arranged in the arrangement, the image interval, and the first dimension may be determined in the canvas information, and then the image information of the superimposed areas may be replaced with the image information of the target watermark image for each superimposed area. Thus, target image data of a plurality of target watermark images superimposed in the arrangement, image interval, and first size described above is obtained.
For example, the above arrangement is a×b, the first size of each target watermark image is c×d, the inclination angle of each target watermark image is 45 degrees, and the image interval is the image size of one target watermark image. Thus, target image data of a plurality of target watermark images superimposed in the arrangement, image interval, and first size described above is obtained.
For example, the arrangement manner, the image interval and the first size of the target watermark images shown in fig. 2 (a) may be determined in canvas information, then, in the canvas information, overlapping areas of the respective target watermark images are determined, and image information of each overlapping area is replaced with image information of the target watermark image, thereby obtaining target image data on which the target watermark images are overlapped, and further, obtaining the target image shown in fig. 2 (c).
Optionally, the arrangement mode, the image interval and the first size of the target watermark image in the obtained target image data may be adjusted according to the display mode, and the target image data may be updated based on the updated arrangement mode, the image interval and the first size.
Illustratively, when the object image shown in fig. 2 (c) is subjected to the window display, the window display effect of the object image is as shown in fig. 2 (d), and each object watermark image in the object image is small and is illegible. Furthermore, the arrangement mode, the image interval and the first size of the target watermark images overlapped by the target images can be adjusted, so that updated target images are obtained, and the small window display effect of the target images is shown as in fig. 2 (e), so that all the target watermark images are clear.
In some cases, the target watermark image in the user-specified watermark overlay information may include a plurality of watermark characters, and the watermark overlay information may also include a second size of the watermark image to be overlaid. Further, watermark superimposition may be performed using the target watermark image and the second size.
Optionally, in a specific implementation manner, the target watermark image includes a plurality of watermark characters; the watermark superimposition information further includes: a second size of the watermark image to be superimposed; the step S104 may include the following steps 31-32:
step 31: intercepting an image area with a second size from a target watermark image to be used as a watermark image to be superimposed;
Step 32: and replacing the image information of the area for overlapping the watermark image in the canvas information with the image information of the watermark image to be overlapped.
In this specific implementation manner, an image area with a second size may be intercepted in the obtained target watermark image, and be used as the watermark image to be superimposed. Then, the image information of the region for superimposing the watermark image in the canvas information in the initial image data may be replaced with the image information of the watermark image to be superimposed.
S105: performing specified processing matched with preset processing requirements on the target image data to obtain a target image;
wherein, the preset processing requirements include: and (3) displaying and/or exporting.
After watermarking the initial image, the user may present or derive the target image. Furthermore, after obtaining the target image data with the target watermark image superimposed thereon, the electronic device may perform, according to a preset processing requirement of a user, a specified process matching the preset processing requirement on the target image data, to obtain the target image.
The preset processing requirements can be displayed, exported or displayed and exported.
That is, after obtaining the target image data with the target watermark image superimposed thereon, the electronic device may perform corresponding specified processing on the target image data according to a preset processing requirement of a user, and further obtain the processed target image.
Optionally, when the preset processing requirement is display, the target image data may be converted into a target image in a preset display format.
Optionally, when the preset processing requirement is derived, the target image data may be encoded to obtain an encoded target image.
For clarity of the line, a detailed description will be given below of the specific implementation of the above step S105.
The above-mentioned scheme provided by the embodiment of the application is applied, the image superposition watermark derived from the preset storage device is realized by replacing the image information of the region to be superposed in the canvas information with the image information of the target watermark image, so that the target watermark image can be superposed in the canvas of the image, the image information of the target watermark image is always included in the target image data obtained by watermark superposition, and further, the target watermark image is superposed in the target image derived or displayed later. And by carrying out watermark superposition on the image derived from the preset storage device, the image can be traced and traced, and the possibility of piracy of the image is reduced.
Optionally, in a specific implementation manner, an electronic device for executing the watermark superposition method provided by the embodiment of the application may include an area management component and a drawing component;
the step S103 may be the step of obtaining canvas information in the initial image data, and may include the following step 41:
step 41: the region management component creates a region management handle and acquires canvas information in the initial image data by utilizing the region management handle;
correspondingly, the step S104 of replacing the image information of the area for overlapping the target watermark image in the canvas information with the image information of the target watermark image to obtain the target image data overlapped with the target watermark image may include the step 42:
step 42: and the drawing component replaces the image information of the area for overlapping the target watermark image in the canvas information with the image information of the target watermark image to obtain target image data overlapped with the target watermark image.
In this specific implementation manner, an electronic device that performs a watermark overlaying method provided by the embodiments of the present application may include a region management module and a rendering module.
The area management component is used for realizing area acquisition and area update; and the drawing component is used for realizing information handling and information filling.
Alternatively, the REGION management component may be an RGN (REGION) management component, and the drawing module may be a TDE (Two Dimensional Engine, two-dimensional engine) component, where the TDE is used to implement graphics drawing functions such as fast bitmap movement, fast color filling, fast anti-flash movement, fast bitmap scaling, dot drawing, horizontal/vertical drawing, bitmap format conversion, bitmap alpha (transparency) overlay, bitmap bitwise boolean operation, color operation, and the like.
After the initial image data is obtained by decoding, the region management group price can create a region management handle, and canvas information in the initial image data is obtained by using the region management handle. Furthermore, the drawing component can copy the image information of the target watermark image into the canvas information acquired by the area management component, and replace the image information of the area for overlapping the target watermark image in the canvas information with the image information of the target watermark image, so as to obtain the target image data overlapped with the target watermark image. In this way, the region management component can update canvas information in the initial image data to obtain target image data with the target watermark image superimposed.
Optionally, in a specific implementation manner, an electronic device configured to perform a watermark superimposing method provided by an embodiment of the present application may include an area management component and a scaling component, where the scaling component is bound to the area management component;
accordingly, in the step 11, the obtaining of the initial image data, according to the size difference between the preset image size of the target image to be generated and the initial image size of the initial image, the determined canvas information may include the following step 51:
step 51: the region management component creates a region management handle and acquires canvas information in the image data by utilizing the region management handle; wherein the canvas information is determined by the scaling component according to a size difference of a preset image size of the target image to be generated and an initial image size of the initial image.
In this specific implementation manner, an electronic device performing a watermark overlaying method provided by an embodiment of the present application may include a management component, a rendering component, and a scaling component, and the management component and the scaling component may be bound together.
The scaling component is used for scaling the image size in the initial image data.
Alternatively, the region management component may be an RGN management component, the rendering component may be a TDE component, the scaling component may be a VPSS (Video Process Sub-System video processing subsystem) component, and the VPSS component may be tied to the RGN management component.
Thus, after determining the preset image size of the target image to be generated, the scaling component may update canvas information in the initial image data according to a size difference between the preset image size of the target image to be generated and the initial image size of the initial image, and the region management component bound with the scaling component may create a region management handle and acquire canvas information in the initial image data using the region management handle. And the drawing component can copy the image information of the target watermark image to the canvas information acquired by the area management component, and replace the image information of the area for overlapping the target watermark image in the canvas information with the image information of the target watermark image to obtain the target image data overlapped with the target watermark image. In this way, the region management component can update canvas information in the initial image data to obtain target image data with the target watermark image superimposed. The region management component can update canvas information in the initial image data to thereby obtain target image data overlaid with the target watermark image.
Optionally, the VPSS component is bound to the RGN management component. Then, after the initial image data is input to the VPSS component, the image data output by the VPSS component is the target image data on which the target watermark image is superimposed.
Next, a specific implementation of the step S105 will be described.
Optionally, in a specific implementation manner, the preset processing requirement includes: displaying;
the step S105 may perform the designating process matching the preset process requirement on the target image data, and may include the following step 61:
step 61: if the initial image is a picture, converting the target image data into a target image in a third format, and displaying the target image; wherein the third format comprises: RGB format.
In this specific implementation manner, when desiring to display the target image with the target watermark image superimposed thereon, the user may send a display instruction for the target image and carrying the third format to the electronic device. Therefore, the electronic equipment can receive the display instruction and display the display instruction as a preset processing requirement.
Thus, when the initial image is a picture, the electronic device can convert the target image data superimposed with the target watermark image into a target image in a third format and display the target image.
The third format may be set according to the display requirement, for example, a gray scale format, an RGB format, a YUV format, etc., which are all reasonable, and are not specifically limited in the embodiment of the present application.
For example, the electronic device may convert the target image data superimposed with the target watermark image into a target image in RGB format, and display the target image in RGB format.
Optionally, in a specific implementation manner, the preset processing requirements are: displaying;
the step S105 may perform the designating process matching the preset process requirement on the target image data, and may include the following step 62:
step 62: if the initial image is a video frame, displaying a target video frame represented by target image data according to a specified video output mode; wherein, the designating the video output mode includes: full screen presentation in a display device for presenting a target image.
In this specific implementation manner, when it is desired to display the target image with the target watermark image superimposed thereon, the user may send a display instruction for the target image and carrying a specified video output manner to the electronic device. Therefore, the electronic equipment can receive the display instruction and display the display instruction as a preset processing requirement.
When the initial image is a video frame, the electronic device may display the target video frame represented by the target image data according to a specified video output mode.
The above specified video output mode may be set according to the display requirement, may be full-screen display in a display device for displaying the target image, or may be small-window display in a display device for displaying the target image, which is reasonable, and is not specifically limited in the embodiment of the present application.
Accordingly, optionally, in a specific implementation manner, the preset processing requirement includes: displaying;
the step S105 may perform the designating process matching with the preset process requirement on the target image data, and may include the following steps 61-62:
step 61: if the initial image is a picture, converting the target image data into a target image in a third format, and displaying the target image; wherein the third format comprises: RGB format;
step 62: if the initial image is a video frame, displaying a target video frame represented by target image data according to a specified video output mode; wherein, the designating the video output mode includes: full screen presentation in a display device for presenting a target image.
In this specific implementation manner, when a video frame with a preset watermark image superimposed thereon is desired to be displayed, a user may send a display instruction for the target image to the electronic device. Therefore, the electronic equipment can receive the display instruction and display the display instruction as a preset processing requirement.
Furthermore, the initial image is a picture, the target image data can be converted into a target image in a third format, and the target image is displayed; and when the initial image is a video frame, displaying the target video frame represented by the target image data according to a specified video output mode.
Since the specific implementation of steps 61-62 has been described in detail above, no further description is given here.
Optionally, in a specific implementation manner, the preset processing requirements may include: exporting;
the step S105 may perform the designating process matching the preset process requirement on the target image data, and may include the following step 71:
step 71: if the initial image is a picture, encoding processing is carried out on the target image data in a first format to obtain a target image; wherein the first format comprises: MJPEG encoding format.
In this particular implementation, when it is desired to derive a target image with a target watermark image superimposed thereon, the user may send a derivation instruction for the target image to the electronic device. Thus, the electronic device may receive the export instruction and export the export as a preset processing requirement.
Thus, when the initial image is a picture, the electronic device may perform encoding processing in the first format on the target image data on which the target watermark image is superimposed, so as to obtain the target image.
The first format may be a preset format of the electronic device, or may be an encoding format specified by a user acquired by the electronic device, and the first format may be set according to actual needs, for example, an MJPEG encoding format, etc., which are all reasonable, and are not specifically limited in the embodiments of the present application.
When the first format is the MJPEG encoding format, the electronic device may perform encoding processing under the MJPEG encoding format on the target image with the target watermark image superimposed thereon, to obtain a MJPEG target image.
Optionally, in a specific implementation manner, the preset processing requirements may include: exporting;
the step S105 may perform the designating process matching the preset process requirement on the target image data, and may include the following step 72:
step 72: if the initial image is a video frame, performing encoding processing on the target image data in a second format to obtain a target image; wherein the second format comprises: h.264 coding format.
In this particular implementation, when it is desired to derive a target image with a target watermark image superimposed thereon, the user may send a derivation instruction for the target image to the electronic device. Thus, the electronic device may receive the export instruction and export the export as a preset processing requirement.
Thus, when the initial image is a video frame, the electronic device may perform encoding processing in the second format on the target image data superimposed with the target watermark image, so as to obtain the target image.
The second format may be set according to actual needs, for example, an h.264 coding format, an h.265 coding format, etc., which are all reasonable, and are not specifically limited in the embodiment of the present application.
When the second format is the h.264 coding format, the electronic device may perform coding processing in the h.264 coding format on the plurality of target image data superimposed with the preset watermark image, to obtain a video including a plurality of frame video frames.
Accordingly, the step S105 of performing the designating process matching with the preset processing requirement on the target image data may include the following steps 71-72:
step 71: if the initial image is a picture, encoding processing is carried out on the target image data in a first format to obtain a target image; wherein the first format comprises: mJPEG encoding format;
Step 72: if the initial image is a video frame, performing encoding processing on the target image data in a second format to obtain a target image; wherein the second format comprises: h.264 coding format.
In this particular implementation, when it is desired to export a video frame superimposed with a preset watermark image, the user may send an export instruction for the target image to the electronic device. Thus, the electronic device may receive the export instruction and export the export as a preset processing requirement.
Furthermore, when the initial image is a picture, the electronic device may perform encoding processing on the target image data in the first format to obtain a target image; and when the initial image is a video frame, the electronic device can perform encoding processing under the second format on the target image data to obtain a target image.
Since the specific implementation of steps 71-72 has been described in detail above, no further description is given here.
In addition, when the preset processing requirement is derived, after the target image data is subjected to the specified processing to obtain the target image, the target image may be first stored in the preset buffer zone, and then derived from the preset buffer zone to other devices.
Based on this, in an optional specific implementation manner, the watermark superimposing method provided in the embodiment of the present application may further include the following step 81:
step 81: and uploading the target image to a preset buffer area for storage.
In this specific implementation manner, when the preset processing requirement is export, after the target image data is subjected to the specified processing, the obtained target image may be uploaded to the preset buffer area for storage.
The preset buffer area may be a buffer area set by an electronic device executing the watermark superimposing method provided in the embodiment of the present application.
Optionally, in a specific implementation manner, the watermark superposition method provided in the embodiment of the present application may further include the following steps 91 to 92:
step 91: detecting whether the first quantity of the initial image data in a preset first queue reaches a first preset quantity or not in the decoding process; if yes, go to step 92;
the method comprises the steps of presetting all initial image data in a first queue to be arranged according to the sequence from early to late of export time;
step 92: stopping the decoding process, and recovering the decoding process when the stopping time length reaches the first preset time length.
In this specific implementation manner, in the process of watermark superimposition of the initial image, the electronic device needs to decode and watermark superimposition of the initial image, and when the preset processing requirement is derivation, the electronic device also needs to perform encoding processing on the target image data superimposed with the image information of the target watermark image.
In general, the efficiency of the decoding process is higher than that of the watermark superimposing process and the encoding process, so that, for each initial image, after the initial image is subjected to the decoding process, the decoded initial image data can be queued in a preset first queue, that is, the preset first queue includes a plurality of initial image data, and the respective initial image data are arranged in order of the derivation time from early to late.
However, when the first amount of the initial image data included in the preset first queue reaches the first preset amount, the initial image data subsequently entering the preset first queue may be lost, or the initial image data subsequently entering the preset first queue may overwrite the initial image data previously entering the preset first queue, thereby causing the loss of the initial image data.
Based on this, in order to avoid the occurrence of the data loss, during the decoding process, the electronic device may detect whether the first number of the initial image data in the preset first queue reaches the first preset number. And stopping the decoding process if the first number reaches the first preset number, and recovering the decoding process when the stopping time length reaches the first preset time length.
The first preset number should be less than or equal to the queue capacity of the preset first queue, and the first preset number may be set according to actual needs, for example, when the queue capacity of the preset first queue is 30 frames, the first preset number may be 30 frames or 25 frames, which is reasonable, and the embodiment of the present application is not limited specifically.
Moreover, the first preset duration may be set according to the efficiency of the watermark superimposing process and the encoding process, for example, may be 10us or 30us, which is reasonable, and is not specifically limited in the embodiment of the present application.
The method of controlling the stop time of the decoding process by presetting the number of the initial image data included in the first queue in the data decoding process may be referred to as a decoding stream control process.
Optionally, in a specific implementation manner, the watermark superimposing method provided in the embodiment of the present application may further include the following steps 1001 to 1002:
step 1001: detecting whether a second number of target images to be uploaded to a preset buffer area in a preset second queue reaches a second preset number or not; if yes, go to step 1002;
the method comprises the steps of presetting all target images in a second queue to be arranged according to the sequence from early to late of the generation time;
step 1002: stopping the designated process, and recovering the designated process when the stopping time length reaches a second preset time length.
In this specific implementation manner, when the preset processing requirement is derived, the electronic device encodes the target image data to obtain the target image, and then uploads the target image to the preset buffer area for storage.
Due to the limitation of various factors such as uploading rate, the obtained target images can be queued in a preset second queue and waiting to be uploaded to a preset buffer area, namely the preset second queue comprises a plurality of coded target images, and the target images are arranged according to the sequence from early to late of the generation time.
Since the position in the preset second queue is limited, and when the second number of target images included in the preset second queue reaches the second preset number, the target images that subsequently enter the preset second queue may be lost, or the target images that subsequently enter the preset second queue may overlap the target images that previously entered the preset second queue, thereby causing loss of the target images.
Based on this, in order to avoid the occurrence of the image loss, the electronic device may detect whether the second number of the target images in the preset second queue reaches the second preset number, and further, if the second number reaches the second preset number, stop the designating process, and resume the designating process when the stopping time reaches the second preset time.
The second preset number should be less than or equal to the queue capacity of the preset second queue, and the second preset number may be set according to actual needs, for example, when the queue capacity of the preset second queue is 30 frames, the second preset number may be 30 frames or 25 frames, which is reasonable, and is not specifically limited in the embodiment of the present application.
Moreover, the second preset duration may be set according to the efficiency of the watermark superimposing process and the encoding process, for example, may be 10us or 30us, which is reasonable, and is not specifically limited in the embodiment of the present application.
The method for controlling the stopping time of the designated process by presetting the number of the target images included in the second queue may be referred to as a buffer flow control process.
In order to facilitate understanding of a watermark superimposing method provided in the embodiments of the present application, the following description is made with reference to fig. 3 to 8.
When watermark superimposition is performed on a video frame derived from a preset storage device, as shown in fig. 3, the watermark superimposition flow may include the following steps S301 to S315:
s301: acquiring video;
s302: judging whether the transcoding watermark is started or not; if yes, executing S303; if not, executing S315;
s303: acquiring a decoder state;
s304: the decoder processes each frame of data;
s305: creating an RGN handle;
s306: binding RGN to VPSS;
s307: obtaining a watermark superposition instruction;
s308: acquiring video transcoding watermark parameters;
s309: determining an m x n watermark large graph;
s310: a TED copy watermark image;
s311: updating RGN image canvas;
s312: sending to an encoder;
s313: transcoding and packaging processing threads;
s314: uploading the flow control treatment of the video cache area;
s315: and exporting the video.
When the watermark is superimposed on the video stored in the preset storage device, the video derived by the preset storage device can be obtained first, and then if the video is a video, playback and analysis flow, transcoding and playback processing and video transcoding processing are sequentially performed on the video.
Then, whether the transcoding watermark is opened or not can be judged, and if the transcoding watermark is not opened, the video is derived, wherein the derived video is the video without the watermark.
If the transcoding watermark is started, an RGN handle can be created and bound with the VPSS, and then the VPSS can update canvas information in each video frame data according to the preset image size of a target image to be generated and the size difference of the image size of each video frame image data, and the RGN can acquire the updated canvas information in each video frame data.
Then, the TED may copy the m×n watermark large map determined by the electronic device after the video transcoding watermark parameter is obtained, and crop the watermark large map to obtain a target watermark image, and further update the RGN image canvas with the target watermark image, so as to obtain target image data superimposed with image information of the target watermark image.
Then, the target image data can be sent to an encoder for encoding, a transcoding and packaging processing thread is called for packaging the encoded target image, and the packaged target image is uploaded to a video buffer for flow control processing, so that the video can be derived, wherein the derived video is an image with a watermark superimposed.
In addition, when the watermark is superimposed on the video derived from the preset storage device, the interaction flow between the units is shown in fig. 4, and APP (Application, mobile phone software) issues a video code stream to DSP (Digital Signal Processing, digital signal processor), so that the DSP can receive the video code stream, and perform watermark superimposing processing on each video frame to obtain each target image superimposed with the watermark.
The DSP may then send the target image into the VOU (Video Output Unit ), which displays the image; or, the DSP may send the target image to a VENC (Video encoding module), the VENC encodes the target image, and uploads the encoded watermark superposition result to the buffer area, and the watermark superposition result is restored to the APP.
The process flow of the watermark superposition in the DSP is shown in fig. 5, where the DSP takes each video frame as an initial image, and then decodes the initial image to obtain initial image data. And the DSP carries out watermark processing on the pre-superposition information to obtain a preset watermark image.
The DSP comprises VPSS and RGN, and for each frame of video frame, the VPSS scales the initial image size of the initial image according to the size difference between the target image size of the target image to be generated and the initial image size of the initial image, and updates canvas information in the initial image data.
RGN can acquire the updated canvas information, and TED copies the image information of the watermark image to the canvas information acquired by RGN to obtain target image data superimposed with the image information of the watermark image.
Then, the target image data can be sent to an encoder for encoding processing, and the encoded target image is uploaded to an uploading buffer area; alternatively, the target image is sent to the VOU for display.
When the watermark is superimposed on the picture derived from the preset storage apparatus, as shown in fig. 6, the watermark superimposing process may include the following steps S601 to S614:
s601: acquiring a picture;
s602: a code stream analysis and jpeg picture decoding flow;
s603: judging whether the transcoding watermark is started or not; if yes, executing S604;
s604: creating an RGN handle;
s605: binding RGN to VPSS;
s606: obtaining a watermark superposition instruction;
s607: acquiring video transcoding watermark parameters;
s608: determining an m x n watermark large graph;
s609: a TED copy watermark image;
s610: updating RGN image canvas;
s611: opening the code;
s612: the encoder processes each frame of data;
s613: generating code stream header information;
s614: store jepg.
When the watermark is superimposed on the video stored in the preset storage device, the video derived by the preset storage device can be obtained first, and then if the video is a jpeg picture, a code stream analysis flow can be performed on the jpeg picture to obtain decoded image data.
Then, whether the transcoding watermark is started or not can be judged, if the transcoding watermark is started, an RGN handle can be created, RGN is added to the VPSS, and then the VPSS can update canvas information in the image data according to the size difference between the preset image size of the target image to be generated and the image size of the image data, and the RGN can acquire the updated canvas information.
Then, the TED may copy the m×n watermark large map generated by the electronic device after the video transcoding watermark parameter is acquired, and crop the watermark large map to obtain a target watermark image, and further update the RGN image canvas with the target watermark image, so as to obtain target image data superimposed with image information of the target watermark image.
The target image data may then be fed into an encoder, which processes each frame of data to obtain an encoded jpeg target image, after which the bitstream header information is generated and the jepg target image is stored.
In addition, when the watermark is superimposed on the picture derived from the preset storage device, the interaction flow between the units is shown in fig. 7, and the APP issues the picture to the DSP. Thus, the DSP can receive the pictures, and carry out watermark superposition processing on each picture to obtain each target image superposed with the watermark.
Then, the DSP can capture the target image to obtain RGB capture images, and upload the RGB capture images to a buffer area; or the DSP can send the target image into the VENC, the VENC encodes the target image data, and the encoded watermark superposition result is uploaded to a buffer area and is restored into the APP. The step of encoding the target image data by the VENC, which is referred to as JPEG grabber, may be performed.
The process flow of the watermark superposition in the DSP is shown in fig. 8, where the DSP takes each picture as an initial image, and then sends the initial image to a decoder for decoding processing, so as to obtain initial image data. And the DSP carries out watermark processing on the pre-superposition information to obtain a preset watermark image.
The DSP comprises VPSS and RGN, the VPSS performs scaling according to the size difference between the target image size of the image to be generated and the initial image size of the initial image, and canvas information in the initial image data is updated.
RGN can acquire the updated canvas information, TED copies the image information of the watermark image into the canvas information acquired by RGN, and RGN updates the picture information again by utilizing the image information of the watermark image, so that the target image data with the image information of the watermark image superimposed is obtained.
Then, the target image data can be sent to an encoder for encoding processing to obtain encoded JPEG or video; or, format conversion is performed on the target image, and the converted RGB image or video is displayed.
Based on the same inventive concept, the embodiment of the present application further provides a watermark superimposing apparatus, corresponding to a watermark superimposing method shown in fig. 1 provided in the embodiment of the present application.
Fig. 9 is a schematic structural diagram of a watermark superimposing apparatus provided in an embodiment of the present application, and as shown in fig. 9, the apparatus may include the following modules:
an information acquisition module 910, configured to acquire watermark superposition information specified by a user; wherein the watermark superimposition information includes: a target watermark image;
an initial image obtaining module 920, configured to obtain a picture or a video frame derived from a preset storage device, as an initial image to be subjected to watermark superposition;
the canvas information acquisition module 930 is configured to perform decoding processing on the initial image to obtain decoded initial image data, and acquire canvas information in the initial image data;
the superimposing module 940 is configured to replace, in the canvas information, image information of an area for superimposing the target watermark image with image information of the target watermark image, to obtain target image data superimposed with the target watermark image;
a processing module 950, configured to perform a specified process on the target image data, where the specified process matches a preset process requirement, to obtain a target image; wherein, the preset processing requirements include: and (3) displaying and/or exporting.
The above-mentioned scheme provided by the embodiment of the application is applied, the image superposition watermark derived from the preset storage device is realized by replacing the image information of the region to be superposed in the canvas information with the image information of the target watermark image, so that the target watermark image can be superposed in the canvas of the image, the image information of the target watermark image is always included in the target image data obtained by watermark superposition, and further, the target watermark image is superposed in the target image derived or displayed later. And by carrying out watermark superposition on the image derived from the preset storage device, the image can be traced and traced, and the possibility of piracy of the image is reduced.
Optionally, in a specific implementation manner, the watermark superimposing information further includes: the arrangement mode, the image interval and the first size of the target watermark images;
the superposition module 940 is specifically configured to:
determining a superposition area of the target watermark image in the canvas information according to the arrangement mode, the image interval and the first size;
and replacing the image information of the overlapping area in the canvas information with the image information of the target watermark image to obtain target image data overlapped with the target watermark image.
Optionally, in a specific implementation manner, the preset processing requirement includes: exporting;
the processing module 950 is specifically configured to:
if the initial image is a picture, performing encoding processing on the target image data in a first format to obtain a target image; wherein the first format includes: mJPEG encoding format;
and/or the number of the groups of groups,
if the initial image is a video frame, performing encoding processing under a second format on the target image data to obtain a target image; wherein the second format includes: h.264 coding format.
Optionally, in a specific implementation manner, the apparatus further includes:
The first detection module is used for detecting whether the first quantity of the initial image data in a preset first queue reaches a first preset quantity or not in the decoding process; if yes, triggering a first stopping module; wherein, each initial image data in the preset first queue is arranged according to the order from the early to the late of the export time;
the first stopping module is configured to stop the decoding process, and resume the decoding process when the stopping time length reaches a first preset time length.
Optionally, in a specific implementation manner, the apparatus further includes:
and the storage module is used for uploading the target image to a preset buffer area for storage.
Optionally, in a specific implementation manner, the apparatus further includes:
the second detection module is used for detecting whether the second number of the target images to be uploaded to the preset buffer area in a preset second queue reaches a second preset number or not; if yes, triggering a second stopping module; wherein, each target image in the preset second queue is arranged according to the sequence from the early to the late of the image generation time;
the second stopping module is configured to stop the specified process, and resume the specified process when the stopping time length reaches a second preset time length.
Optionally, in a specific implementation manner, the preset processing requirement includes: displaying;
the processing module 950 is specifically configured to:
if the initial image is a picture, converting the target image data into a target image in a third format, and displaying the target image; wherein the third format comprises: RGB format;
and/or the number of the groups of groups,
if the initial image is a video frame, displaying a target video frame represented by the target image data according to a specified video output mode; the specified video output mode comprises the following steps: full screen presentation in a display device for presenting the target image.
Optionally, in a specific implementation manner, the canvas information obtaining module 930 is specifically configured to:
and acquiring the canvas information determined according to the size difference between the preset image size of the target image to be generated and the initial image size of the initial image in the image data.
The canvas information acquisition module 930 includes a plurality of watermark characters in the target watermark image; the watermark superimposition information further includes: a second size of the watermark image to be superimposed;
the superposition module 940 is specifically configured to:
Intercepting an image area with the second size from the target watermark image to serve as the watermark image to be superimposed;
and replacing the image information of the region for overlapping the watermark image to be overlapped with the image information of the watermark image to be overlapped in the canvas information.
The embodiment of the application also provides an electronic device, as shown in fig. 10, including:
a memory 1001 for storing a computer program;
the processor 1002 is configured to implement the steps of any watermark superimposing method provided in the embodiments of the present application when executing the program stored in the memory 1001.
And the electronic device may further comprise a communication bus and/or a communication interface, through which the processor 1002, the communication interface, and the memory 1001 communicate with each other.
The communication bus mentioned above for the electronic devices may be a peripheral component interconnect standard (Peripheral Component Interconnect, PCI) bus or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, etc. The communication bus may be classified as an address bus, a data bus, a control bus, or the like. For ease of illustration, the figures are shown with only one bold line, but not with only one bus or one type of bus.
The communication interface is used for communication between the electronic device and other devices.
The Memory may include random access Memory (Random Access Memory, RAM) or may include Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the aforementioned processor.
The processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; but also digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), field programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
In a further embodiment provided herein, there is also provided a computer readable storage medium having stored therein a computer program which when executed by a processor implements the steps of any of the watermark superimposing methods described above.
In a further embodiment provided herein, there is also provided a computer program product containing instructions that, when run on a computer, cause the computer to perform any of the watermark superimposing methods of the above embodiments.
In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, produces a flow or function in accordance with embodiments of the present application, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in or transmitted from one computer-readable storage medium to another, for example, by wired (e.g., coaxial cable, optical fiber, digital Subscriber Line (DSL)), or wireless (e.g., infrared, wireless, microwave, etc.). The computer readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that contains an integration of one or more available media. The usable medium may be a magnetic medium (e.g., a floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a Solid State Disk (SSD), etc.
It is noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
In this specification, each embodiment is described in a related manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for the apparatus embodiments, the electronic device embodiments, the computer-readable storage medium embodiments, and the computer program product embodiments, the description is relatively simple, and reference should be made to the description of method embodiments in part, since they are substantially similar to the method embodiments.
The foregoing description is only of the preferred embodiments of the present application and is not intended to limit the scope of the present application. Any modifications, equivalent substitutions, improvements, etc. that are within the spirit and principles of the present application are intended to be included within the scope of the present application.

Claims (12)

1. A method of watermark superposition, the method comprising:
acquiring watermark superposition information appointed by a user; wherein the watermark superimposition information includes: a target watermark image;
acquiring a picture or a video frame derived from preset storage equipment as an initial image to be subjected to watermark superposition;
decoding the initial image to obtain decoded initial image data, and obtaining canvas information in the initial image data;
replacing the image information of the area for overlapping the target watermark image in the canvas information with the image information of the target watermark image to obtain target image data overlapped with the target watermark image;
performing specified processing matched with preset processing requirements on the target image data to obtain a target image; wherein, the preset processing requirements include: and (3) displaying and/or exporting.
2. The method of claim 1, wherein the watermark overlay information further comprises: the arrangement mode, the image interval and the first size of the target watermark images;
The replacing the image information of the area for overlapping the target watermark image in the canvas information with the image information of the target watermark image to obtain the target image data overlapped with the target watermark image includes:
determining a superposition area of the target watermark image in the canvas information according to the arrangement mode, the image interval and the first size;
and replacing the image information of the overlapping area in the canvas information with the image information of the target watermark image to obtain target image data overlapped with the target watermark image.
3. The method of claim 1, wherein the preset processing requirements include: exporting;
the step of performing the specified processing on the target image data, which is matched with the preset processing requirement, includes:
if the initial image is a picture, performing coding processing under a first format on the target image data to obtain a target image; wherein the first format includes: mJPEG encoding format;
and/or the number of the groups of groups,
if the initial image is a video frame, performing coding processing on the target image data in a first format to obtain a target image; wherein the second format includes: h.264 coding format.
4. A method according to claim 3, characterized in that the method further comprises:
detecting whether the first quantity of the initial image data in a preset first queue reaches a first preset quantity or not in the decoding process; wherein, each initial image data in the preset first queue is arranged according to the order from the early to the late of the export time;
if yes, stopping the decoding process, and recovering the decoding process when the stopping time length reaches a first preset time length.
5. A method according to claim 3, characterized in that the method further comprises:
uploading the target image to a preset buffer area for storage.
6. The method of claim 5, wherein the method further comprises:
detecting whether a second number of target images to be uploaded to the preset buffer area in a preset second queue reaches a second preset number or not; wherein, each target image in the preset second queue is arranged according to the sequence from the early to the late of the image generation time;
if yes, stopping the appointed processing, and recovering the appointed processing when the stopping time length reaches a second preset time length.
7. The method of claim 1, wherein the preset processing requirements include: displaying;
the step of performing the specified processing on the target image data, which is matched with the preset processing requirement, includes:
if the initial image is a picture, converting the target image data into a target image in a third format, and displaying the target image; wherein the third format comprises: RGB format;
and/or the number of the groups of groups,
if the initial image is a video frame, displaying a target video frame represented by the target image data according to a specified video output mode; the specified video output mode comprises the following steps: full screen presentation in a display device for presenting the target image.
8. The method of claim 1, wherein the obtaining canvas information in the initial image data comprises:
and acquiring canvas information determined according to the size difference between the preset image size of the target image to be generated and the initial image size of the initial image in the initial image data.
9. The method of claim 1, wherein the target watermark image includes a plurality of watermark characters therein; the watermark superimposition information further includes: a second size of the watermark image to be superimposed;
The replacing the image information of the area for overlapping the target watermark image in the canvas information with the image information of the target watermark image to obtain the target image data overlapped with the target watermark image includes:
intercepting an image area with the second size from the target watermark image to serve as the watermark image to be superimposed;
and replacing the image information of the region for overlapping the watermark image to be overlapped with the image information of the watermark image to be overlapped in the canvas information.
10. The method according to any one of claims 1-9, wherein the method is applied to an electronic device comprising a region management component and a rendering component;
the obtaining canvas information in the initial image data comprises the following steps:
the region management component creates a region management handle and acquires canvas information in the initial image data by utilizing the region management handle;
the replacing the image information of the area for overlapping the target watermark image in the canvas information with the image information of the target watermark image to obtain the target image data overlapped with the target watermark image includes:
And the drawing component replaces the image information of the area for overlapping the target watermark image in the canvas information with the image information of the target watermark image to obtain target image data overlapped with the target watermark image.
11. The method of claim 8, wherein the method is applied to an electronic device that includes a region management component and a scaling component, and wherein the scaling component is bound to the region management component;
in the obtaining the initial image data, according to a preset image size of a target image to be generated and a size difference of an initial image size of the initial image, the determined canvas information includes:
the region management component creates a region management handle and acquires canvas information in the image data by utilizing the region management handle; wherein the canvas information is determined by the scaling component according to a size difference between a preset image size of the target image to be generated and an initial image size of the initial image.
12. An electronic device, comprising:
a memory for storing a computer program;
a processor for implementing the method of any of claims 1-11 when executing a program stored on a memory.
CN202311793977.9A 2023-12-22 2023-12-22 Watermark superposition method and electronic equipment Pending CN117812193A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311793977.9A CN117812193A (en) 2023-12-22 2023-12-22 Watermark superposition method and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311793977.9A CN117812193A (en) 2023-12-22 2023-12-22 Watermark superposition method and electronic equipment

Publications (1)

Publication Number Publication Date
CN117812193A true CN117812193A (en) 2024-04-02

Family

ID=90426083

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311793977.9A Pending CN117812193A (en) 2023-12-22 2023-12-22 Watermark superposition method and electronic equipment

Country Status (1)

Country Link
CN (1) CN117812193A (en)

Similar Documents

Publication Publication Date Title
CN110290425B (en) Video processing method, device and storage medium
CN101543071B (en) Information processing apparatus and method, and program
JP2018501693A (en) How to create a video
CN108370416A (en) Output video is generated from video flowing
CN107690074A (en) Video coding and restoring method, audio/video player system and relevant device
CN111818295B (en) Image acquisition method and device
CN101150704A (en) Image processing system, image processing method, and program product therefor
US20060170762A1 (en) Video composition apparatus, video composition method and video composition program
CN103369128A (en) Image reproduction apparatus and method for simultaneously displaying multiple moving-image thumbnails
JP2010286811A (en) Assembling display equipment, and methdo and system for control of screen thereof
FI117845B (en) Video image processing
CN112511896A (en) Video rendering method and device
JPH10164483A (en) Image data storage device
CN112565603B (en) Image processing method and device and electronic equipment
CN107580228B (en) Monitoring video processing method, device and equipment
CN103975583A (en) Capturing multiple video channels for video analytics and encoding
CN117812193A (en) Watermark superposition method and electronic equipment
CN1558664A (en) A high definition digital television program caption and background image synthesis method
CN112788198B (en) Image capturing apparatus, image transfer system, image capturing apparatus, image transfer method, recording medium, and computer apparatus
WO2021117481A1 (en) Data processing device, data processing method, and program
CN113037947B (en) Method for coding spatial information in continuous dynamic image
TW201216148A (en) Remote management system and the method thereof
JPH09116759A (en) Image decoder and image coding decoding system
JP2007201816A (en) Video image display system and video image receiver
JP2001128194A (en) Stereoscopic video processor, method for processing stereoscopic video and storing medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination