Disclosure of Invention
The embodiment of the invention provides an image processing method, electronic equipment and a connector, and aims to solve the problem that a screen projection picture is easy to be blocked when the electronic equipment utilizes a USB interface to carry out wired screen projection.
In order to solve the technical problem, the invention is realized as follows:
in a first aspect, an embodiment of the present invention provides an image processing method, which is applied to a first electronic device, where the first electronic device includes a USB interface, and the method includes:
grabbing a display interface of the first electronic device to obtain a first image;
acquiring a local image which is not coincident with a second image in the first image and coordinate information of the local image, wherein the second image is a previous frame image of the first image;
and sending the local image and the coordinate information to a connector through the USB interface so that the connector performs image synthesis on the local image and a third image according to the coordinate information to obtain a synthesized image, converting the synthesized image into a video output signal matched with a video interface of second electronic equipment, and sending the video output signal to the video interface, wherein the third image and the second image have the same display content.
Optionally, the sending the local image and the coordinate information to a connector through the USB interface includes:
when the updating frequency of the display interface exceeds a preset frequency and the ratio of the local image in the first image exceeds a preset ratio, compressing the local image according to target compression processing information to obtain a compressed local image;
and sending the compressed local image, the target compression processing information and the coordinate information to a connector through the USB interface.
Optionally, the target compression processing information includes format compression information;
the compressing the local image according to the target compression processing information to obtain a compressed local image includes:
according to the format compression information, carrying out format compression processing on the local image to obtain a format-compressed local image;
the sending the compressed local image, the target compression processing information and the coordinate information to a connector through the USB interface includes:
and sending the format compressed local image, the format compressed information and the coordinate information to a connector through the USB interface.
Optionally, the target compression processing information includes a pixel compression ratio, and the pixel compression ratio is determined according to the update frequency of the display interface;
the compressing the local image according to the target compression processing information to obtain a compressed local image includes:
according to the pixel compression ratio, performing pixel compression processing on the local image to obtain a local image after pixel compression;
the sending the compressed local image, the target compression processing information and the coordinate information to a connector through the USB interface includes:
and sending the local image after pixel compression, the pixel compression ratio and the coordinate information to a connector through the USB interface.
In a second aspect, an embodiment of the present invention further provides an image processing method, applied to a connector, where the method includes:
receiving a local image and coordinate information of the local image, which are sent by a first electronic device through a USB interface of the first electronic device, wherein the local image is as follows: the first electronic equipment obtains a local image which is not overlapped with a second image in a first image by grabbing a display interface of the first electronic equipment, wherein the second image is a previous frame image of the first image;
according to the coordinate information, carrying out image synthesis on the local image and a third image to obtain a synthesized image, wherein the content of the third image is the same as that of the second image;
and converting the composite image into a video output signal matched with a video interface of the second electronic equipment, and sending the video output signal to the video interface.
Optionally, the receiving a local image and coordinate information of the local image sent by a first electronic device through a USB interface of the first electronic device includes:
receiving a compressed local image, target compression processing information and coordinate information of the local image, which are sent by a first electronic device through a USB interface of the first electronic device, wherein the compressed local image is: the first electronic device compresses the local image according to the target compression processing information to obtain an image when the update frequency of the display interface exceeds a preset frequency and the ratio of the local image in the first image exceeds a preset ratio;
the image synthesis of the local image and the third image according to the coordinate information to obtain a synthesized image includes:
according to the target compression processing information, restoring the compressed local image to obtain a restored local image;
and according to the coordinate information, carrying out image synthesis on the local image subjected to the reduction processing and the third image to obtain a synthesized image.
Optionally, the compressed local image is a format-compressed local image, and the target compression processing information includes format compression information;
the reducing the compressed local image according to the target compression processing information to obtain a reduced local image, including:
according to the format compression information, carrying out format reduction processing on the local image after format compression to obtain a local image after format reduction;
and according to the coordinate information, performing image synthesis on the reduced local image and the third image to obtain a synthesized image, including:
and according to the coordinate information, carrying out image synthesis on the local image with the reduced format and the third image to obtain a synthesized image.
Optionally, the compressed local image is a local image after pixel compression, and the target compression processing information includes a pixel compression ratio;
the reducing the compressed local image according to the target compression processing information to obtain a reduced local image, including:
according to the pixel compression ratio, carrying out pixel reduction processing on the local image after pixel compression to obtain a local image after pixel reduction;
and according to the coordinate information, performing image synthesis on the reduced local image and the third image to obtain a synthesized image, including:
and according to the coordinate information, carrying out image synthesis on the local image subjected to pixel restoration and the third image to obtain a synthesized image.
Optionally, the converting the composite image into a video output signal matched with a video interface of a second electronic device, and sending the video output signal to the video interface includes:
under the condition that the video interface belongs to a preset interface set, converting the color gamut of the synthetic image into a target color gamut matched with the video interface to obtain a color gamut converted synthetic image;
and converting the synthesized image after the color gamut conversion into a video output signal matched with the video interface, and transmitting the video output signal to the video interface.
In a third aspect, an embodiment of the present invention further provides an electronic device, where the electronic device is a first electronic device, the first electronic device includes a USB interface, and the first electronic device includes:
the grabbing module is used for grabbing a display interface of the first electronic device to obtain a first image;
the acquisition module is used for acquiring a local image which is not overlapped with a second image in the first image and coordinate information of the local image, wherein the second image is a previous frame image of the first image;
and the sending module is used for sending the local image and the coordinate information to a connector through the USB interface so that the connector can synthesize the local image and the third image according to the coordinate information to obtain a synthesized image, convert the synthesized image into a video output signal matched with a video interface of second electronic equipment, and send the video output signal to the video interface, wherein the third image and the second image have the same display content.
Optionally, the sending module includes:
the compression processing unit is used for compressing the local image according to target compression processing information under the condition that the updating frequency of the display interface exceeds a preset frequency and the ratio of the local image in the first image exceeds a preset ratio to obtain a compressed local image;
and the sending unit is used for sending the compressed local image, the target compression processing information and the coordinate information to a connector through the USB interface.
Optionally, the target compression processing information includes format compression information;
the compression processing unit is used for:
under the condition that the updating frequency of the display interface exceeds a preset frequency and the occupation ratio of the local image in the first image exceeds a preset occupation ratio, carrying out format compression processing on the local image according to the format compression information to obtain a format-compressed local image;
the sending unit is used for:
and sending the format compressed local image, the format compressed information and the coordinate information to a connector through the USB interface.
Optionally, the target compression processing information includes a pixel compression ratio, and the pixel compression ratio is determined according to the update frequency of the display interface;
the compression processing unit is used for:
under the condition that the updating frequency of the display interface exceeds a preset frequency and the ratio of the local image in the first image exceeds a preset ratio, performing pixel compression processing on the local image according to the pixel compression ratio to obtain a pixel-compressed local image;
the sending unit is used for:
and sending the local image after pixel compression, the pixel compression ratio and the coordinate information to a connector through the USB interface.
In a fourth aspect, an embodiment of the present invention further provides a connector, where the connector includes:
a receiving module, configured to receive a local image and coordinate information of the local image, where the local image is sent by a first electronic device through a USB interface of the first electronic device, and the local image is: the first electronic equipment obtains a local image which is not overlapped with a second image in a first image by grabbing a display interface of the first electronic equipment, wherein the second image is a previous frame image of the first image;
the synthesis module is used for carrying out image synthesis on the local image and a third image according to the coordinate information to obtain a synthesized image, wherein the content of the third image is the same as that of the second image;
and the sending module is used for converting the synthetic image into a video output signal matched with a video interface of second electronic equipment and sending the video output signal to the video interface.
Optionally, the receiving module is configured to:
receiving a compressed local image, target compression processing information and coordinate information of the local image, which are sent by a first electronic device through a USB interface of the first electronic device, wherein the compressed local image is: the first electronic device compresses the local image according to the target compression processing information to obtain an image when the update frequency of the display interface exceeds a preset frequency and the ratio of the local image in the first image exceeds a preset ratio;
the synthesis module comprises:
the restoration unit is used for restoring the compressed local image according to the target compression processing information to obtain a restored local image;
and the synthesis unit is used for carrying out image synthesis on the local image subjected to the reduction processing and the third image according to the coordinate information to obtain a synthesized image.
Optionally, the compressed local image is a format-compressed local image, and the target compression processing information includes format compression information;
the reduction unit is used for:
according to the format compression information, carrying out format reduction processing on the local image after format compression to obtain a local image after format reduction;
the synthesis unit is used for:
and according to the coordinate information, carrying out image synthesis on the local image with the reduced format and the third image to obtain a synthesized image.
Optionally, the compressed local image is a local image after pixel compression, and the target compression processing information includes a pixel compression ratio;
the reduction unit is used for:
according to the pixel compression ratio, carrying out pixel reduction processing on the local image after pixel compression to obtain a local image after pixel reduction;
the synthesis unit is used for:
and according to the coordinate information, carrying out image synthesis on the local image subjected to pixel restoration and the third image to obtain a synthesized image.
Optionally, the sending module includes:
the color gamut conversion unit is used for converting the color gamut of the synthetic image into a target color gamut matched with the video interface under the condition that the video interface belongs to a preset interface set, so as to obtain a synthetic image after the color gamut conversion;
and the sending unit is used for converting the synthesized image after the color gamut conversion into a video output signal matched with the video interface and transmitting the video output signal to the video interface.
In a fifth aspect, an embodiment of the present invention further provides an electronic device, which includes a processor, a memory, and a computer program stored on the memory and executable on the processor, and when executed by the processor, the computer program implements the steps of the image processing method provided in the first aspect or the second aspect.
In a sixth aspect, the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when executed by a processor, the computer program implements the steps of the image processing method provided in the first aspect or the second aspect.
In the embodiment of the present invention, since the first electronic device only needs to send the partial image that is not overlapped with the second image in the first image and the coordinate information of the partial image to the connector, the connector can obtain the composite image with the same display content as the first image by image-combining the partial image with the third image, and then send the composite image to the second electronic device for playing, that is, without sending the whole frame of image, only the part of the frame image which is changed compared with the previous frame image needs to be sent to the connector, so that the data volume required to be transmitted by the USB interface of the first electronic equipment can be greatly reduced, and then can make electronic equipment utilize the USB interface to carry out wired when throwing the screen, throw the screen picture and be difficult to appear the card pause phenomenon, also can guarantee to throw the screen picture simultaneously and possess the definition of preferred.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, fig. 1 is a block diagram of an image processing system to which an embodiment of the present invention is applicable, and as shown in fig. 1, includes a first electronic device 11, a connector 12, and a second electronic device 13.
The first electronic Device 11 may be a Mobile phone, a Tablet Personal Computer (Tablet Personal Computer), a Laptop Computer (Laptop Computer), a Personal Digital Assistant (PDA), a Mobile Internet Device (MID), a Wearable Device (Wearable Device), or the like, which is equipped with a USB interface; here, the USB interface may be various types of USB interfaces such as USB 2.0, USB3.0, or USB Type-C.
The second electronic device 13 may be a television, a notebook computer, a desktop computer, or a video conference terminal equipped with a video interface; here, the Video Interface may be various types of Video interfaces such as a High Definition Multimedia Interface (HDMI), a Video Graphics Array (VGA) Interface, a Composite Video Broadcast Signal (CVBS) Interface, a Separate Video Interface (S-Video) Interface, or a color difference component Interface (byypr).
The connector 12 may be a device for receiving an image transmitted by the first electronic device 11 through the USB interface, performing corresponding processing on the image, and transmitting the processed image to the video interface of the second electronic device 13. Specifically, the connector 12 may have an input and an output, the input of the connector 12 may be connected to the USB interface of the first electronic device 11, and the output of the connector 12 may be connected to the second electronic device 13.
Referring to fig. 2, fig. 2 is a flowchart of an image processing method according to an embodiment of the present invention, the image processing method is applied to a first electronic device, the first electronic device includes a USB interface, and as shown in fig. 2, the image processing method includes the following steps:
step 201, capturing a display interface of first electronic equipment to obtain a first image;
wherein, step 201 can be understood as: and in the process of playing the multimedia file by the first electronic equipment, capturing a display interface of a display screen of the first electronic equipment in real time to obtain a current display picture of the multimedia file. It should be noted here that the capturing of the display interface of the first electronic device is to capture the entire display interface of the first electronic device, not a part of the display interface.
Step 202, obtaining a local image which is not coincident with a second image in the first image and coordinate information of the local image, wherein the second image is a previous frame image of the first image;
the misalignment may be understood as being different or inconsistent, that is, the partial image in the first image that is not coincident with the second image may be understood as: the first image has a distinct image portion or image area from the second image. The coordinate information of the partial image may be used to indicate the position of the partial image in the first image.
The second image is a previous frame of the first image, it is understood that the first electronic device continuously captures the display interface of the display screen in real time, and the second image is a captured image of the previous frame of the first image, that is, the capture time of the second image is earlier than the capture time of the first image, and the capture time of the second image is adjacent to the capture time of the first image, for example, assuming that the update time interval of the display interface is 0.001 second, the capture time interval of the display interface is also 0.001 second, and the image obtained by capturing the display interface at 0.002 second is the first image, the second image refers to the frame of the image obtained by capturing the display interface at 0.001 second.
And 203, sending the local image and the coordinate information to the connector through the USB interface, so that the connector performs image synthesis on the local image and the third image according to the coordinate information to obtain a synthesized image, converting the synthesized image into a video output signal matched with a video interface of the second electronic equipment, and sending the video output signal to the video interface, wherein the third image and the second image have the same display content.
Wherein the connector is capable of acquiring the third image by at least two ways: 1) the connector receives a second image sent by the first electronic device through the USB interface of the first electronic device, namely, after the first electronic device captures the second image, the first electronic device directly sends the second image to the connector through the USB interface of the first electronic device; 2) the connector receives a partial image which is not overlapped with the previous frame image of the second image in the second image and the coordinate information of the partial image, which are sent by the first electronic device through the USB interface of the first electronic device, and performs image synthesis on the partial image and the fourth image to obtain the third image, wherein the fourth image and the previous frame image of the second image have the same display content, that is, the third image can also be obtained through image synthesis.
The representation form of the video output signal may be determined according to the type of the video interface, for example, when the video interface is HDMI, the video output signal may be an HDMI video output signal; when the video interface is a VGA interface, the video output signal may be a VGA video output signal; when the video interface is a CVBS interface, the video output signal may be a CVBS video output signal; when the VIDEO interface is an S-VIDEO interface, the VIDEO output signal may be an S-VIDEO output signal; when the video interface is YPBPR, the video output signal may be a YPBPR video output signal.
For example, if fig. 3 shows 31 is the second image with pixels 1920 × 1080, fig. 4 shows 41 is the first image with pixels 1920 × 1080, first image 41 is the second image with pixels 1920 × 1080, first image 41 has changed image blocks including 411 and 412 shown in fig. 4 compared with second image 31, pixels of image block 411 are 400 × 300, pixels of image block 412 are 500 × 400, the local image refers to image block 411 and image block 412, the first electronic device only needs to acquire and send coordinate information of image block 411 and image block 412 and the two image blocks to the first connector, and thus, the actually required bandwidth accounts for 15.43% of the whole frame image, that is, the bandwidth required for transmitting image block 411 and image block 412 is only the first image block 15.43% of the whole frame image (15.43.43%) % shows that the embodiment of the invention can greatly reduce the data volume required to be transmitted by the USB interface.
In the embodiment of the present invention, since the first electronic device only needs to send the partial image that is not overlapped with the second image in the first image and the coordinate information of the partial image to the connector, the connector can obtain the composite image with the same display content as the first image by image-combining the partial image with the third image, and then send the composite image to the second electronic device for playing, that is, without sending the whole frame of image, only the part of the frame image which is changed compared with the previous frame image needs to be sent to the connector, so that the data volume required to be transmitted by the USB interface of the first electronic equipment can be greatly reduced, and then can make electronic equipment utilize the USB interface to carry out wired when throwing the screen, throw the screen picture and be difficult to appear the card pause phenomenon, also can guarantee to throw the screen picture simultaneously and possess the definition of preferred.
Optionally, the sending the local image and the coordinate information to the connector through a USB interface includes:
when the updating frequency of the display interface exceeds a preset frequency and the ratio of the local image in the first image exceeds a preset ratio, compressing the local image according to the target compression processing information to obtain a compressed local image;
and transmitting the compressed local image, the target compression processing information and the coordinate information to the connector through the USB interface.
The update frequency of the display interface may refer to a switching frequency of a display screen played by the display screen of the first electronic device. The above-mentioned occupation ratio of the partial image in the first image may refer to a size occupation ratio of the partial image in the first image, that is, the occupation ratio of the partial image in the first image may be obtained by dividing the size of the partial image by the size of the first image.
The target compression processing information may be preset by a system, or may be preset according to a user operation, for comparison, but the embodiment of the present invention is not limited. The compression process may be a format compression process, a pixel compression process, or another type of compression process.
Under the condition that the updating frequency of the display interface exceeds the preset frequency and the occupation ratio of the local image in the first image exceeds the preset occupation ratio, the local image is compressed according to the target compression processing information so as to further reduce the size of the local image to be sent, namely, when the switching speed of the display interface is high and the image change area in the single-frame image is large, the obtained local image is compressed and then sent, so that the definition of a static image can be ensured, and the fluency of a dynamic image can be ensured.
Optionally, the target compression processing information includes format compression information;
compressing the local image according to the target compression processing information to obtain a compressed local image, comprising:
according to the format compression information, carrying out format compression processing on the local image to obtain a format-compressed local image;
the partial image, the target compression processing information and the coordinate information after the compression processing are sent to the connector through the USB interface, and the method comprises the following steps:
and sending the format-compressed local image, the format compression information and the coordinate information to the connector through a USB interface.
The format compression information may be used to indicate that the format of the partial image is converted from a first format (i.e. the current format of the partial image) into a second format, where a bit width of the second format is smaller than a bit width of the first format, for example, if the first format is RGB888, the second format may be RGB565 or RGB555, etc. Accordingly, the format compression processing may be to convert the format of the partial image from the first format (i.e., the current format of the partial image) to the second format.
The realization process of the format compression processing is simpler, so that the data volume required to be transmitted when the local image is sent is reduced through the format compression processing, the operation process can be simplified, and the working efficiency is improved.
Optionally, the target compression processing information includes a pixel compression ratio, and the pixel compression ratio is determined according to an update frequency of the display interface;
compressing the local image according to the target compression processing information to obtain a compressed local image, comprising:
performing pixel compression processing on the local image according to a pixel compression ratio to obtain a pixel-compressed local image;
the partial image, the target compression processing information and the coordinate information after the compression processing are sent to the connector through the USB interface, and the method comprises the following steps:
and sending the local image after pixel compression, the pixel compression ratio and the coordinate information to the connector through a USB interface.
The update frequency of the display interface may refer to a switching frequency of a display screen played by the display screen of the first electronic device. The above pixel compression ratio is determined according to the update frequency of the display interface, which can be understood as follows: the first electronic device may determine, according to the update frequency of the current display interface and the correspondence, a pixel compression ratio corresponding to the update frequency of the current display interface, and use the pixel compression ratio as the pixel compression ratio in the target compression processing information.
For ease of understanding, the following are exemplified herein:
for example, assuming that 51 shown in fig. 5 represents a first image, 511 shown in fig. 5 represents a partial image that is not overlapped with a second image in the first image 51, and the pixels of the partial image 511 are 1600 × 800, and there is a corresponding relationship shown in table 1 between the pixel compression ratio and the update frequency of the display interface, when the update frequency of the display interface is 10HZ, the pixels of the partial image after the pixel compression processing are 1280 × 500; when the update frequency of the display interface is 15HZ, the pixels of the local image after the pixel compression processing are 890 × 480; when the update frequency of the display interface is 20HZ, the pixels of the local image after the pixel compression processing are 800 × 400.
TABLE 1
Display interface update frequency (Hz)
|
Pixel compression ratio
|
10
|
2
|
15
|
3
|
20
|
4 |
Optionally, in an embodiment, in order to more effectively reduce the data amount required to be transmitted when the local image is sent, after the local image is obtained, format compression processing may be performed on the local image to obtain a format-compressed local image, then pixel compression processing may be performed on the format-compressed local image to obtain a format-compressed and pixel-compressed local image, and finally the format-compressed and pixel-compressed local image and the coordinate information thereof are sent to the connector.
It should be noted that, the description sequence of the above steps is only provided for describing the technical solution provided by the embodiment of the present invention, and is not a strict execution sequence, and the specific situation may be adjusted according to the actual requirement.
It should be further noted that, various optional implementations described in the embodiments of the present invention may be implemented in combination with each other or separately, and the embodiments of the present invention are not limited thereto.
Referring to fig. 6, fig. 6 is a flowchart of an image processing method according to an embodiment of the present invention, the image processing method is applied to a connector, as shown in fig. 6, and the image processing method includes the following steps:
step 601, receiving a local image and coordinate information of the local image sent by a first electronic device through a USB interface of the first electronic device, where the local image is: the method comprises the steps that a first electronic device obtains a local image which is not coincident with a second image in a first image through capturing a display interface of the first electronic device, wherein the second image is a previous frame image of the first image;
the explanation on the first image obtained by capturing the display interface of the first electronic device, the local image that is not overlapped with the second image in the first image, the previous frame image of the first image of the second image, the coordinate information of the local image, and the like may be the explanation of the corresponding parts in the foregoing embodiments, and details are not repeated here.
Step 602, according to the coordinate information, performing image synthesis on the local image and a third image to obtain a synthesized image, wherein the third image and the second image have the same display content;
for the acquisition path of the third image, reference may be made to the description of the corresponding parts in the foregoing embodiments, and details are not repeated here.
The above image-combining the local image and the third image based on the coordinate information may be understood as: according to the coordinate information, determining the target position of the partial image on the third image, then placing the partial image at the target position of the third image, and removing the image part covered by the partial image in the third image, that is, replacing the image block corresponding to the partial image in the third image with the partial image to obtain the whole frame image with the same display content as the first image.
Step 603, converting the composite image into a video output signal matched with the video interface of the second electronic device, and sending the video output signal to the video interface.
For the description of the video output signal, reference may be made to the explanations of corresponding parts in the foregoing embodiments, and further description is omitted here.
In the embodiment of the invention, the connector only needs to receive the local image and the coordinate information of the local image sent by the first electronic device through the USB interface, the local image and the third image are subjected to image synthesis to obtain the synthesized image with the same display content as the first image, and then the synthesized image is sent to the second electronic device for playing, so that the data volume required to be transmitted by the USB interface of the first electronic device can be greatly reduced, the screen projection image is not easy to cause a pause phenomenon when the electronic device performs wired screen projection by using the USB interface, and meanwhile, the screen projection image can be ensured to have better definition.
Optionally, receiving the local image and the coordinate information of the local image sent by the first electronic device through the USB interface of the first electronic device includes:
receiving a compressed local image, target compression processing information and coordinate information of the local image, which are sent by a first electronic device through a USB interface of the first electronic device, wherein the compressed local image is: the method comprises the steps that when the updating frequency of a display interface exceeds a preset frequency and the ratio of a local image in a first image exceeds a preset ratio, first electronic equipment compresses the local image according to target compression processing information to obtain an image;
according to the coordinate information, image synthesis is carried out on the local image and the third image to obtain a synthetic image, and the method comprises the following steps:
according to the target compression processing information, restoring the compressed local image to obtain a restored local image;
and according to the coordinate information, carrying out image synthesis on the local image subjected to the reduction processing and the third image to obtain a synthesized image.
For the explanation of the update frequency of the display interface, the ratio of the local image in the first image, the target compression information, the compression process, and the like, reference may be made to the explanation of the corresponding parts in the foregoing embodiments, and details are not repeated here.
The restoration processing may be determined based on the compression processing, and for example, when the compression processing is format compression processing, the restoration processing may be format restoration processing; when the compression process is a pixel compression process, the restoration process may be a pixel restoration process.
The above image synthesis of the restored partial image and the third image according to the coordinate information may be understood as: according to the coordinate information, determining the target position of the restored partial image on the third image, then placing the restored partial image at the target position of the third image, and removing the image part of the third image covered by the restored partial image, that is, replacing the image block corresponding to the restored partial image in the third image with the restored partial image, so as to obtain the whole frame image with the same display content as the first image.
The local image after the compression processing is restored according to the target compression processing information, and the restored local image and the third image are used for image synthesis, so that the definition of the synthesized image can be ensured as much as possible while the data volume required to be transmitted by the USB interface of the first electronic device is further reduced, and the display definition of the screen projection picture is ensured.
Optionally, the compressed local image is a format-compressed local image, and the target compression processing information includes format compression information;
according to the target compression processing information, the local image after the compression processing is restored to obtain a restored local image, and the method comprises the following steps:
according to the format compression information, carrying out format reduction processing on the local image after format compression to obtain a local image after format reduction;
according to the coordinate information, the image synthesis is carried out on the local image after the reduction processing and the third image to obtain a synthetic image, and the synthetic image comprises:
and according to the coordinate information, carrying out image synthesis on the local image and the third image after format reduction to obtain a synthesized image.
The format compression information may be used to indicate that the format of the partial image is converted from a first format to a second format, where a bit width of the second format is smaller than a bit width of the first format, for example, if the first format is RGB888, the second format may be RGB565 or RGB 555. Accordingly, the format restoring process may be to restore the format of the partial image from the second format (i.e., the current format of the format-compressed partial image) to the first format.
Because the format of the local image after format compression is reduced according to the format compression information, and the local image after format reduction and the third image are used for image synthesis, the definition of the synthesized image can be ensured as much as possible while the data volume required to be transmitted by the USB interface of the first electronic device is further reduced, and the display definition of the screen projection picture is ensured.
Optionally, the compressed local image is a pixel compressed local image, and the target compression processing information includes a pixel compression ratio;
according to the target compression processing information, the local image after the compression processing is restored to obtain a restored local image, and the method comprises the following steps:
according to the pixel compression ratio, carrying out pixel reduction processing on the local image after pixel compression to obtain a local image after pixel reduction;
according to the coordinate information, the image synthesis is carried out on the local image after the reduction processing and the third image to obtain a synthetic image, and the synthetic image comprises:
and according to the coordinate information, carrying out image synthesis on the local image subjected to pixel restoration and the third image to obtain a synthesized image.
For convenience of understanding, the pixel reduction processing is performed on the local image after the pixel compression according to the pixel compression ratio, and examples here include:
for example, assuming that the pixel compression ratio of the local image after the pixel compression is 1280 × 500 and the pixel compression ratio is 2, the pixel of the local image after the pixel restoration may be 1600 × 800;
for example, assuming that the pixel compression ratio of the local image after pixel compression is 890 × 480 and the pixel compression ratio is 3, the pixel of the local image after pixel restoration may be 1600 × 800.
According to the pixel compression ratio, the format of the local image after pixel compression is restored, and the local image after pixel restoration and the third image are used for image synthesis, so that the definition of the synthesized image can be ensured as much as possible while the data volume required to be transmitted by the USB interface of the first electronic device is further reduced, and the display definition of the screen projection picture is ensured.
Optionally, converting the composite image into a video output signal matched with a video interface of the second electronic device, and sending the video output signal to the video interface, includes:
under the condition that the video interface belongs to the preset interface set, converting the color gamut of the synthetic image into a target color gamut matched with the video interface to obtain a synthetic image after the color gamut conversion;
and converting the synthesized image after the color gamut conversion into a video output signal matched with the video interface, and transmitting the video output signal to the video interface.
The preset interface set may include one or more interfaces, for example, the preset interface set may include at least one of the following interfaces: CVBS interface, S-VIDEO interface, YPBPR.
The color gamut may refer to an RGB color gamut, a YUV color gamut, or other types of color gamuts. The target color gamut may be determined according to a type of the VIDEO interface, and may be a YUV color gamut, for example, when the VIDEO interface is a CVBS interface or an S-VIDEO interface.
Since the color gamut of the synthesized image is converted into the target color gamut matched with the video interface under the condition that the video interface belongs to the preset interface set, the display effect of the synthesized image finally displayed on the second electronic device can be better.
It should be noted that, the description sequence of the above steps is only provided for describing the technical solution provided by the embodiment of the present invention, and is not a strict execution sequence, and the specific situation may be adjusted according to the actual requirement.
It should be further noted that, various optional implementations described in the embodiments of the present invention may be implemented in combination with each other or separately, and the embodiments of the present invention are not limited thereto.
Referring to fig. 7, fig. 7 is a structural diagram of an electronic device according to an embodiment of the present invention, as shown in fig. 7, an electronic device 700 is a first electronic device, the first electronic device includes a USB interface, and the first electronic device includes:
the capturing module 701 is used for capturing a display interface of the first electronic device to obtain a first image;
an obtaining module 702, configured to obtain a local image that is not overlapped with a second image in the first image and coordinate information of the local image, where the second image is a previous frame image of the first image;
the sending module 703 is configured to send the local image and the coordinate information to the connector through the USB interface, so that the connector performs image synthesis on the local image and the third image according to the coordinate information to obtain a synthesized image, converts the synthesized image into a video output signal matched with a video interface of the second electronic device, and sends the video output signal to the video interface, where the third image and the second image have the same display content.
Optionally, as shown in fig. 8, the sending module 703 includes:
a compression processing unit 7031, configured to, when the update frequency of the display interface exceeds the preset frequency and the ratio of the local image in the first image exceeds the preset ratio, perform compression processing on the local image according to the target compression processing information to obtain a compressed local image;
a sending unit 7032, configured to send the compressed local image, the target compression processing information, and the coordinate information to the connector through a USB interface.
Optionally, the target compression processing information includes format compression information;
the compression processing unit 7031 is configured to:
under the condition that the updating frequency of the display interface exceeds the preset frequency and the occupation ratio of the local image in the first image exceeds the preset occupation ratio, carrying out format compression processing on the local image according to format compression information to obtain a format-compressed local image;
transmitting unit 7032 is configured to:
and sending the format-compressed local image, the format compression information and the coordinate information to the connector through a USB interface.
Optionally, the target compression processing information includes a pixel compression ratio, and the pixel compression ratio is determined according to an update frequency of the display interface;
the compression processing unit 7031 is configured to:
under the condition that the updating frequency of the display interface exceeds a preset frequency and the ratio of the local image in the first image exceeds a preset ratio, performing pixel compression processing on the local image according to a pixel compression ratio to obtain a pixel-compressed local image;
transmitting unit 7032 is configured to:
and sending the local image after pixel compression, the pixel compression ratio and the coordinate information to the connector through a USB interface.
The electronic device 700 can implement each process implemented by the first electronic device in the method embodiment corresponding to fig. 2, and details are not described here again to avoid repetition.
According to the electronic device 700 of the embodiment of the present invention, only the local image that is not overlapped with the second image in the first image and the coordinate information of the local image need to be sent to the connector, the connector can synthesize the local image and the third image to obtain the synthesized image having the same display content as the first image, and then send the synthesized image to the second electronic device for playing, that is, the whole frame of image does not need to be sent, and only the portion of the frame of image that is changed compared with the previous frame of image needs to be sent to the connector, so that the data amount that needs to be transmitted by the USB interface can be obtained, and thus when the electronic device performs wired screen projection by using the USB interface, the screen projection image is not prone to being stuck, and meanwhile, the screen projection image can be guaranteed to have better definition.
Referring to fig. 9, fig. 9 is a structural diagram of a connector according to an embodiment of the present invention, and as shown in fig. 9, the connector 900 includes:
a receiving module 901, configured to receive a local image and coordinate information of the local image sent by a first electronic device through a USB interface of the first electronic device, where the local image is: the method comprises the steps that a first electronic device obtains a local image which is not coincident with a second image in a first image through capturing a display interface of the first electronic device, wherein the second image is a previous frame image of the first image;
a synthesizing module 902, configured to perform image synthesis on the local image and a third image according to the coordinate information to obtain a synthesized image, where the third image and the second image have the same display content;
and a sending module 903, configured to convert the composite image into a video output signal matched with a video interface of the second electronic device, and send the video output signal to the video interface.
Optionally, the receiving module 901 is configured to:
receiving a compressed local image, target compression processing information and coordinate information of the local image, which are sent by a first electronic device through a USB interface of the first electronic device, wherein the compressed local image is: the method comprises the steps that when the updating frequency of a display interface exceeds a preset frequency and the ratio of a local image in a first image exceeds a preset ratio, first electronic equipment compresses the local image according to target compression processing information to obtain an image;
as shown in fig. 10, the synthesis module 902 includes:
a restoring unit 9021, configured to perform restoring processing on the compressed local image according to the target compression processing information, to obtain a restored local image;
and a synthesizing unit 9022, configured to perform image synthesis on the restored local image and the third image according to the coordinate information, to obtain a synthesized image.
Optionally, the compressed local image is a format-compressed local image, and the target compression processing information includes format compression information;
the reduction unit 9021 is used for:
according to the format compression information, carrying out format reduction processing on the local image after format compression to obtain a local image after format reduction;
the synthesis unit 9022 is configured to:
and according to the coordinate information, carrying out image synthesis on the local image and the third image after format reduction to obtain a synthesized image.
Optionally, the compressed local image is a pixel compressed local image, and the target compression processing information includes a pixel compression ratio;
the reduction unit 9021 is used for:
according to the pixel compression ratio, carrying out pixel reduction processing on the local image after pixel compression to obtain a local image after pixel reduction;
the synthesis unit 9022 is configured to:
and according to the coordinate information, carrying out image synthesis on the local image subjected to pixel restoration and the third image to obtain a synthesized image.
Optionally, as shown in fig. 11, the sending module 903 includes:
the color gamut conversion unit 9031 is configured to, when the video interface belongs to the preset interface set, convert the color gamut of the synthesized image into a target color gamut matched with the video interface, to obtain a synthesized image after color gamut conversion;
and a sending unit 9032, configured to convert the color gamut converted composite image into a video output signal matched with the video interface, and transmit the video output signal to the video interface.
The connector 900 can implement each process implemented by the connector in the method embodiment corresponding to fig. 6, and is not described herein again to avoid repetition.
According to the connector 900 provided by the embodiment of the invention, only the local image and the coordinate information of the local image sent by the first electronic device through the USB interface are needed to be received, the local image and the third image are subjected to image synthesis to obtain the synthesized image with the same display content as the first image, and then the synthesized image is sent to the second electronic device for playing, so that the data volume required to be transmitted by the USB interface of the first electronic device can be greatly reduced, the phenomenon of pause is not easy to occur in a screen projection picture when the electronic device utilizes the USB interface to perform wired screen projection, and meanwhile, the screen projection picture can be ensured to have better definition.
An embodiment of the present invention further provides an electronic device, which includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor, where the computer program, when executed by the processor, implements each process of the image processing method embodiment corresponding to fig. 2, and can achieve the same technical effect, and details are not repeated here to avoid repetition.
An embodiment of the present invention further provides a connector, including a processor, a memory, and a computer program stored in the memory and capable of running on the processor, where the computer program, when executed by the processor, implements each process of the image processing method embodiment corresponding to fig. 6, and can achieve the same technical effect, and details are not repeated here to avoid repetition.
An embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements each process of the image processing method embodiment corresponding to fig. 2 or fig. 6, and can achieve the same technical effect, and in order to avoid repetition, details are not repeated here. The computer-readable storage medium may be a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk.
It should be noted that, in this document, 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 an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal (such as a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
While the present invention has been described with reference to the embodiments shown in the drawings, the present invention is not limited to the embodiments, which are illustrative and not restrictive, and it will be apparent to those skilled in the art that various changes and modifications can be made therein without departing from the spirit and scope of the invention as defined in the appended claims.