Image resolution ratio adjustment method and device, storage medium and electronic device
By inserting the target bar area into the non-critical area of the original image and adjusting the image resolution ratio, the image offset and content loss caused by different image resolution ratios in the prior art are solved, and the complete display and invisible deformation of the image content are achieved.
Patent Information
- Application Number
- CN202210103385.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-27
- Publication Date
- 2025-03-21
- Estimated Expiration
- 2042-01-27
AI Technical Summary
The prior art cannot effectively solve the problem of defective image display by direct stretching or cropping, and the problem of defective image display cannot be effectively solved.
By determining non-critical areas of the original image and inserting target bar areas into these areas, adjusting according to the ratio difference between the target resolution ratio and the original resolution ratio, a target image with the target resolution ratio is obtained.
It realizes that when adjusting the image resolution ratio, ensures that the image content display is complete and does not deform, and solves the problem of defective image display.
Smart Images

Figure CN114494000B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing, and in particular to a method and device for adjusting an image resolution ratio, a storage medium and an electronic device. Background Art
[0002] Usually, the resolution of an image is determined when the image is generated, such as when a photo is taken or a video is generated. However, the image display terminal may not match the image resolution. For example, the resolution ratio of a vertical screen live streaming end is usually 9:16, and when the receiving end is a full-screen mobile phone, the resolution ratio of the receiving end is usually 9:18.
[0003] When the image resolution ratio is different, if the image is displayed according to the original resolution, black edges will appear at the top, bottom or both sides of the display. In order to avoid the appearance of black edges with no content, the image can be stretched directly, but the image will be out of tune. In order to avoid image out of tune, the image is usually cropped to match the display resolution, but cropping the image will cause the content of the image to be missing. For example, if a 9:16 image is cropped according to a 9:18 resolution ratio, the content on the horizontal axis of the cropped image will be missing. In other words, when the resolution ratio is different, the existing resolution adjustment methods have disadvantages in image display.
[0004] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0005] The embodiments of the present invention provide a method and device for adjusting an image resolution ratio, a storage medium, and an electronic device, so as to at least solve the technical problem of defective image display caused by adjusting the image resolution ratio.
[0006] According to one aspect of an embodiment of the present invention, a method for adjusting an image resolution ratio is provided, comprising: determining a non-critical area of an original image, wherein the original image is an original resolution ratio image to be adjusted to a target resolution ratio, the target resolution ratio and the original resolution ratio have a ratio difference in a target axis direction, and the non-critical area is an area of the original image that does not contain a target object; determining a target strip area in the non-critical area, wherein the target strip area is a strip area constructed by multiple sub-areas in the non-critical area; and inserting the target strip area in the non-critical area according to the ratio difference between the target resolution ratio and the original resolution ratio to obtain a target image of the target resolution ratio.
[0007] According to another aspect of an embodiment of the present invention, there is also provided an image resolution ratio adjustment device, comprising: an area determination unit, used to determine a non-critical area of an original image, wherein the original image is an original resolution ratio image to be adjusted to a target resolution ratio, and there is a ratio difference between the target resolution ratio and the original resolution ratio in a target axis direction, and the non-critical area is an area in the original image that does not contain a target object; a splicing determination unit, used to determine a target strip area in the non-critical area, wherein the target strip area is a strip area constructed by multiple sub-areas in the non-critical area; and an adjustment unit, used to insert the target strip area in the non-critical area according to the ratio difference between the target resolution ratio and the original resolution ratio, so as to obtain a target image with the target resolution ratio.
[0008] According to another aspect of the embodiments of the present invention, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the above-mentioned method for adjusting the image resolution ratio when running.
[0009] According to another aspect of an embodiment of the present invention, there is provided an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the above-mentioned method for adjusting the image resolution ratio through the computer program.
[0010] In an embodiment of the present invention, a non-critical area of an original image not containing a target object is determined in the original resolution ratio, and there is a ratio difference between the target resolution ratio and the original resolution ratio in the target axis direction. A target strip area constructed by multiple sub-areas in the non-critical area is determined, and according to the ratio difference between the target resolution ratio and the original resolution ratio, a target strip area is inserted in the non-critical area to obtain a target image of the target resolution ratio. By determining the non-critical area not containing the target object from the original image, determining the target strip area for adjusting the resolution ratio from the non-critical area, and inserting and adjusting the target strip area in the non-critical area, the purpose of adjusting the resolution ratio of the target strip area in the non-critical area that does not include the target object in the original image is achieved, thereby achieving the technical effect of ensuring that the image content in the target image after the resolution ratio is adjusted is displayed complete and not deformed, thereby solving the technical problem of defective image display caused by image resolution ratio adjustment. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0012] Figure 1 is a schematic diagram of an application environment of an optional method for adjusting image resolution ratio according to an embodiment of the present invention;
[0013] Figure 2 is a flow chart of an optional method for adjusting the image resolution ratio according to an embodiment of the present invention;
[0014] Figure 3 is a schematic diagram of a non-critical area of an optional method for adjusting an image resolution ratio according to an embodiment of the present invention;
[0015] Figure 4 is a schematic diagram of a target strip area of an optional method for adjusting an image resolution ratio according to an embodiment of the present invention;
[0016] Figure 5 is a schematic diagram of a target image according to an optional method for adjusting the image resolution ratio according to an embodiment of the present invention;
[0017] Figure 6 is a schematic diagram of a target image according to an optional method for adjusting the image resolution ratio according to an embodiment of the present invention;
[0018] Figure 7 is a schematic structural diagram of an optional image resolution ratio adjustment device according to an embodiment of the present invention;
[0019] Figure 8 It is a schematic diagram of the structure of an optional electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0020] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0021] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0022] According to one aspect of an embodiment of the present invention, a method for adjusting an image resolution ratio is provided. Optionally, the method for adjusting an image resolution ratio may be applied to, but is not limited to, Figure 1 In the environment shown. The terminal device 102 is not limited to sending the terminal's target resolution ratio to the server 112 through the network 110, and the server 112 adjusts the resolution ratio of the image to be displayed on the terminal device 102 to the target image of the target resolution ratio according to the received target resolution ratio. After acquiring the target image of the target resolution ratio, the server 112 sends the target image to the terminal device 102 through the network 110, so that the target image matching the resolution ratio of the terminal device 102 is displayed on the terminal device 102.
[0023] The server 112 runs a database 114 and a processing engine 116. The database 114 is used to store the original image, the target resolution ratio and the target image obtained by processing received through the network 110. The processing engine 116 is used to obtain the target image according to the original image and the target resolution ratio in the database 114. Obtaining the target image with adjusted resolution ratio is not limited to being realized by sequentially executing S102 to S106. S102, determining the non-critical area. Determine the non-critical area of the original image, the original image is the original resolution ratio image to be adjusted to the target resolution ratio, the target resolution ratio and the original resolution ratio have a ratio difference in the target axis, and the non-critical area is the area in the original image that does not contain the target object. S104, determine the target strip area. Determine the target strip area in the non-critical area, the target strip area is a strip area constructed by multiple sub-areas in the non-critical area. S106, obtain the target image. According to the ratio difference between the target resolution ratio and the original resolution ratio, insert the target strip area in the non-critical area to obtain the target image with the target resolution ratio.
[0024] Optionally, in this embodiment, the terminal device 102 may be a terminal device configured with a target client, which may include but is not limited to at least one of the following: a mobile phone (such as an Android phone, an IOS phone, etc.), a laptop, a tablet computer, a PDA, a MID (Mobile Internet Devices), a PAD, a desktop computer, a smart TV, etc. The target client is not limited to a client for displaying a target image, and may specifically be an audio client, a video client, an instant messaging client, a browser client, an educational client, etc. The network 110 may include but is not limited to: a wired network, a wireless network, wherein the wired network includes: a local area network, a metropolitan area network, and a wide area network, and the wireless network includes: Bluetooth, WIFI, and other networks for realizing wireless communication. The server 112 may be a single server, or a server cluster consisting of multiple servers, or a cloud server. The above is only an example, and no limitation is made to this in this embodiment.
[0025] As an optional implementation, Figure 2 As shown, the method for adjusting the image resolution ratio includes:
[0026] S202, determining a non-critical area of an original image, wherein the original image is an original resolution ratio image to be adjusted to a target resolution ratio, there is a ratio difference between the target resolution ratio and the original resolution ratio in a target axis direction, and the non-critical area is an area in the original image that does not contain a target object.
[0027] The original image may be a single image or a video frame extracted from the original video. When the original image is a video frame of the original resolution ratio, the resolution ratio of each video frame included in the video is adjusted in sequence according to the frame sequence of the video frames to obtain a target video of the target resolution ratio, so as to adjust the resolution ratio of the video from the original resolution ratio to the target resolution ratio.
[0028] The target resolution ratio and the original resolution ratio are not limited to the target axis. For example, if the target resolution ratio is 9:18 and the original resolution ratio is 9:16, the resolution ratio difference is in the vertical axis; if the target resolution ratio is 16:9 and the original resolution ratio is 18:9, the resolution ratio difference is in the horizontal axis.
[0029] The original image is not limited to an image including the target object, and the original image is determined as a key area and a non-key area based on whether the target object is included. The key area is an area in the original image including the target object, and the non-key area is an area in the original image not including the target object.
[0030] S204: Determine a target strip region in the non-critical region, wherein the target strip region is a strip region constructed by a plurality of sub-regions in the non-critical region.
[0031] The target strip area is a strip area constructed by multiple sub-areas in the non-critical area, which can be a regular strip area or an irregular strip area, determined according to the multiple sub-areas that construct the target strip area. The target strip area is not limited to a strip area extending along the non-target axis, that is, a strip area constructed by multiple sub-areas with different target axial positions.
[0032] S206: insert a target strip area into the non-critical area according to the ratio difference between the target resolution ratio and the original resolution ratio, to obtain a target image with the target resolution ratio.
[0033] When the difference between the target resolution ratio and the original resolution ratio in the target axis direction is a positive number, that is, when it is necessary to perform image expansion in the target axis direction of the original image to obtain the target image of the target resolution ratio, inserting the target strip area in the non-critical area is not limited to filling the target strip area at the adjacent position of the target strip area in the non-critical area, so as to increase the image content in the target axis direction of the original image, thereby expanding the original image to the target image of the target resolution ratio.
[0034] When the difference between the target resolution ratio and the original resolution ratio in the target axis direction is a negative number, that is, when the original image needs to be limited in the target axis direction to obtain the target image with the target resolution ratio, the target strip area in the non-critical area is deleted to reduce the image content in the target axis direction of the original image, thereby limiting the original image to the target image with the target resolution ratio.
[0035] In an embodiment of the present application, a non-critical area that does not contain a target object in an original image with an original resolution ratio is determined, and there is a ratio difference between the target resolution ratio and the original resolution ratio in the target axis direction. A target strip area constructed by multiple sub-areas in the non-critical area is determined, and according to the ratio difference between the target resolution ratio and the original resolution ratio, a target strip area is inserted into the non-critical area to obtain a target image with a target resolution ratio. By determining a non-critical area that does not contain a target object from the original image, determining a target strip area for adjusting the resolution ratio from the non-critical area, and inserting and adjusting the target strip area in the non-critical area, the purpose of adjusting the resolution ratio of the target strip area in the non-critical area that does not include the target object in the original image is achieved, thereby achieving the technical effect of ensuring that the image content in the target image after the resolution ratio is adjusted is displayed complete and not deformed, thereby solving the technical problem of defective image display caused by image resolution ratio adjustment.
[0036] As an optional implementation manner, determining the non-critical area of the original image includes:
[0037] S1, dividing the original image into sub-regions to obtain a plurality of sub-region groups, wherein each sub-region group includes a plurality of sub-regions located at the same axial position on a non-target axial direction in the original image, where the non-target axial direction is an axial direction perpendicular to the target axial direction;
[0038] S2, sequentially detecting whether multiple sub-regions in each sub-region group contain the target object;
[0039] S3: when a candidate sub-region group is detected from the multiple sub-region groups, determine the candidate sub-region group as a non-critical region, wherein none of the multiple candidate sub-regions in the candidate sub-region group contains the target object.
[0040] The sub-region division of the original image is not limited to pixel-level region division of the original image according to the original resolution ratio, so that the original image is evenly divided into multiple sub-regions. Multiple sub-regions located at the same axial position on the non-target axis are regarded as a sub-region group.
[0041] The number of pixels contained in each sub-region is not limited here, but the number of sub-regions obtained by average division is not less than the product of the target axial ratio value and the non-target axial ratio value of the resolution ratio. For example, if the resolution ratio of the original image is 4:3, then the number of sub-regions obtained by sub-region division of the original image is not less than 4×3=12. It is not limited to performing more detailed sub-region division on the original image. The more sub-regions obtained by dividing the original image, the better the image display effect of the target image obtained after the resolution ratio is adjusted.
[0042] The target object is detected in sub-region groups, and each sub-region group is detected in turn. If the target object is detected in any sub-region in the sub-region group, the sub-region group is determined to belong to the key region in the original image. If the target object is not detected in all sub-regions in the sub-region group, the sub-region group is determined to belong to the non-key region in the original image.
[0043] Dividing the original image into sub-regions and determining the non-critical regions is not limited to the following: Figure 3As shown. The original resolution ratio of the original image 300 is 9:16, and the area where the target object is located is the target area 302. Taking the target resolution ratio of 9:18 as an example, the target axis is the vertical axis. The original image 300 is divided into sub-regions according to 9×16, and 144 sub-regions 310 are obtained. The sub-region group 320 is constructed using 9 sub-regions with the same horizontal axis position, that is, in the same row, and it is determined that the original image 300 is divided into 16 sub-region groups. Target object detection is performed on each sub-region group 320 in turn to determine whether the sub-region group 320 contains the target object, and multiple candidate sub-region groups that do not contain the target object at all are determined as non-critical areas, thereby determining the non-critical areas of the original image 300. From Figure 3 It can be seen that two non-critical areas are determined in the original image 300, namely non-critical area 330 and non-critical area 340, and the area sizes of the two non-critical areas are different. The number of non-critical areas and the area size of each non-critical area are only examples and are not used to limit non-critical areas.
[0044] When the number of non-critical areas is greater than 1, the target strip area is not limited to being determined for each non-critical area separately. After the target strip areas contained in each non-critical area are determined, the resolution ratio of the original image is adjusted according to all the target strip areas.
[0045] As an optional implementation manner, determining the target strip area in the non-critical area includes:
[0046] S1, calculating the region parameters of each candidate sub-region in the non-critical region, wherein the region parameters include a region change parameter and a region edge parameter, the region change parameter is used to indicate the region distance between the candidate sub-region and the reference sub-region, the reference sub-region is a region in a reference image corresponding to the candidate sub-region, the reference image is an image associated with the original image in time sequence, and the region edge parameter is used to indicate the pixel change degree of the edge position of the candidate sub-region;
[0047] S2, determining a plurality of target sub-regions adjacent to each other in the non-target axis from the non-critical region according to the region parameters of each candidate sub-region;
[0048] S3, determining a target strip area formed by a plurality of target sub-areas that are sequentially adjacent to each other in the non-target axial direction.
[0049] When the non-key region in the original image is determined, the region parameters are calculated for each candidate sub-region included in the non-key region. The region parameters are not limited to region change parameters and region edge parameters. The region change parameters are determined by comparing the candidate sub-region of the original image with the reference sub-region of the reference image.
[0050] The reference image is an image that is temporally associated with the original image. When the original image is a video frame, the reference image is not limited to being one or more video frames in the video that are adjacent to the original image. The reference image is divided into sub-regions according to the sub-region division method of the original image, and a reference sub-region corresponding to the candidate sub-region is determined from the sub-regions of the reference image, and the region distance between the candidate sub-region and the reference sub-region is used as the region change parameter. When the reference image includes multiple reference images, the mean, variance, mean square error or other statistical values of the multiple region distances are not limited to being used as the region change parameter.
[0051] In the case where the original image is not temporally related, it is not limited to using the regional edge parameter as the regional parameter of the candidate sub-region. The regional edge parameter is used to indicate the pixel change value of the edge position of the candidate sub-region, and is not limited to using the edge detection algorithm to perform edge detection on the candidate sub-region to obtain the edge pixel change complexity of the candidate sub-region. For example, the background pixel complexity of the candidate sub-region is calculated using the canny algorithm, and the calculated canny mean is used as the regional edge parameter. It is not limited to that the lower the value of the regional edge parameter, the lower the regional edge complexity of the indicated candidate sub-region.
[0052] When the regional change parameters and the regional edge parameters are calculated, it is not limited to weighted calculation of the regional change parameters and the regional edge parameters according to the parameter weights to obtain the regional parameters. When the regional parameters are obtained, the target sub-region is determined according to the regional parameters.
[0053] Alternatively, the target sub-region may be determined from the candidate sub-regions according to the parameter priority of the region change parameter and the region edge parameter. For example, when the parameter priority of the region change parameter is higher, the candidate target sub-region is first determined according to the region change parameter, and then the target sub-region is determined from the candidate target sub-regions according to the region edge parameter.
[0054] Multiple target sub-regions are adjacent in the non-target axis direction. Taking the non-target axis direction as the horizontal axis direction as an example, the target sub-regions are adjacent in the horizontal axis, including being vertically adjacent in the horizontal axis and being diagonally adjacent in the horizontal axis. Being vertically adjacent to the target sub-region in the horizontal axis refers to a candidate sub-region located on the left or right side of the target sub-region, and being diagonally adjacent to the target sub-region in the horizontal axis refers to a candidate sub-region located on the upper left, lower left, upper right, or lower right side of the target sub-region.
[0055] As an optional implementation, according to the region parameters of each candidate sub-region, determining a plurality of target sub-regions adjacent to each other in the non-target axis from the non-critical region includes:
[0056] S1, determining a candidate sub-region group from a non-critical region according to a parameter similarity threshold, wherein a parameter difference of region parameters of a plurality of candidate sub-regions in the candidate sub-region group is less than the parameter similarity threshold;
[0057] S2, determining, in the candidate sub-region group, a plurality of target sub-regions that have different target axial positions and are sequentially adjacent to each other in the non-target axial direction.
[0058] In the case where the region parameters of the candidate sub-regions are obtained by weighted calculation, it is not limited to determining a candidate sub-region group from a plurality of candidate sub-regions whose parameter difference of the region parameters is less than the parameter similarity threshold value from the non-critical regions according to a preset parameter similarity threshold value, and determining the target sub-region from the candidate sub-region group.
[0059] The multiple target sub-regions used to construct the target strip region have different target axial positions and are adjacent in sequence in the non-target axial direction. Taking the target axial direction as the longitudinal axis as an example, the non-target axial dimension is the transverse axis. Different target axial positions and adjacent in sequence in the non-target axial direction means different longitudinal axis positions and adjacent in sequence in the transverse axis, that is, each target sub-region is located in a different longitudinal column but is adjacent in sequence in the transverse row.
[0060] When multiple candidate sub-region groups are determined from the non-critical region, it is not limited to sequentially determining multiple target sub-regions in each candidate sub-region group to construct a target strip region. Different candidate sub-region groups are not limited to not including the same candidate sub-region, so as to avoid the target strip regions determined by different candidate sub-region groups from crossing and overlapping.
[0061] In the case that the target strip regions of different candidate sub-region groups cannot cross or overlap, at least one target strip region is determined from the multiple candidate sub-region groups. Determining the target strip region from the non-critical regions is to determine the target strip region for each non-critical region. A corresponding target strip region may not be determined in a non-critical region, or one or more target strip regions may be determined.
[0062] by Figure 3 Taking the non-key region 330 in the original image as an example, the target strip region determined from the non-key region 330 is not limited to the target strip region 400. Each target sub-region included in the target strip region 400 is filled with a slash to distinguish it from the candidate sub-regions in the non-key region.
[0063] As an optional implementation, the target image of the target resolution ratio is obtained by inserting a target strip area in the non-critical area according to the ratio difference between the target resolution ratio and the original resolution ratio, including:
[0064] S1, dividing the original image into a first image and a second image according to the target strip area, wherein the first image at least includes a key area and a target strip area of the original image, the key area is the area where the target object is located in the original image, and the second image is the remaining image after the first image is divided from the original image;
[0065] S2, constructing an insertion image using the target strip region, wherein the insertion image includes at least one target strip region;
[0066] S3, sequentially stitching the first image, the inserted image and the second image to obtain a target image.
[0067] The original image is divided into a first image and a second image according to the target strip area. The first image is a part including the target strip area and the key area, and the second image is a remaining part after the original image is divided out of the first image.
[0068] Using the target strip area to construct the inserted image is not limited to duplicating the target strip area to obtain the inserted image. The number of times the target strip area is duplicated is not limited to being determined according to the target resolution ratio and the original resolution ratio. When the inserted image is determined, the inserted image is spliced to the middle position of the first image and the second image to obtain the target image.
[0069] by Figure 4 Taking the target strip area 400 as an example, inserting the target strip area to obtain the target image is not limited to the following. Figure 5 As shown. Figure 5 In (1), the original image is segmented according to the side of the target strip area away from the key area to form a first image 501 and a second image 502. Figure 5 In (2), the target strip region 400 is used to construct the insertion image. Taking the target resolution of 9:18 as an example, it can be seen that the ratio difference in the target axis is 2, so the target strip region 400 is copied twice to construct the insertion image 503. After obtaining the insertion image 503, Figure 5 In (3), the first image 501, the second image 502 and the inserted image 503 are spliced, and the inserted image 503 is inserted between the first image 501 and the second image 502 to obtain a target image 510. The target image 510 is an image with a target resolution ratio of 9:18.
[0070] As an optional implementation, constructing the insertion image using the target strip area includes:
[0071] S1, determining a construction priority of a target strip region, wherein the construction priority is associated with a degree of regional change of a plurality of target sub-regions of the target strip region;
[0072] S2, calculating the target construction quantity of the target strip area according to the ratio difference between the target resolution ratio and the original resolution ratio and the construction priority;
[0073] S3, constructs the inserted image by splicing the target strip areas with the target construction quantity.
[0074] In the case where multiple target strip regions are determined from the original image, the construction priority corresponding to each of the multiple target strip regions is determined, and the construction priority is not limited to being inversely proportional to the degree of regional change of the multiple target sub-regions included in the target strip region. The greater the regional change of the multiple target sub-regions in the target strip region, the lower the construction priority of the target strip region. The regional change of the multiple target sub-regions is not limited to the change of regional pixels of the target sub-regions. The smaller the regional pixel change of the multiple target sub-regions, the lower the possibility of valid pixels contained in the target strip region, and thus the lower the possibility of causing image display defects by inserting the inserted image constructed by the target strip region into the original image, and therefore the higher the construction priority of the target strip region.
[0075] The target construction quantity corresponding to each target strip area is calculated according to the construction priority and the ratio difference between the target resolution ratio and the original resolution ratio, so that the sum of the target construction quantities corresponding to all the target strip areas corresponds to the ratio difference between the target resolution ratio and the original resolution ratio. When it is determined that the target construction quantity corresponding to the target strip area is less than a preset threshold, the target strip area is not discarded, and the remaining target strip areas are used to construct the corresponding insertion images.
[0076] According to the target construction quantity corresponding to each target strip area, an inserted image corresponding to each target strip area is generated, so that each inserted image is inserted into the original image in sequence to obtain a target image with a target resolution ratio.
[0077] As an optional implementation, when multiple non-key areas are determined in the original image, a target strip area in each of the multiple non-key areas is determined in sequence;
[0078] When multiple target strip areas are determined from multiple non-critical areas, the target construction quantity of each target strip area is calculated in sequence according to the ratio difference between the target resolution ratio and the original resolution ratio and the construction priority of each target strip area;
[0079] An insertion image corresponding to each target strip area is sequentially constructed according to the target construction quantity of each target strip area.
[0080] When the insertion image is constructed in sequence according to at least two target strip areas, the at least two target strip areas may be target strip areas in the same non-critical area or target strip areas in different non-critical areas. The insertion position of the insertion image corresponding to the target strip area is determined according to the location of the target strip area, and is not limited to inserting the insertion image corresponding to the target strip area to the side of the target strip area away from the critical area.
[0081] The number of target bar areas is 2 and they are located at Figure 3 Taking the non-critical area 330 and the non-critical area 340 as examples, the two target strip areas are not limited to being the first target strip area 610 located in the non-critical area 330 and the second target strip area 620 located in the non-critical area 340. The division of the original image according to the first target strip area 610 and the second target strip area 620 is not limited to forming: a first image 601, a second image 602 and a third image 603, wherein the third image 603 is the second image corresponding to the second target strip area 620, and is named the third image for easy distinction.
[0082] Taking the target resolution ratio of 9:20 as an example, when the construction priority of the second target strip area 620 is higher than the construction priority of the first target strip area 610, assuming that the construction quantity of the first target strip area 610 is 1 and the construction quantity of the second target strip area 620 is 4, the first inserted image 604 corresponding to the first target strip area 610 and the second inserted image 605 corresponding to the second target strip area 620 are respectively shown in the figure. The second inserted image 605 is inserted between the third image 603 and the first image 601, and the first inserted image 604 is inserted between the first image 601 and the second image 602, and the target image 600 with a resolution ratio of 9:20 is obtained by splicing.
[0083] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described action sequence, because according to the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.
[0084] According to another aspect of the embodiments of the present invention, there is also provided an image resolution ratio adjustment device for implementing the above-mentioned image resolution ratio adjustment method. Figure 7 As shown, the device comprises:
[0085] The region determination unit 702 is used to determine a non-key region of the original image, wherein the original image is an original resolution ratio image to be adjusted to a target resolution ratio, the target resolution ratio and the original resolution ratio have a ratio difference in the target axis direction, and the non-key region is a region in the original image that does not contain the target object;
[0086] A splicing determination unit 704 is used to determine a target strip region in the non-critical region, wherein the target strip region is a strip region constructed by multiple sub-regions in the non-critical region;
[0087] The adjusting unit 706 is used to insert a target strip area in the non-critical area according to the ratio difference between the target resolution ratio and the original resolution ratio to obtain a target image with the target resolution ratio.
[0088] Optionally, the area determination unit 702 includes:
[0089] A division module, used for dividing the original image into sub-regions to obtain a plurality of sub-region groups, wherein each sub-region group includes a plurality of sub-regions in the original image that are located at the same axial position on a non-target axial direction, where the non-target axial direction is an axial direction perpendicular to the target axial direction;
[0090] A detection module, used to detect in turn whether multiple sub-regions in each sub-region group contain a target object;
[0091] The candidate module is configured to determine the candidate sub-region group as a non-critical region when a candidate sub-region group is detected from among the multiple sub-region groups, wherein none of the multiple candidate sub-regions in the candidate sub-region group contains the target object.
[0092] Optionally, the splicing determination unit 704 includes:
[0093] a calculation module, used to calculate the region parameters of each candidate sub-region in the non-critical region, wherein the region parameters include a region change parameter and a region edge parameter, the region change parameter is used to indicate the region distance between the candidate sub-region and the reference sub-region, the reference sub-region is a region in the reference image corresponding to the candidate sub-region, the reference image is an image associated with the original image in time sequence, and the region edge parameter is used to indicate the pixel change degree of the edge position of the candidate sub-region;
[0094] A first determination module is used to determine a plurality of target sub-regions adjacent to each other in a non-target axis from the non-critical region according to the region parameters of each candidate sub-region;
[0095] The second determining module is used to determine a target strip area formed by a plurality of target sub-areas that are sequentially adjacent to each other in a non-target axial direction.
[0096] Optionally, the above-mentioned first determination module is also used to determine a candidate sub-region group from the non-critical area according to a parameter similarity threshold, wherein the parameter difference of the area parameters of multiple candidate sub-regions in the candidate sub-region group is less than the parameter similarity threshold; and determine multiple target sub-regions with different target axial positions and adjacent to each other in the non-target axial direction in the candidate sub-region group.
[0097] Optionally, the adjusting unit 706 includes:
[0098] A segmentation module is used to segment the original image into a first image and a second image according to the target strip area, wherein the first image at least includes a key area and a target strip area of the original image, the key area is the area where the target object is located in the original image, and the second image is the remaining image after the first image is segmented from the original image;
[0099] A construction module, used to construct an insertion image using the target strip area, wherein the insertion image includes at least one target strip area;
[0100] The splicing module is used to sequentially splice the first image, the inserted image and the second image to obtain a target image.
[0101] Optionally, the above-mentioned construction module is also used to determine the construction priority of the target strip area, wherein the construction priority is associated with the degree of regional change of multiple target sub-areas of the target strip area; calculate the target construction quantity of the target strip area according to the proportional difference between the target resolution ratio and the original resolution ratio and the construction priority; and use the target strip areas with the target construction quantity to splice and construct an inserted image.
[0102] Optionally, the above-mentioned construction module is also used to determine the target strip area in each of the multiple non-critical areas in turn when multiple non-critical areas are determined in the original image; when multiple target strip areas are determined from the multiple non-critical areas, calculate the target construction quantity of each target strip area in turn according to the ratio difference between the target resolution ratio and the original resolution ratio and the construction priority of each target strip area; and construct the inserted image corresponding to each target strip area in turn according to the target construction quantity of each target strip area.
[0103] In an embodiment of the present application, a non-critical area that does not contain a target object in an original image with an original resolution ratio is determined, and there is a ratio difference between the target resolution ratio and the original resolution ratio in the target axis direction. A target strip area constructed by multiple sub-areas in the non-critical area is determined, and according to the ratio difference between the target resolution ratio and the original resolution ratio, a target strip area is inserted into the non-critical area to obtain a target image with a target resolution ratio. By determining a non-critical area that does not contain a target object from the original image, determining a target strip area for adjusting the resolution ratio from the non-critical area, and inserting and adjusting the target strip area in the non-critical area, the purpose of adjusting the resolution ratio of the target strip area in the non-critical area that does not include the target object in the original image is achieved, thereby achieving the technical effect of ensuring that the image content in the target image after the resolution ratio is adjusted is displayed complete and not deformed, thereby solving the technical problem of defective image display caused by image resolution ratio adjustment.
[0104] According to another aspect of the embodiments of the present invention, an electronic device for implementing the above-mentioned image resolution ratio adjustment method is also provided. The electronic device may be Figure 1 The terminal device or server shown in the figure. This embodiment is described by taking the electronic device as a server as an example. Figure 8 As shown, the electronic device includes a memory 802 and a processor 804. The memory 802 stores a computer program, and the processor 804 is configured to execute the steps in any of the above method embodiments through the computer program.
[0105] Optionally, in this embodiment, the electronic device may be located in at least one network device among a plurality of network devices of a computer network.
[0106] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0107] S1, determining a non-critical area of an original image, wherein the original image is an original resolution ratio image to be adjusted to a target resolution ratio, the target resolution ratio and the original resolution ratio have a ratio difference in a target axis direction, and the non-critical area is an area in the original image that does not contain the target object;
[0108] S2, determining a target strip region in the non-critical region, wherein the target strip region is a strip region constructed by a plurality of sub-regions in the non-critical region;
[0109] S3, inserting a target strip area into the non-critical area according to the ratio difference between the target resolution ratio and the original resolution ratio, to obtain a target image with the target resolution ratio.
[0110] Alternatively, a person skilled in the art may understand that: Figure 8 The structure shown is for illustration only, and the electronic device may also be a smart phone (such as an Android phone, an IOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (Mobile Internet Devices, MID), a PAD, and other terminal devices. Figure 8 The structure of the electronic device is not limited. Figure 8 More or fewer components (such as network interfaces, etc.) as shown in, or with Figure 8 Different configurations are shown.
[0111] Among them, the memory 802 can be used to store software programs and modules, such as the program instructions / modules corresponding to the method and device for adjusting the image resolution ratio in the embodiment of the present invention. The processor 804 executes various functional applications and data processing by running the software programs and modules stored in the memory 802, that is, to implement the above-mentioned method for adjusting the image resolution ratio. The memory 802 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 802 may further include a memory remotely arranged relative to the processor 804, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. Among them, the memory 802 can be specifically, but not limited to, used to store information such as the original image, target resolution ratio, target strip area, target image, etc. As an example, such as Figure 8 As shown, the memory 802 may include, but is not limited to, the region determination unit 702, the splicing determination unit 704, and the adjustment unit 706 in the image resolution ratio adjustment device. In addition, other module units in the image resolution ratio adjustment device may also be included but are not limited to, which will not be described in detail in this example.
[0112] Optionally, the transmission device 806 is used to receive or send data via a network. Specific examples of the network may include wired networks and wireless networks. In one example, the transmission device 806 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices and routers via a network cable so as to communicate with the Internet or a local area network. In one example, the transmission device 806 is a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0113] In addition, the electronic device further includes: a display 808 for displaying the original image and the target image; and a connection bus 810 for connecting various module components in the electronic device.
[0114] According to one aspect of the present application, a computer program product or computer program is provided, the computer program product or computer program including computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the methods provided in various optional implementations of the above-mentioned adjustment of the image resolution ratio. The computer program is configured to perform the steps of any of the above-mentioned method embodiments when it is run.
[0115] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:
[0116] S1, determining a non-critical area of an original image, wherein the original image is an original resolution ratio image to be adjusted to a target resolution ratio, the target resolution ratio and the original resolution ratio have a ratio difference in a target axis direction, and the non-critical area is an area in the original image that does not contain the target object;
[0117] S2, determining a target strip region in the non-critical region, wherein the target strip region is a strip region constructed by a plurality of sub-regions in the non-critical region;
[0118] S3, inserting a target strip area into the non-critical area according to the ratio difference between the target resolution ratio and the original resolution ratio, to obtain a target image with the target resolution ratio.
[0119] Optionally, in this embodiment, a person of ordinary skill in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing hardware related to the terminal device through a program, and the program may be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.
[0120] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0121] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling one or more computer devices (which can be personal computers, servers or network devices, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention.
[0122] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0123] In the several embodiments provided in the present application, it should be understood that the disclosed client can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0124] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0125] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0126] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for adjusting image resolution ratio, characterized in that: include: Determine a non-critical area of an original image, wherein the original image is an original resolution ratio image to be adjusted to a target resolution ratio, the target resolution ratio and the original resolution ratio have a ratio difference in a target axis direction, and the non-critical area is an area of the original image that does not contain a target object; Determine a target strip area in the non-critical area, wherein the target strip area is a strip area constructed by a plurality of sub-areas in the non-critical area; According to the ratio difference between the target resolution ratio and the original resolution ratio, the target strip area is inserted into the non-critical area to obtain a target image of the target resolution ratio.
2. The method according to claim 1, characterized in that Determining the non-critical area of the original image includes: Dividing the original image into sub-regions to obtain a plurality of sub-region groups, wherein each sub-region group includes a plurality of sub-regions in the original image that are located at the same axial position on a non-target axial direction, where the non-target axial direction is an axial direction perpendicular to the target axial direction; sequentially detecting whether the plurality of sub-regions in each sub-region group contain the target object; When a candidate sub-region group is detected from among the plurality of sub-region groups, the candidate sub-region group is determined as the non-critical region, wherein none of the plurality of candidate sub-regions in the candidate sub-region group contains the target object.
3. The method according to claim 2, characterized in that Determining the target strip area in the non-critical area includes: Calculating the region parameters of each candidate sub-region in the non-critical region, wherein the region parameters include a region variation parameter and a region edge parameter, the region variation parameter is used to indicate the region distance between the candidate sub-region and a reference sub-region, the reference sub-region is a region in a reference image corresponding to the candidate sub-region, the reference image is an image temporally associated with the original image, and the region edge parameter is used to indicate the pixel variation degree of the edge position of the candidate sub-region; Determining, from the non-critical area, a plurality of target sub-areas adjacent to each other in the non-target axial direction according to the area parameter of each candidate sub-area; The target strip area formed by the plurality of target sub-areas that are sequentially adjacent to each other in the non-target axial direction is determined.
4. The method according to claim 3, characterized in that Determining, from the non-critical area, a plurality of target sub-areas adjacent to each other in the non-target axis according to the area parameter of each candidate sub-area comprises: Determining a candidate sub-region group from the non-critical region according to a parameter similarity threshold, wherein a parameter difference of region parameters of a plurality of candidate sub-regions in the candidate sub-region group is less than the parameter similarity threshold; The plurality of target sub-regions that are located in different axial directions from the target and are sequentially adjacent to each other in the non-target axial direction are determined in the candidate sub-region group.
5. The method according to claim 1, characterized in that The step of inserting the target strip area in the non-critical area according to the ratio difference between the target resolution ratio and the original resolution ratio to obtain the target image of the target resolution ratio comprises: The original image is divided into a first image and a second image according to the target strip area, wherein the first image at least includes a key area of the original image and the target strip area, the key area is the area where the target object is located in the original image, and the second image is a remaining image after the first image is divided from the original image; constructing an insertion image using the target strip area, wherein the insertion image includes at least one target strip area; The first image, the inserted image and the second image are sequentially spliced to obtain the target image.
6. The method according to claim 5, characterized in that The constructing the insertion image by using the target strip area comprises: Determining a construction priority of the target strip region, wherein the construction priority is associated with a degree of area change of a plurality of target sub-regions of the target strip region; Calculating a target construction quantity of the target strip area according to a ratio difference between the target resolution ratio and the original resolution ratio and the construction priority; The insertion image is constructed by splicing the target strip regions of the target construction quantity.
7. The method according to claim 6, characterized in that: When a plurality of non-critical areas are determined in the original image, sequentially determining a target strip area in each of the plurality of non-critical areas; When a plurality of target strip regions are determined from the plurality of non-critical regions, the target construction quantity of each target strip region is calculated in sequence according to the ratio difference between the target resolution ratio and the original resolution ratio and the construction priority of each target strip region; The insertion images corresponding to each target strip area are sequentially constructed according to the target construction quantity of each target strip area.
8. A device for adjusting image resolution ratio, characterized in that: include: A region determination unit is used to determine a non-key region of an original image, wherein the original image is an original resolution ratio image to be adjusted to a target resolution ratio, there is a ratio difference between the target resolution ratio and the original resolution ratio in a target axis direction, and the non-key region is a region in the original image that does not contain a target object; A stitching determination unit is used to determine a target strip area in the non-critical area, wherein the target strip area is a strip area constructed by multiple sub-areas in the non-critical area; an adjustment unit is used to insert the target strip area in the non-critical area according to the ratio difference between the target resolution ratio and the original resolution ratio to obtain a target image with the target resolution ratio.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein the program executes the method described in any one of claims 1 to 7 when executed.
10. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 7 through the computer program.
Citation Information
Patent Citations
Image transmission method, image display method and image processing device
CN107153519A
Image display method and electronic equipment
CN111223047A