CN114422694A - Preview resolution adaptation method and device and electronic equipment - Google Patents

Preview resolution adaptation method and device and electronic equipment Download PDF

Info

Publication number
CN114422694A
CN114422694A CN202210056948.3A CN202210056948A CN114422694A CN 114422694 A CN114422694 A CN 114422694A CN 202210056948 A CN202210056948 A CN 202210056948A CN 114422694 A CN114422694 A CN 114422694A
Authority
CN
China
Prior art keywords
resolution
preview
width
initial target
height
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202210056948.3A
Other languages
Chinese (zh)
Other versions
CN114422694B (en
Inventor
常前前
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Douku Software Technology Co Ltd
Original Assignee
Hangzhou Douku Software Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Douku Software Technology Co Ltd filed Critical Hangzhou Douku Software Technology Co Ltd
Priority to CN202210056948.3A priority Critical patent/CN114422694B/en
Publication of CN114422694A publication Critical patent/CN114422694A/en
Application granted granted Critical
Publication of CN114422694B publication Critical patent/CN114422694B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/63Control of cameras or camera modules by using electronic viewfinders
    • H04N23/631Graphical user interfaces [GUI] specially adapted for controlling image capture or setting capture parameters
    • H04N23/632Graphical user interfaces [GUI] specially adapted for controlling image capture or setting capture parameters for displaying or modifying preview images prior to image capturing, e.g. variety of image resolutions or capturing parameters

Landscapes

  • Engineering & Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Image Processing (AREA)

Abstract

The application relates to a preview resolution adaptation method, which comprises the following steps: acquiring a desired preview resolution and a candidate resolution set supported by equipment; obtaining an expanded preview resolution based on the desired preview resolution, the desired preview resolution being less than the expanded preview resolution; screening an initial target resolution set from the candidate resolution set based on the desired preview resolution and the enlarged preview resolution, wherein a resolution corresponding to an initial target resolution in the initial target resolution set is between the desired preview resolution and the enlarged preview resolution; determining the equipment resolution ratio corresponding to the initial target resolution in the initial target resolution set, determining the expected resolution ratio corresponding to the expected preview resolution, and screening the initial target resolution set to obtain the target preview resolution; the image is acquired through the target preview resolution, and the preview effect of the image is improved.

Description

Preview resolution adaptation method and device and electronic equipment
Technical Field
The present application relates to the field of computer technologies, and in particular, to a preview resolution adaptation method and apparatus, an electronic device, and a computer-readable storage medium.
Background
With the development of the technology in the technical field of computers, the shot picture becomes an important function of the terminal, and the terminal can display the picture shot by the camera in a preview window.
However, there is often a case where none of all the preview resolutions supported by the camera is the same as the preview window resolution of the terminal. For this case, the screen resolution is generally used as the resolution of the preview interface, and then the maximum preview resolution closest to the screen resolution is selected from all preview resolutions included in the camera.
Disclosure of Invention
The embodiment of the application provides a preview resolution adaptation method and device, electronic equipment and a computer readable storage medium, which can calculate the resolution of a camera closest to any desired resolution and adapt to a preview window of any size, so that the preview effect of an image is effectively improved.
A preview resolution adaptation method, comprising:
acquiring a desired preview resolution and a candidate resolution set supported by equipment;
obtaining an expanded preview resolution based on the desired preview resolution, the desired preview resolution being less than the expanded preview resolution;
screening an initial target resolution set from the candidate resolution set based on the desired preview resolution and the enlarged preview resolution, wherein a resolution corresponding to an initial target resolution in the initial target resolution set is between the desired preview resolution and the enlarged preview resolution;
determining a device resolution ratio corresponding to an initial target resolution in the initial target resolution set, determining an expected resolution ratio corresponding to the expected preview resolution, and screening the initial target resolution set to obtain a target preview resolution based on the device resolution ratio and the expected resolution ratio;
and acquiring an image through the target preview resolution.
A preview resolution adaptation apparatus comprising:
the acquisition module is used for acquiring a desired preview resolution and a candidate resolution set supported by the equipment;
an expansion module configured to obtain an expanded preview resolution based on the desired preview resolution, the desired preview resolution being less than the expanded preview resolution;
a first screening module, configured to screen an initial target resolution set from the candidate resolution set based on the desired preview resolution and the enlarged preview resolution, where a resolution corresponding to an initial target resolution in the initial target resolution set is between the desired preview resolution and the enlarged preview resolution;
the second screening module is used for determining a device resolution ratio corresponding to an initial target resolution in the initial target resolution set, determining an expected resolution ratio corresponding to the expected preview resolution, and screening the initial target resolution set to obtain a target preview resolution based on the device resolution ratio and the expected resolution ratio;
and the acquisition module is used for acquiring an image according to the target preview resolution.
An electronic device comprising a memory and a processor, the memory having stored therein a computer program that, when executed by the processor, causes the processor to perform the steps of:
acquiring a desired preview resolution and a candidate resolution set supported by equipment;
obtaining an expanded preview resolution based on the desired preview resolution, the desired preview resolution being less than the expanded preview resolution;
screening an initial target resolution set from the candidate resolution set based on the desired preview resolution and the enlarged preview resolution, wherein a resolution corresponding to an initial target resolution in the initial target resolution set is between the desired preview resolution and the enlarged preview resolution;
determining a device resolution ratio corresponding to an initial target resolution in the initial target resolution set, determining an expected resolution ratio corresponding to the expected preview resolution, and screening the initial target resolution set to obtain a target preview resolution based on the device resolution ratio and the expected resolution ratio;
and acquiring an image through the target preview resolution.
A computer-readable storage medium, having stored thereon a computer program which, when executed by a processor, causes the processor to perform the steps of:
acquiring a desired preview resolution and a candidate resolution set supported by equipment;
obtaining an expanded preview resolution based on the desired preview resolution, the desired preview resolution being less than the expanded preview resolution;
screening an initial target resolution set from the candidate resolution set based on the desired preview resolution and the enlarged preview resolution, wherein a resolution corresponding to an initial target resolution in the initial target resolution set is between the desired preview resolution and the enlarged preview resolution;
determining a device resolution ratio corresponding to an initial target resolution in the initial target resolution set, determining an expected resolution ratio corresponding to the expected preview resolution, and screening the initial target resolution set to obtain a target preview resolution based on the device resolution ratio and the expected resolution ratio;
and acquiring an image through the target preview resolution.
According to the preview resolution adaptation method, the preview resolution adaptation device, the electronic equipment and the computer readable storage medium, a set of candidate resolutions supported by the equipment and an expected preview resolution are obtained; obtaining an expanded preview resolution based on the desired preview resolution, the desired preview resolution being less than the expanded preview resolution; screening an initial target resolution set from the candidate resolution set based on the desired preview resolution and the enlarged preview resolution, wherein a resolution corresponding to an initial target resolution in the initial target resolution set is between the desired preview resolution and the enlarged preview resolution; determining a device resolution ratio corresponding to an initial target resolution in an initial target resolution set, determining an expected resolution ratio corresponding to an expected preview resolution, and screening the initial target resolution set to obtain a target preview resolution based on the device resolution ratio and the expected resolution ratio; the image is acquired through the target preview resolution ratio, the target preview resolution ratio is calculated to obtain the camera resolution ratio closest to any desired resolution ratio based on the enlarged preview resolution ratio and the ratio of the equipment resolution ratio to the desired resolution ratio, the risks of terminal preview jamming and violent power consumption caused by overlarge resolution ratio selection are reduced, a preview window with any size can be adapted to a user-defined preview window, the preview window is not limited to the size of the screen resolution ratio, and the preview effect of the image is effectively improved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a diagram of an application environment of a preview resolution adaptation method in one embodiment;
FIG. 2 is a flow diagram illustrating a preview resolution adaptation method in one embodiment;
FIG. 3 is a schematic diagram of an interface for displaying a target image through a preview window in one embodiment;
FIG. 4 is a flow diagram that illustrates the determination of a target preview resolution in one embodiment;
FIG. 5 is a schematic flow chart illustrating adjusting and displaying an acquired target image based on a desired preview resolution according to an embodiment;
FIG. 6 is a diagram illustrating the determination of a target preview resolution in one particular embodiment;
FIG. 7 is a block diagram of a preview resolution adaptation apparatus in one embodiment;
fig. 8 is a block diagram showing an internal configuration of an electronic device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
Fig. 1 is a diagram of an application environment of a preview resolution adaptation method in an embodiment. As shown in fig. 1, the application environment includes a terminal 110 and a server 120, and the preview resolution adaptation method may be performed by the terminal 110 or the server 120 independently, or may be performed by the terminal 110 or the server 120 in cooperation. The terminal 110 or the server 120 acquires a set of desired preview resolutions and candidate resolutions supported by the device; obtaining an expanded preview resolution based on the desired preview resolution, the desired preview resolution being less than the expanded preview resolution; screening an initial target resolution set from the candidate resolution set based on the desired preview resolution and the enlarged preview resolution, wherein a resolution corresponding to an initial target resolution in the initial target resolution set is between the desired preview resolution and the enlarged preview resolution; determining a device resolution ratio corresponding to an initial target resolution in the initial target resolution set, determining an expected resolution ratio corresponding to the expected preview resolution, and screening the initial target resolution set to obtain a target preview resolution based on the device resolution ratio and the expected resolution ratio; if the image is acquired at the terminal 110 through the target preview resolution, the image is acquired at the terminal, and if the image is acquired at the server 120, the target preview resolution is transmitted to the terminal 110 so that the terminal 110 acquires the image through the target preview resolution. The terminal 110 may be a terminal device including a mobile phone, a tablet computer, a PDA (Personal Digital Assistant), a vehicle-mounted computer, a wearable device, and the like. Where the server 120 may be a server or a cluster of servers.
When the optimal preview resolution is calculated in a conventional mode, when a value consistent with the screen resolution cannot be obtained, the maximum value in the estimated size range is obtained, the larger the resolution is, the larger the size of a preview frame captured in real time is, the higher the memory occupation is, the problems of easy preview jamming and the like are caused, and especially on some machines with poor performance, the power consumption is increased rapidly; the calculated optimal preview resolution ratio is closest to the screen resolution ratio and is not suitable for the preview window with any size, and if the difference between the user-defined preview window and the screen resolution ratio is large, the problem of obvious preview stretching can occur.
FIG. 2 is a flow diagram of a preview resolution adaptation method in one embodiment. The preview resolution adaptation method shown in fig. 2 can be applied to the terminal 110 or the server 120, and includes:
in step 202, a set of desired preview resolutions and candidate resolutions supported by the device are obtained.
The expected preview resolution is equal to the screen resolution at the moment if a full screen is used for the code scanning service, the expected preview resolution is smaller than the screen resolution at the moment for the face detection service, the face detection window can be a small-range circular or square window, the expected preview resolution is not fixed according to the preview resolution specified by an actual scene by a user and is related to an application type and a shooting scene type, wherein the application type comprises a code scanning payment type, a face recognition type and the like, and the shooting scene type comprises face shooting, article shooting, scene shooting and the like. In one embodiment, the desired preview resolution is determined according to at least one of an application type, a shooting scene type, and a shooting subject category.
Specifically, the candidate resolution set supported by the device is an attribute of hardware of the terminal camera, and the candidate resolution set supported by the terminal camera can be acquired through an operating system of the device. There are many sizes in the candidate resolution set, i.e., candidate preview resolutions. When photographing, only one resolution can be selected from the candidate resolution set, and if the resolution outside the candidate resolution set is set, photographing cannot be completed. In the candidate resolution set, a size without the resolution of the terminal screen may appear. For example, the screen resolution of the terminal is 1080 × 1980, and the aspect ratio is equal to about 1.83, but the size of 1080 × 1980 is not included in the preview resolution list, but only 1280 × 2560 is similar, and the aspect ratio is equal to 2. In one embodiment, for example, the terminal screen resolution is 1080 × 1920, the candidate resolution set { an } supported by the camera is { (540 × 960), (720 × 1080) }.
Step 204, an expanded preview resolution is obtained based on the desired preview resolution, the desired preview resolution being less than the expanded preview resolution.
The product of the desired width and the desired height is the desired preview resolution, such as 1080 × 1980, 1080 for the desired width and 1980 for the desired height.
Specifically, the expanded preview resolution is obtained based on the desired preview resolution, at least one of the desired width and the desired height may be expanded through an expansion operation to obtain the expanded preview resolution, at least one of the corresponding expanded width and the corresponding expanded height may be obtained by calculating with at least one of the desired width and the desired height as a variable through an expansion function, respectively, and the expansion operations corresponding to the obtained expanded width and the obtained expanded height may be the same or different. The dilation operation may be a linear operation or a non-linear operation based on at least one of the desired width and the desired height.
In one embodiment, the enlargement parameters may be customized by enlarging at least one of the desired width and the desired height by an enlargement parameter, such as an enlargement parameter of 1.5 for the desired width, 1.2 for the desired height, or 1.5 for both the desired width and the desired height. In one embodiment, the zoom-out parameter is related to an application type, a shooting scene type.
And step 206, screening the candidate resolution set based on the desired preview resolution and the enlarged preview resolution to obtain an initial target resolution set, wherein the resolution corresponding to the initial target resolution in the initial target resolution set is between the desired preview resolution and the enlarged preview resolution.
Specifically, traversing the candidate resolution set, and screening the candidate resolution set to obtain an initial target resolution set, wherein each initial target resolution in the initial target resolution set satisfies the following conditions: the resolution corresponding to the initial target resolution is between the desired preview resolution and the enlarged preview resolution. The resolution corresponding to the initial target resolution is between the desired preview resolution and the enlarged preview resolution meaning that the resolution corresponding to the initial target resolution may be any value greater than or equal to the desired preview resolution, less than or equal to the enlarged preview resolution.
Step 208, determining a device resolution ratio corresponding to the initial target resolution in the initial target resolution set, determining an expected resolution ratio corresponding to the expected preview resolution, and screening the initial target resolution set to obtain the target preview resolution based on the device resolution ratio and the expected resolution ratio.
The device resolution ratio refers to a ratio between a resolution width and a resolution height corresponding to the initial target resolution, and may be a ratio obtained by comparing the resolution width with the resolution height, or a ratio obtained by comparing the resolution height with the resolution width. The desired resolution ratio is a ratio between a resolution width and a resolution height corresponding to the desired preview resolution, and may be a ratio obtained by comparing the resolution width with the resolution height, or a ratio obtained by comparing the resolution height with the resolution width. It can be understood that the device resolution ratio is consistent with the desired resolution ratio in the manner used to calculate the ratio, and if the device resolution ratio is an aspect ratio, the desired resolution ratio is also an aspect ratio.
And screening the initial target resolution set based on the device resolution ratio and the expected resolution ratio to obtain the target preview resolution, wherein the screening condition is that the smaller the distance between the device resolution ratio and the expected resolution ratio, the better the distance is, and the calculation mode of the distance can be customized.
Step 210, acquiring an image at a target preview resolution.
Specifically, the camera acquires a picture according to the target preview resolution, and the target preview resolution is calculated based on the expanded width and the expanded height, and the ratio of the equipment resolution to the desired resolution, so that the camera resolution closest to any desired resolution is obtained, the risks of terminal preview jamming and power consumption surge caused by excessively large resolution selection are reduced, and a user-defined preview window with any size can be adapted, instead of limiting the preview window to the size of the screen resolution. After the image is acquired through the target preview resolution, the image can be displayed through a preview window corresponding to the desired preview resolution.
In one embodiment, the preview window can be adjusted based on the target preview resolution, so that the preview window is more adaptive to the image acquired through the target preview resolution, the optimal display effect is achieved by dynamically adjusting the layout size of the preview window, and the problem of preview stretching is avoided. As shown in fig. 3, which is a schematic diagram displayed in a preview window after an image is acquired at a target preview resolution in an embodiment, the image is matched with the preview window, and there is no problem of preview stretching.
In the preview resolution adaptation method in the embodiment, a set of desired preview resolutions and candidate resolutions supported by equipment are obtained; obtaining an expanded preview resolution based on the desired preview resolution, the desired preview resolution being less than the expanded preview resolution; screening an initial target resolution set from the candidate resolution set based on the expected preview resolution and the expanded preview resolution, wherein the resolution corresponding to the initial target resolution in the initial target resolution set is between the expected preview resolution and the expanded preview resolution; determining a device resolution ratio corresponding to an initial target resolution in an initial target resolution set, determining an expected resolution ratio corresponding to an expected preview resolution, and screening the initial target resolution set to obtain a target preview resolution based on the device resolution ratio and the expected resolution ratio; the image is acquired through the target preview resolution ratio, the target preview resolution ratio is calculated to obtain the camera resolution ratio closest to any desired resolution ratio based on the enlarged preview resolution ratio and the ratio of the equipment resolution ratio to the desired resolution ratio, the risks of terminal preview jamming and violent power consumption caused by overlarge resolution ratio selection are reduced, a preview window with any size can be adapted to a user-defined preview window, the preview window is not limited to the size of the screen resolution ratio, and the preview effect of the image is effectively improved.
In one embodiment, step 204 includes: and acquiring a desired width and a desired height corresponding to the desired preview resolution, and obtaining an expanded width and an expanded height through an expansion operation based on the desired width and the desired height.
Specifically, the expansion operation is used for expanding the desired width and the desired height, and the expansion function may be used to calculate the desired width and the desired height as variables to obtain the corresponding expansion width and expansion height, and the expansion operations corresponding to the obtained expansion width and expansion height may be the same or different. The dilation operation may be a linear operation or a non-linear operation based on the desired width and the desired height.
Step 206 comprises: and screening an initial target resolution set from the candidate resolution set based on the expected width and the expected height, wherein the resolution width corresponding to the initial target resolution in the initial target resolution set is between the expected width and the expanded width, and the resolution height corresponding to the initial target resolution is between the expected width and the expanded width.
Specifically, traversing the candidate resolution set, and screening the candidate resolution set to obtain an initial target resolution set, wherein each initial target resolution in the initial target resolution set satisfies the following conditions: the resolution width corresponding to the initial target resolution is between the desired width and the expanded width, and the resolution height corresponding to the initial target resolution is between the desired width and the expanded width. The resolution width between the desired width and the enlarged width means that the resolution width may be any value greater than or equal to the desired width and less than or equal to the enlarged width, and the resolution height between the desired width and the enlarged width means that the resolution height may be any value greater than or equal to the desired height and less than or equal to the enlarged height.
In one embodiment, each candidate in the set of candidate resolutions { an }, is assignedResolution is as follows
Figure BDA0003476705980000051
Ordering from big to small, get { Sn }, where xaiIndicates the resolution width, y, corresponding to the candidate resolutionaiThe resolution height corresponding to the candidate resolution is represented. And traversing { Sn }, and taking out all options which simultaneously meet the following two conditions:
q1*xb≥xsi≥xb
q2*yb≥ysi≥yb
wherein xbIndicates the resolution width, y, corresponding to the desired preview resolutionbIndicating the resolution height corresponding to the desired preview resolution, wherein q1, q2 indicate the magnification parameters, which may be the same or different. x is the number ofsiRepresents the resolution width, y, corresponding to each candidate resolution in SnsiThe resolution heights corresponding to the respective candidate resolutions in Sn are indicated.
In this embodiment, both the desired width and the desired height are expanded, the resolution width corresponding to the initial target resolution is between the desired width and the expanded width, and the resolution height corresponding to the initial target resolution is between the desired width and the expanded width, so that the selection of the initial target resolution strictly meets the conditions, the matching degree of the camera resolution and the preview window is further improved, and the preview effect of the image can be further improved.
In one embodiment, step 204 includes: and acquiring an expansion factor, expanding the expected width by the corresponding times through the expansion factor to obtain an expanded width, and expanding the expected height by the corresponding times through the expansion factor to obtain an expanded height. Step 206 comprises: screening an initial target resolution from a candidate resolution set, wherein the resolution width corresponding to the initial target resolution is greater than or equal to the expected width, and the resolution width corresponding to the initial target resolution is less than or equal to the expansion width; the resolution height corresponding to the initial target resolution is greater than or equal to the expected height, and the resolution height corresponding to the initial target resolution is less than or equal to the expanded height; the initial target resolutions satisfying the condition constitute an initial target resolution set.
Specifically, the expansion factor is a value for expanding the desired width and the desired width by a corresponding multiple, the size of the expansion factor can be customized, and in this embodiment, the expansion factors corresponding to the desired width and the desired width are the same, for example, 1.5. The desired width is enlarged by a corresponding factor to obtain an enlarged width, and the desired height is enlarged by the same factor to obtain an enlarged height. All options are taken that satisfy both of the following conditions:
q*xb≥xai≥xb
q*yb≥yai≥yb
wherein xbIndicates the resolution width, y, corresponding to the desired preview resolutionbRepresents the resolution height corresponding to the desired preview resolution, wherein q represents the magnification factor, xaiRepresenting the resolution width, y, corresponding to each candidate resolution in the set of candidate resolutions anaiRepresenting the resolution height corresponding to each candidate resolution in an.
In this embodiment, the desired width and the desired width can be quickly expanded only by the same expansion factor, and the resolution width corresponding to the initial target resolution is limited to be less than or equal to the expanded width; the resolution height corresponding to the initial target resolution is larger than or equal to the expected height, the resolution height corresponding to the initial target resolution is smaller than or equal to the expanded height, the initial target resolutions meeting the conditions form an initial target resolution set, so that the selected resolution can be ensured to be at least not smaller than the expected preview resolution, the selected resolution is prevented from being smaller than the actual resolution, the definition is reduced after amplification and smaller than the expanded expected preview resolution, the selected resolution is ensured not to be overlarge, and the risks of preview jam and violent power consumption caused by overlarge resolution selection are reduced.
In one embodiment, as shown in FIG. 4, step 208 includes: .
Step 208A, calculating a ratio of the resolution height to the resolution width corresponding to the initial target resolution to obtain a corresponding device resolution ratio.
Specifically, the initial target resolution set is represented as { Pm }, where m represents the total number of initial target resolutions in the initial target resolution set, and a resolution height y corresponding to the initial target resolution is calculatedpiAnd resolution width xpiRatio of
Figure BDA0003476705980000061
And obtaining the resolution ratio of the equipment.
Step 208B, calculating a ratio of the resolution height to the resolution width corresponding to the desired preview resolution to obtain a corresponding desired resolution ratio.
Specifically, a resolution height y corresponding to the desired preview resolution is calculatedbAnd resolution width xbThe ratio of (A) to (B) yields a corresponding desired resolution ratio
Figure BDA0003476705980000062
And step 208C, calculating the absolute error of the device resolution ratio and the expected resolution ratio to obtain a ratio error.
Specifically, the absolute error of the device resolution ratio from the desired resolution ratio is calculated by the following formula:
Figure BDA0003476705980000063
and step 208D, sequencing the proportional errors according to the sizes, and selecting the initial target resolution corresponding to the minimum value in the proportional errors as the target preview resolution.
Specifically, will
Figure BDA0003476705980000064
Sorting according to size, selecting initial target resolution corresponding to minimum value in proportion error as target preview resolution, in one embodiment, according to { Pm }
Figure BDA0003476705980000065
The order from small to large results in { Qm }, and the first term of { Qm }, i.e., the minimum value in the scale error, is taken to result in Q0 as the target preview resolution. In one embodiment, the preview window corresponding to the desired preview resolution is adjusted according to the target preview resolution to obtain the target preview window, so that the ratio of the target preview window is consistent with the ratio of the target preview resolution, and the effect of previewing the image is improved.
In this embodiment, by calculating the absolute error between the resolution ratio of the device and the desired resolution ratio and taking the initial target resolution corresponding to the minimum value in the ratio error as the target preview resolution, it is ensured that the obtained target preview resolution is closest to the desired resolution ratio, thereby reducing the distortion of the image ratio, avoiding the problem of preview stretching, and adapting to a preview window of any size defined by the user.
In one embodiment, as shown in fig. 5, after step 210, the method further includes:
and 310, acquiring a target image acquired through target preview resolution, and amplifying the target image based on the expected preview resolution, so that the width-height ratio of the amplified adjusted image is consistent with the expected resolution ratio corresponding to the expected preview resolution.
Specifically, when the target preview resolution is likely to be inconsistent with the desired preview resolution, if the desired preview resolution is 100 × 80, but the closest target preview resolution is 100 × 100, the target image needs to be adjusted, and the target image is enlarged based on the desired preview resolution so that the aspect ratio of the enlarged adjusted image is consistent with the desired resolution ratio corresponding to the desired preview resolution, and the specific enlargement manner is customizable so that the resolution ratio of the enlarged adjusted image also reaches the ratio of 100/80, in one embodiment, the image of 100 × 100 may be enlarged to the image of 100 × 100/80 and 100, so as to ensure that the aspect ratio is consistent with the aspect ratio corresponding to the desired preview resolution.
And 320, cutting the adjusted image based on the expected preview resolution to obtain a target display image, and displaying the target display image in a preview window corresponding to the expected preview resolution.
Specifically, when the enlarged adjustment image is displayed in the preview window corresponding to the desired preview resolution, if there is a problem that a partial edge image cannot be displayed, the image exceeding the preview window corresponding to the desired preview resolution is clipped to obtain a target display image, and the target display image is displayed only in the preview window corresponding to the desired preview resolution, and if the enlarged image is an image having a width of 100 × 100/80 and a height of 100 and the size of the preview window is 100 × 80, the center of the image may be overlapped with the center of the preview window, and the portion of the preview window that cannot be displayed may be clipped to obtain the target display image.
In this embodiment, the target image is enlarged based on the desired preview resolution, so that the width-to-height ratio of the enlarged adjusted image is consistent with the desired resolution ratio corresponding to the desired preview resolution, thereby avoiding the problem of stretching deformation when the image is displayed in a preview window, the adjusted image is cut based on the desired preview resolution to obtain the target display image, the target display image is displayed in the preview window corresponding to the desired preview resolution, the preview display compatibility is better, the target display image can be adapted to a preview window of any size, and the target display image can be adapted to a circular window for face detection and a double-shot double-preview small window.
In one embodiment, before step 202, the method further includes: acquiring the type of the current application; the desired preview resolution is determined based on the type of current application.
Specifically, the types of the current application include multiple types, such as a code scanning payment type, a face verification type, a video communication type, and the like, and the corresponding expected preview resolution is determined according to the type of the application, where if the code scanning payment type generally needs full-screen display, the expected preview resolution is equal to the screen resolution, and if the face verification type can be a window with a preset size, the expected preview resolution is smaller than the screen resolution. If a plurality of cameras exist, the expected preview resolution corresponding to each window can be determined according to the functions corresponding to the windows, different functions can correspond to different expected preview resolutions, and the matching between the preview image and the service function is achieved.
In the embodiment, the corresponding expected preview resolution is determined according to the type of the current application, so that the size of the preview window is matched with the function of the application, and the effectiveness of the application in image preview is improved.
In one embodiment, the method further comprises: the method includes the steps of obtaining different application windows which dynamically change along with time and appear in sequence, obtaining expected preview resolution matched with each application window in sequence, obtaining an application window corresponding to a current frame video image, determining target preview resolution corresponding to the current frame video image according to the method described in the embodiment based on the expected preview resolution of the application window corresponding to the current frame video image, collecting the current frame image through the target preview resolution, and displaying the current frame image on the corresponding application window.
Specifically, for an application window which dynamically changes along with time, corresponding target preview resolutions can be sequentially determined, so that an image is acquired by dynamically selecting a proper target preview resolution along with the time, the target preview resolution matched with the window can be determined even if the window dynamically changes along with the time, and the image preview effect of each different window is improved. If the code scanning payment window is displayed in the first time period, the corresponding expected preview resolution is determined to be the screen resolution, if the face recognition window is displayed in the second time period, the corresponding expected preview resolution is determined to be the preset resolution which is smaller than the screen resolution, the corresponding target preview resolution is determined based on the method, and the appropriate target preview resolution can be determined for each frame of image when the video stream is collected uninterruptedly.
In this embodiment, by dynamically changing the desired preview resolution, which is matched with each application window, with time, the corresponding target preview resolution is dynamically determined for each frame of image in the video stream, so that even if the window dynamically changes with time, the target preview resolution matched with the window can be determined, and the image preview effect of each different window is improved.
In a specific embodiment, the method can be applied to a face verification scene in a mobile phone. The following describes a preview resolution adaptation method provided by the embodiment of the present application, taking the preview resolution adaptation of a mobile phone in a face verification scene as an example, and includes the following steps, which can be combined with the schematic diagram shown in fig. 6:
1. scene determination
And acquiring the current application type, wherein the current application is a face verification application, the screen resolution of the mobile phone is 1980 x 1080, and the expected preview resolution corresponding to the face verification application is determined to be 100 x 80.
2. Acquiring a candidate resolution set supported by the equipment, and dividing each candidate resolution in { an } into
Figure BDA0003476705980000081
Sorting from big to small to obtain { Sn }
The candidate resolution set supported by the handset is { an }, which includes { (540 x 960), (720 x 1080), (100 x 120'), (100 x 100) }, according to the formula
Figure BDA0003476705980000082
The ordering from large to small results in { Sn } being { (720 × 1080), (540 × 960), (100 × 120), (100 × 100) }.
3. And acquiring a desired width and a desired height corresponding to the desired preview resolution, and obtaining an expanded width and an expanded height through an expansion operation based on the desired width and the desired height.
Specifically, an expansion factor of 1.5 is obtained, the desired width 100 corresponding to the desired preview resolution 100 × 80 is expanded by the expansion factor by a corresponding factor to obtain an expanded width 150, and the desired height 80 is expanded by the expansion factor by a corresponding factor to obtain an expanded height 120.
4. Based on the expected width and the expected height, the expanded width and the expanded height are screened from the candidate resolution set to obtain an initial target resolution set.
And traversing { Sn }, and taking out all options which simultaneously meet the following two conditions:
1.5*xb≥xsi≥xb
1.5*yb≥ysi≥yb
the initial target resolution set is denoted as { Pm }, where { Pm } is { (100 × 120), (100 × 100) }.
5. Determining a device resolution ratio corresponding to an initial target resolution in the initial target resolution set, determining a desired resolution ratio corresponding to the desired preview resolution, and screening the initial target resolution set to obtain a target preview resolution based on the device resolution ratio and the desired resolution ratio.
Specifically, the { Pm } is expressed as
Figure BDA0003476705980000083
In order from small to large, (100 × 120) corresponds to a proportional error of
Figure BDA0003476705980000084
(100 x 100) corresponds to a proportional error of
Figure BDA0003476705980000085
And sorting the proportional errors according to the sizes, and selecting the initial target resolution corresponding to the minimum value in the proportional errors as the target preview resolution, so that the selected target preview resolution is (100 x 100). As shown in FIG. 5, the desired target preview resolution xsi*xsi+ysi*ysiIs greater than or equal to (x)b*xb+yb*yb) 1.5 x (x) or lessb*xb+yb*yb) It is necessary to ensure that the selected resolution cannot be smaller than the desired preview resolution at least, and to prevent the selected resolution from being smaller than the actual resolution and the sharpness from being degraded after amplification. In the figure, Si represents each candidate resolution in the candidate resolution set { Sn }, pi represents the initial target resolution in the initial target resolution set { Pm }, and q0 represents the target preview resolution. The shaded portion of the figure represents the region where the initial target resolution set { Pm } is located.
6. And acquiring a target image acquired through target preview resolution, and amplifying the target image based on the expected preview resolution, so that the width-height ratio of the amplified adjusted image is consistent with the expected resolution ratio corresponding to the expected preview resolution.
Specifically, a target image is acquired at a target preview resolution of 100 × 100, and the target image is enlarged based on the desired preview resolution of 100 × 80 so that the resolution ratio of the enlarged adjusted image also reaches a ratio of 100/80, so that the image of 100 × 100 is enlarged to an image having a width of 100 × 100/80 and a height of 100, thereby ensuring that the aspect ratio matches the aspect ratio corresponding to the desired preview resolution, and obtaining an enlarged image of 125 × 100. The center of the 125 × 100 image is aligned with the center of the preview window, and the portion that cannot be displayed in the preview window is clipped to obtain a target display image, which is displayed in the 100 × 80 preview window.
In the embodiment, a set of desired preview resolutions and candidate resolutions supported by equipment are obtained; acquiring an expected width and an expected height corresponding to the expected preview resolution, and obtaining an expanded width and an expanded height through expansion operation based on the expected width and the expected height; screening an initial target resolution set from the candidate resolution set based on a desired width and a desired height, wherein the resolution width corresponding to the initial target resolution in the initial target resolution set is between the desired width and the enlarged width, and the resolution height corresponding to the initial target resolution is between the desired width and the enlarged width; determining a device resolution ratio corresponding to an initial target resolution in an initial target resolution set, determining an expected resolution ratio corresponding to an expected preview resolution, and screening the initial target resolution set to obtain a target preview resolution based on the device resolution ratio and the expected resolution ratio; the image is acquired through the target preview resolution ratio, the camera resolution ratio closest to any desired resolution ratio is calculated and obtained on the basis of the expanded width and the expanded height, the equipment resolution ratio and the desired resolution ratio, the risks of terminal preview jamming and violent power consumption caused by overlarge resolution ratio selection are reduced, a preview window with any size defined by users can be adapted, the preview window is not limited to the size of the screen resolution ratio, and the preview effect of the image is effectively improved. The method comprises the steps of amplifying a target image based on an expected preview resolution ratio to enable the width-height ratio of the amplified adjusted image to be consistent with the expected resolution ratio corresponding to the expected preview resolution ratio, so that the problem of stretching deformation when the image is displayed in a preview window can be solved, cutting the adjusted image based on the expected preview resolution ratio to obtain the target display image, displaying the target display image in the preview window corresponding to the expected preview resolution ratio, enabling preview display compatibility to be better, enabling the target display image to be adaptive to a user-defined preview window of any size, and enabling the target display image to be adaptive to a circular window for face detection and a double-shot simultaneous-open double-preview small window.
It should be understood that although the various steps in the flowcharts of fig. 2, 4-5 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 2, 4-5 may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, and the order of performance of the sub-steps or stages is not necessarily sequential, but may be performed in turn or alternating with other steps or at least some of the sub-steps or stages of other steps.
Fig. 7 is a block diagram illustrating a preview resolution adaptation apparatus 400 according to an embodiment. As shown in fig. 7, a preview resolution adaptation apparatus 400 includes: an obtaining module 402, an expanding module 404, a first screening module 406, a second screening module 408, and an acquiring module 410. Wherein:
an obtaining module 402, configured to obtain a set of desired preview resolutions and candidate resolutions supported by the device.
An expansion module 404 configured to derive an expanded preview resolution based on the desired preview resolution, the desired preview resolution being less than the expanded preview resolution.
A first screening module 406, configured to screen an initial target resolution set from the candidate resolution sets based on the desired preview resolution and the enlarged preview resolution, where a resolution corresponding to an initial target resolution in the initial target resolution set is between the desired preview resolution and the enlarged preview resolution.
The second screening module 408 is configured to determine a device resolution ratio corresponding to an initial target resolution in the initial target resolution set, determine a desired resolution ratio corresponding to a desired preview resolution, and screen the initial target resolution set to obtain a target preview resolution based on the device resolution ratio and the desired resolution ratio.
An acquisition module 410 for acquiring an image at a target preview resolution.
The preview resolution adaptation apparatus 400 in this embodiment obtains a set of desired preview resolutions and candidate resolutions supported by the device; obtaining an expanded preview resolution based on the desired preview resolution, the desired preview resolution being less than the expanded preview resolution; screening an initial target resolution set from the candidate resolution set based on the desired preview resolution and the enlarged preview resolution, wherein a resolution corresponding to an initial target resolution in the initial target resolution set is between the desired preview resolution and the enlarged preview resolution; determining a device resolution ratio corresponding to an initial target resolution in an initial target resolution set, determining an expected resolution ratio corresponding to an expected preview resolution, and screening the initial target resolution set to obtain a target preview resolution based on the device resolution ratio and the expected resolution ratio; the image is acquired through the target preview resolution ratio, the target preview resolution ratio is calculated to obtain the camera resolution ratio closest to any desired resolution ratio based on the enlarged preview resolution ratio and the ratio of the equipment resolution ratio to the desired resolution ratio, the risks of terminal preview jamming and violent power consumption caused by overlarge resolution ratio selection are reduced, a preview window with any size can be adapted to a user-defined preview window, the preview window is not limited to the size of the screen resolution ratio, and the preview effect of the image is effectively improved.
In one embodiment, the expanding module 404 is further configured to obtain a desired width and a desired height corresponding to the desired preview resolution, and obtain an expanded width and an expanded height based on the desired width and the desired height, wherein the desired width is smaller than the expanded width, and the desired height is smaller than the desired height;
the first filtering module 406 is further configured to filter an initial target resolution set from the candidate resolution sets based on a desired width and a desired height, where a resolution width corresponding to an initial target resolution in the initial target resolution set is between the desired width and the expanded width, and a resolution height corresponding to the initial target resolution is between the desired width and the expanded width.
In this embodiment, both the desired width and the desired height are expanded, the resolution width corresponding to the initial target resolution is between the desired width and the expanded width, and the resolution height corresponding to the initial target resolution is between the desired width and the expanded width, so that the selection of the initial target resolution strictly meets the conditions, the matching degree of the camera resolution and the preview window is further improved, and the preview effect of the image can be further improved.
In one embodiment, the expanding module 404 is further configured to obtain an expanding factor, expand the desired width by the expanding factor by a corresponding multiple to obtain an expanded width, and expand the desired height by the expanding factor by a corresponding multiple to obtain an expanded height; the first screening module is further used for screening an initial target resolution from the candidate resolution set, wherein the resolution width corresponding to the initial target resolution is greater than or equal to the expected width, and the resolution width corresponding to the initial target resolution is less than or equal to the expanded width; the resolution height corresponding to the initial target resolution is greater than or equal to the expected height, and the resolution height corresponding to the initial target resolution is less than or equal to the expanded height; the initial target resolutions satisfying the condition constitute the initial target resolution set. The preview resolution adaptation device 400 in this embodiment forms the initial target resolutions meeting the conditions into an initial target resolution set, so as to ensure that the selected resolution cannot be smaller than the desired preview resolution at least, prevent the selected resolution from being smaller than the actual resolution, reduce the definition after amplification, and be smaller than the enlarged desired preview resolution, ensure that the selected resolution is not too large, and reduce the risks of preview jamming and power consumption increase caused by too large resolution selection.
In one embodiment, the second filtering module 408 is further configured to calculate a ratio of a resolution height to a resolution width corresponding to the initial target resolution to obtain a corresponding device resolution ratio; calculating the ratio of the resolution height to the resolution width corresponding to the expected preview resolution to obtain a corresponding expected resolution ratio; calculating an absolute error of the device resolution ratio and the expected resolution ratio to obtain a ratio error; and sorting the proportional errors according to the sizes, and selecting the initial target resolution corresponding to the minimum value in the proportional errors as the target preview resolution.
In the preview resolution adaptation device 400 in this embodiment, by calculating the absolute error between the resolution ratio of the device and the desired resolution ratio and using the initial target resolution corresponding to the minimum value in the ratio errors as the target preview resolution, it is ensured that the obtained target preview resolution ratio is closest to the desired resolution ratio, thereby reducing the deformation of the image ratio, avoiding the problem of preview stretching, and adapting to the preview window of any size defined by the user.
In one embodiment, the apparatus further comprises:
an adjusting module 412, configured to obtain a target image acquired through the target preview resolution; amplifying the target image based on the expected preview resolution, so that the width-height ratio of the amplified adjustment image is consistent with the expected resolution ratio corresponding to the expected preview resolution; and cutting the adjusted image based on the expected preview resolution to obtain a target display image, and displaying the target display image in a preview window corresponding to the expected preview resolution.
In this embodiment, the target image is enlarged based on the desired preview resolution, so that the width-to-height ratio of the enlarged adjusted image is consistent with the desired resolution ratio corresponding to the desired preview resolution, thereby avoiding the problem of stretching deformation when the image is displayed in a preview window, the adjusted image is cut based on the desired preview resolution to obtain the target display image, the target display image is displayed in the preview window corresponding to the desired preview resolution, the preview display compatibility is better, the target display image can be adapted to a preview window of any size, and the target display image can be adapted to a circular window for face detection and a double-shot double-preview small window.
In one embodiment, the obtaining module 402 is further configured to obtain a type of a current application; the desired preview resolution is determined based on the type of current application.
In the embodiment, the corresponding expected preview resolution is determined according to the type of the current application, so that the size of the preview window is matched with the function of the application, and the effectiveness of the application in image preview is improved.
The modules in the preview resolution adaptation device can be implemented in whole or in part by software, hardware, and combinations thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
Fig. 8 is a schematic diagram of an internal structure of an electronic device in one embodiment. As shown in fig. 8, the electronic device includes a processor and a memory connected by a system bus. Wherein, the processor is used for providing calculation and control capability and supporting the operation of the whole electronic equipment. The memory may include a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The computer program is executable by a processor for implementing the preview resolution adaptation method provided by the above embodiments. The internal memory provides a cached execution environment for the operating system computer programs in the non-volatile storage medium. The electronic device may be a mobile phone, a server, etc.
The implementation of each module in the preview resolution adaptation apparatus provided in the embodiment of the present application may be in the form of a computer program. The computer program may be run on a terminal or a server. The program modules constituted by the computer program may be stored on the memory of the terminal or the server. The computer program, when executed by a processor, implements the preview resolution adaptation method described in embodiments of the present application.
The embodiment of the application also provides a computer readable storage medium. One or more non-transitory computer-readable storage media containing computer-executable instructions that, when executed by one or more processors, cause the processors to perform the preview resolution adaptation method described in embodiments of the present application.
A computer program product comprising instructions which, when run on a computer, cause the computer to perform the preview resolution adaptation method described in embodiments of the present application.
Any reference to memory, storage, database, or other medium used herein may include non-volatile and/or volatile memory. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM), which acts as external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms, such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), Enhanced SDRAM (ESDRAM), synchronous Link (Synchlink) DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and bus dynamic RAM (RDRAM).
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present application. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A preview resolution adaptation method, comprising:
acquiring a desired preview resolution and a candidate resolution set supported by equipment;
obtaining an expanded preview resolution based on the desired preview resolution, the desired preview resolution being less than the expanded preview resolution;
screening an initial target resolution set from the candidate resolution set based on the desired preview resolution and the enlarged preview resolution, wherein a resolution corresponding to an initial target resolution in the initial target resolution set is between the desired preview resolution and the enlarged preview resolution;
determining a device resolution ratio corresponding to an initial target resolution in the initial target resolution set, determining an expected resolution ratio corresponding to the expected preview resolution, and screening the initial target resolution set to obtain a target preview resolution based on the device resolution ratio and the expected resolution ratio;
and acquiring an image through the target preview resolution.
2. The method of claim 1, wherein deriving the expanded preview resolution based on the desired preview resolution comprises:
acquiring a desired width and a desired height corresponding to the desired preview resolution, and obtaining an expanded width and an expanded height based on the desired width and the desired height, wherein the desired width is smaller than the expanded width, and the desired height is smaller than the desired height;
the screening from the candidate resolution set based on the desired preview resolution and the enlarged preview resolution to obtain an initial target resolution set, where a resolution corresponding to an initial target resolution in the initial target resolution set between the desired preview resolution and the enlarged preview resolution includes:
and screening an initial target resolution set from the candidate resolution set based on the desired width and the desired height, wherein a resolution width corresponding to an initial target resolution in the initial target resolution set is between the desired width and the expanded width, and a resolution height corresponding to the initial target resolution is between the desired width and the expanded width.
3. The method of claim 2, wherein obtaining a desired width and a desired height corresponding to the desired preview resolution, and wherein obtaining an expanded width and an expanded height through an expansion operation based on the desired width and the desired height comprises:
acquiring an expansion factor, expanding the expected width by a corresponding multiple of the expansion factor to obtain an expanded width, and expanding the expected height by a corresponding multiple of the expansion factor to obtain an expanded height;
the screening of the expanded width and the expanded height from the candidate resolution set to obtain an initial target resolution set based on the desired width and the desired height comprises:
screening an initial target resolution from the candidate resolution set, wherein a resolution width corresponding to the initial target resolution is greater than or equal to the expected width, and a resolution width corresponding to the initial target resolution is less than or equal to the expansion width;
the resolution height corresponding to the initial target resolution is greater than or equal to the desired height, and the resolution height corresponding to the initial target resolution is less than or equal to the expanded height;
the initial target resolutions satisfying the condition constitute the initial target resolution set.
4. The method of claim 1, wherein the determining a device resolution ratio corresponding to an initial target resolution in the initial target resolution set, determining a desired resolution ratio corresponding to the desired preview resolution, and wherein screening the initial target resolution set for a target preview resolution based on the device resolution ratio and the desired resolution ratio comprises:
calculating the ratio of the resolution height to the resolution width corresponding to the initial target resolution to obtain the corresponding equipment resolution ratio;
calculating the ratio of the resolution height to the resolution width corresponding to the expected preview resolution to obtain a corresponding expected resolution ratio;
calculating an absolute error of the device resolution ratio and the expected resolution ratio to obtain a ratio error;
and sorting the proportional errors according to the sizes, and selecting the initial target resolution corresponding to the minimum value in the proportional errors as the target preview resolution.
5. The method of any of claims 1 to 4, further comprising, after the acquiring an image at the target preview resolution:
acquiring a target image acquired through the target preview resolution;
amplifying the target image based on the expected preview resolution, so that the width-height ratio of the amplified adjustment image is consistent with the expected resolution ratio corresponding to the expected preview resolution;
and cutting the adjusted image based on the expected preview resolution to obtain a target display image, and displaying the target display image in a preview window corresponding to the expected preview resolution.
6. The method of claim 1, wherein obtaining the desired preview resolution and the set of candidate resolutions supported by the device is preceded by:
acquiring the type of the current application;
a desired preview resolution is determined based on the type of the current application.
7. A preview resolution adaptation apparatus, comprising:
the acquisition module is used for acquiring a desired preview resolution and a candidate resolution set supported by the equipment;
an expansion module configured to obtain an expanded preview resolution based on the desired preview resolution, the desired preview resolution being less than the expanded preview resolution;
a first screening module, configured to screen an initial target resolution set from the candidate resolution set based on the desired preview resolution and the enlarged preview resolution, where a resolution corresponding to an initial target resolution in the initial target resolution set is between the desired preview resolution and the enlarged preview resolution;
the second screening module is used for determining a device resolution ratio corresponding to an initial target resolution in the initial target resolution set, determining an expected resolution ratio corresponding to the expected preview resolution, and screening the initial target resolution set to obtain a target preview resolution based on the device resolution ratio and the expected resolution ratio;
and the acquisition module is used for acquiring an image according to the target preview resolution.
8. The apparatus of claim 7, wherein the expanding module is further configured to obtain a desired width and a desired height corresponding to the desired preview resolution, and obtain an expanded width and an expanded height based on the desired width and the desired height, the desired width being smaller than the expanded width, and the desired height being smaller than the desired height;
the first screening module is further configured to screen an initial target resolution set from the candidate resolution sets based on the desired width and the desired height, where a resolution width corresponding to an initial target resolution in the initial target resolution set is between the desired width and the enlarged width, and a resolution height corresponding to the initial target resolution is between the desired width and the enlarged width.
9. An electronic device comprising a memory and a processor, the memory having stored therein a computer program that, when executed by the processor, causes the processor to perform the preview resolution adaptation method of any of claims 1-6.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the preview resolution adaptation method of any one of claims 1 to 6.
CN202210056948.3A 2022-01-18 2022-01-18 Preview resolution adaptation method and device and electronic equipment Active CN114422694B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210056948.3A CN114422694B (en) 2022-01-18 2022-01-18 Preview resolution adaptation method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210056948.3A CN114422694B (en) 2022-01-18 2022-01-18 Preview resolution adaptation method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN114422694A true CN114422694A (en) 2022-04-29
CN114422694B CN114422694B (en) 2024-03-26

Family

ID=81272793

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210056948.3A Active CN114422694B (en) 2022-01-18 2022-01-18 Preview resolution adaptation method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN114422694B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103546689A (en) * 2013-10-11 2014-01-29 Tcl集团股份有限公司 Resolution ratio acquiring method and device of external camera of android system
WO2016145831A1 (en) * 2015-09-08 2016-09-22 中兴通讯股份有限公司 Image acquisition method and device
CN106293589A (en) * 2016-08-31 2017-01-04 宇龙计算机通信科技(深圳)有限公司 A kind of the method for preview resolution, device and terminal are set
US20190065354A1 (en) * 2016-02-24 2019-02-28 Entit Software Llc Application content display at target screen resolutions
CN113422906A (en) * 2021-06-22 2021-09-21 平安普惠企业管理有限公司 Method and device for setting resolution, computer equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103546689A (en) * 2013-10-11 2014-01-29 Tcl集团股份有限公司 Resolution ratio acquiring method and device of external camera of android system
WO2016145831A1 (en) * 2015-09-08 2016-09-22 中兴通讯股份有限公司 Image acquisition method and device
US20190065354A1 (en) * 2016-02-24 2019-02-28 Entit Software Llc Application content display at target screen resolutions
CN106293589A (en) * 2016-08-31 2017-01-04 宇龙计算机通信科技(深圳)有限公司 A kind of the method for preview resolution, device and terminal are set
CN113422906A (en) * 2021-06-22 2021-09-21 平安普惠企业管理有限公司 Method and device for setting resolution, computer equipment and storage medium

Also Published As

Publication number Publication date
CN114422694B (en) 2024-03-26

Similar Documents

Publication Publication Date Title
US11704771B2 (en) Training super-resolution convolutional neural network model using a high-definition training image, a low-definition training image, and a mask image
US10334153B2 (en) Image preview method, apparatus and terminal
CN110675404B (en) Image processing method, image processing apparatus, storage medium, and terminal device
WO2020012756A1 (en) Stereo imaging device
US9578248B2 (en) Method for generating thumbnail image and electronic device thereof
US20060045374A1 (en) Method and apparatus for processing document image captured by camera
EP2091240A2 (en) Image display apparatus, image display method, program, and record medium
CN110661977B (en) Subject detection method and apparatus, electronic device, and computer-readable storage medium
CN109815970B (en) Method and device for identifying copied image, computer equipment and storage medium
CN112602088A (en) Method, system and computer readable medium for improving quality of low light image
CN111080571A (en) Camera shielding state detection method and device, terminal and storage medium
CN112085094B (en) Document image reproduction detection method, device, computer equipment and storage medium
CN110674932A (en) Two-stage convolutional neural network target detection network training method and device
CN112767394A (en) Image detection method, device and equipment
CN114862735A (en) Image processing method, image processing device, electronic equipment and computer readable storage medium
KR102374022B1 (en) Apparatus and method of processing images
CN112966639B (en) Vehicle detection method, device, electronic equipment and storage medium
CN114422694A (en) Preview resolution adaptation method and device and electronic equipment
US20120327486A1 (en) Method and Device of Document Scanning and Portable Electronic Device
CN105808180B (en) Picture adjusting method and system
CN112911152A (en) Preview image generation method, device, equipment and storage medium
CN114357055A (en) Display method of call interface, electronic equipment and storage medium
CN107330853B (en) Picture shooting method and device
CN112839174B (en) Method and system for generating preview image of character image of cloud mobile phone
CN110807300A (en) Image processing method and device, electronic equipment and medium

Legal Events

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