CN112911152A - Preview image generation method, device, equipment and storage medium - Google Patents

Preview image generation method, device, equipment and storage medium Download PDF

Info

Publication number
CN112911152A
CN112911152A CN202110127404.7A CN202110127404A CN112911152A CN 112911152 A CN112911152 A CN 112911152A CN 202110127404 A CN202110127404 A CN 202110127404A CN 112911152 A CN112911152 A CN 112911152A
Authority
CN
China
Prior art keywords
image
preview
side length
size
display
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110127404.7A
Other languages
Chinese (zh)
Inventor
徐龙
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Lexuebang Network Technology Co Ltd
Original Assignee
Beijing Lexuebang Network 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 Beijing Lexuebang Network Technology Co Ltd filed Critical Beijing Lexuebang Network Technology Co Ltd
Priority to CN202110127404.7A priority Critical patent/CN112911152A/en
Publication of CN112911152A publication Critical patent/CN112911152A/en
Pending legal-status Critical Current

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)
  • Editing Of Facsimile Originals (AREA)

Abstract

The application provides a preview image generation method, a device, equipment and a storage medium, wherein the method comprises the following steps: when a shooting instruction input by a user is received, acquiring a first display side length, a second display side length and a display area size of a terminal display screen; selecting a candidate set of image preview sizes from a preset size library according to the first display side length and the second display side length; judging whether a target image preview size exists in the candidate set or not; if the target image preview size does not exist in the candidate set, selecting a candidate image preview size with the maximum similarity between the adjacent preview side length proportion and the adjacent side length proportion of the display area from the candidate set; acquiring a currently acquired image to be processed; and cutting the image to be processed according to the proportional relation between the preview size of the candidate image and the size of the display area to generate a preview image of the image to be processed. The method and the device solve the problem of blurred preview images caused by mismatching of the preview size of the candidate images and the size of the image display area.

Description

Preview image generation method, device, equipment and storage medium
Technical Field
The present application relates to the field of image processing, and in particular, to a preview image generation method, apparatus, device, and storage medium.
Background
With the rapid development of electronic products, mobile phone photographing functions are more and more abundant, and functional strips such as photographing and album selection generally exist on a camera page of a mobile phone for a user to select, as shown in fig. 1, an image area seen on the mobile phone by the user is a rectangular image display area with an unfixed proportion, and when a camera is started, a picture shot by a camera needs to be presented on the image display area in real time, that is, the mobile phone needs to generate a real-time preview image in the image display area for the user to refer and adjust.
In the above process of generating the preview image, the size of the preview image and the size of the shot image need to be specified before the image is presented, in the existing scheme, a certain amount of fixed-size preview image size and shot image size (such as 1920 × 1080 and 1440 × 1080) are provided by the database for selection, but since the width-to-height ratio of the "image display area" is not fixed, it is difficult to select a perfect match from the preview image sizes provided in the database, then a problem that the preview image is stretched transversely or longitudinally occurs, such as 1440 × 1080 size of the "image display area", 1560 × 1080 size of the selected preview image, and the length of 1560 displayed in 1440 will be compressed.
Disclosure of Invention
An object of the embodiments of the present application is to provide a method, an apparatus, a device, and a storage medium for generating a preview image, so as to solve the problem of blurred preview images caused by the mismatch between the preview size of a candidate image and the size of an image display area.
A first aspect of an embodiment of the present application provides a preview image generating method, including obtaining a first display side length, a second display side length, and a display area size of a terminal display screen when receiving a shooting instruction input by a user, where the first display side length is adjacent to the second display side length; selecting a candidate set of image preview sizes from a preset size library according to the first display side length and the second display side length; judging whether a target image preview size with the same side length ratio of adjacent previews and the adjacent side length ratio of the display area exists in the candidate set; if the target image preview size does not exist in the candidate set, selecting a candidate image preview size with the maximum similarity between the adjacent preview side length proportion and the adjacent side length proportion of the display area from the candidate set; acquiring a currently acquired image to be processed according to the candidate image preview size; and cutting the image to be processed according to the proportional relation between the preview size of the candidate image and the size of the display area to generate a preview image of the image to be processed.
In an embodiment, the selecting the candidate set of image preview sizes from the preset size library according to the first display side length and the second display side length includes selecting a first set of all image preview sizes with a first preview side length equal to the first display side length from the preset size library, where the first preview side length coincides with the first display side length when displayed on the display screen; and selecting the candidate set of all image preview sizes with a second preview side length larger than or equal to the second display side length from the first set, wherein the second preview side is overlapped with the second display side direction when displayed on the display screen.
In an embodiment, the cropping the to-be-processed image according to the proportional relationship between the candidate image preview size and the display area size to generate the preview image of the to-be-processed image includes calculating a difference between a second preview side length of the candidate image preview size and a second area side length of the display area size, where the second preview side length coincides with a direction of the second area side length when displayed in the display area; calculating the difference ratio between the difference and the second preview side length; and cutting the image to be processed according to the difference ratio to generate a preview image of the image to be processed.
In an embodiment, the cutting the image to be processed according to the difference ratio to generate a preview image of the image to be processed includes cutting the image to be processed along a second image edge direction of the image to be processed according to the difference ratio, where the second image edge direction coincides with the second area edge direction when being displayed in the display area; and displaying the preview image of the image to be processed after cutting in the display area.
In an embodiment, if the target image preview size exists in the candidate set, a currently acquired image to be processed is acquired, and a preview image of the image to be processed is displayed in the display area according to the target image preview size.
A second aspect of the embodiment of the present application provides a preview image generating apparatus, including a first obtaining module, configured to obtain a first display side length, a second display side length, and a display area size of a display screen of a terminal when a shooting instruction input by a user is received, where the first display side length is adjacent to the second display side length; the first selection module is used for selecting a candidate set of image preview sizes from a preset size library according to the first display side length and the second display side length; the judging module is used for judging whether a target image preview size with the same side length ratio of adjacent previews and the display area exists in the candidate set or not; a second selection module, configured to select, from the candidate set, a candidate image preview size with a largest similarity between the adjacent preview side length ratio and the adjacent side length ratio of the display area if the target image preview size does not exist in the candidate set; the second acquisition module is used for acquiring the currently acquired image to be processed according to the preview size of the candidate image; and the cropping module is used for cropping the image to be processed according to the proportional relation between the preview size of the candidate image and the size of the display area to generate a preview image of the image to be processed.
In an embodiment, the first selecting module is further configured to select a first set of all image preview sizes having a first preview side length that is the same as the first display side length from the preset size library, where the first preview side length is overlapped with the first display side length when displayed on the display screen; and selecting the candidate set of all image preview sizes with a second preview side length larger than or equal to the second display side length from the first set, wherein the second preview side is overlapped with the second display side direction when displayed on the display screen.
In an embodiment, the cropping module is further configured to calculate a difference between a second preview side length of the candidate image preview size and a second area side length of the display area size, where the second preview side length coincides with a direction of the second area side length when displayed in the display area; calculating the difference ratio between the difference and the second preview side length; and cutting the image to be processed according to the difference ratio to generate a preview image of the image to be processed.
In an embodiment, the cropping module is further configured to crop the image to be processed along a second image side direction of the image to be processed according to the difference ratio, where the second image side is overlapped with the second area side direction when displayed in the display area; and displaying the preview image of the image to be processed after cutting in the display area.
In an embodiment, the display module is configured to, if the target image preview size exists in the candidate set, obtain a currently acquired to-be-processed image, and display a preview image of the to-be-processed image in the display area according to the target image preview size.
A third aspect of embodiments of the present application provides an electronic device, including: a memory to store a computer program; a processor configured to perform the method of the first aspect of the embodiments of the present application and any of the embodiments of the present application.
A fourth aspect of embodiments of the present application provides a non-transitory electronic device-readable storage medium, including: a program which, when run by an electronic device, causes the electronic device to perform the method of the first aspect of an embodiment of the present application and any embodiment thereof.
According to the preview image generation method, the device, the equipment and the storage medium, the selected candidate image preview size can be displayed according to the real size by dynamically adjusting the candidate image preview size, so that the problem of image stretching caused by mismatching of the candidate image preview size and the size of an image display area can be effectively avoided, and the problem of blurred preview images is solved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments of the present application will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and that those skilled in the art can also obtain other related drawings based on the drawings without inventive efforts.
FIG. 1 is a schematic diagram of an image preview in the prior art of the present application;
fig. 2 is a schematic structural diagram of an electronic device according to an embodiment of the present application;
fig. 3 is a schematic flowchart of a preview image generating method according to an embodiment of the present application;
fig. 4 is a flowchart illustrating a preview image generating method according to an embodiment of the present application;
FIG. 5 is a schematic diagram illustrating a relationship between a display screen and a virtual expansion area according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of a preview image generating apparatus according to an embodiment of the present application.
Icon: 100-an electronic device; 110-a bus; 120-a processor; 130-a memory; 500-preview image generating means; 501-a first obtaining module; 502-a first selection module; 503-a judgment module; 504-a second selection module; 505-a second acquisition module; 506-cutting the module; 507-display module.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application. In the description of the present application, the terms "first," "second," and the like are used solely to distinguish one from another and are not to be construed as indicating or implying relative importance.
Please refer to fig. 2, which is a schematic structural diagram of an electronic device 100 according to an embodiment of the present application, and includes at least one processor 120 and a memory 130, where fig. 2 illustrates an example of a processor. The processor 120 and the memory 130 are connected by a bus 110, and the memory 130 stores instructions executable by the at least one processor 120, the instructions being executed by the at least one processor 120 to cause the at least one processor 120 to perform a preview image generating method as in the embodiments described below.
In one embodiment, the Processor 120 may be a general-purpose Processor, including but not limited to a Central Processing Unit (CPU), a Network Processor (NP), etc., a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. The general purpose processor may be a microprocessor or the processor may be any conventional processor or the like, and the processor 120 is the control center of the electronic device 100 and connects the various parts of the entire electronic device 100 using various interfaces and lines. The processor 120 may implement or perform the methods, steps, and logic blocks disclosed in the embodiments of the present application.
In one embodiment, the Memory 130 may be implemented by any type of volatile or non-volatile Memory device or combination thereof, including but not limited to Random Access Memory (RAM), Read Only Memory (ROM), Static Random Access Memory (SRAM), Programmable Read-Only Memory (PROM), Erasable Read-Only Memory (EPROM), electrically Erasable Read-Only Memory (EEPROM), and the like.
In one embodiment, the electronic device 100 may also communicate with one or more external devices, such as a keyboard, a mouse, a bluetooth device, a pointing device, etc., so that the account may interact with the electronic device 100.
In an embodiment, the electronic device 100 may be a mobile phone, a tablet computer, a notebook computer, a desktop computer, or the like with a camera function.
The structure of the electronic device 100 shown in fig. 2 is merely illustrative, and the electronic device 100 may also include more or fewer components than shown in fig. 2, or have a different configuration than shown in fig. 2. The components shown in fig. 2 may be implemented in hardware, software, or a combination thereof.
Please refer to fig. 3, which is a preview image generating method according to an embodiment of the present application, and the method can be executed by the electronic device 100 shown in fig. 2 to solve the problem of the blur of the preview image caused by the mismatch between the preview size of the candidate image and the size of the image display area, and the method includes the following steps:
step 301: when a shooting instruction input by a user is received, the first display side length, the second display side length and the display area size of a terminal display screen are obtained.
In this step, first demonstration limit is adjacent with the second demonstration limit, and the terminal can be other devices such as flat board, cell-phone, and in this embodiment, the terminal is the cell-phone, and the cell-phone display screen includes two regions: a display area and a function bar area.
Taking the vertical screen direction of the mobile phone as an example, when the first display edge is the wide edge of the display screen of the mobile phone, the second display edge is the high edge of the display screen of the mobile phone, and when the first display edge is the high edge of the display screen of the mobile phone, the second display edge is the wide edge of the display screen of the mobile phone. In this embodiment, it is assumed that the first display edge is a wide edge of the display screen of the mobile phone, and the second display edge is a high edge of the display screen of the mobile phone.
Step 302: and selecting a candidate set of image preview sizes from a preset size library according to the first display side length and the second display side length.
In the step, a large number of image preview sizes with different aspect ratios are stored in a preset size library, and a candidate set of the image preview sizes is screened out from the large number of image preview sizes with different aspect ratios according to the first display side length and the second display side length.
Step 303: and judging whether a target image preview size with the same side length ratio of the adjacent preview to the adjacent side length of the display area exists in the candidate set.
In this step, the side length ratio of the adjacent previews is the ratio between the first previewing side length and the second previewing side length, for example: the first preview side length is 3 and the second preview side length is 5, then the ratio of adjacent preview side lengths is 3/5. The adjacent side length ratio of the display area is the ratio between the side length of the first area and the side length of the second area, for example: if the side length of the first region is 3 and the side length of the second region is 4, the adjacent side length ratio of the display region is 3/4, and if the target image preview size does not exist in the candidate set, the step 304 is performed; if the target image preview size exists in the candidate set, step 307 is entered.
Step 304: and selecting the candidate image preview size with the maximum similarity between the adjacent preview side length proportion and the adjacent side length proportion of the display area from the candidate set.
In this step, the similarity may be a magnitude relation of the difference between the adjacent side lengths, for example, the larger the difference between the width and height ratios of the two sizes is, the smaller the similarity is, and conversely, the smaller the difference between the width and height ratios is, the larger the similarity is. If the target image preview size does not exist in the candidate set, because the candidate set has a plurality of image preview sizes with different adjacent preview side length ratios and display areas, in order to facilitate processing, a candidate image preview size with the smallest difference between the adjacent preview side length ratio and the display area adjacent side length ratio needs to be selected from the candidate set.
In one embodiment, the adjacent side length ratio of the display area is 3: and 4, the candidate set comprises three candidate image preview sizes, and the adjacent preview side length ratios of the three candidate image preview sizes are respectively 3: 5,3: 6,3: 7, wherein 3: 5 and 3: 4, the adjacent preview side length ratio is 3: the image preview size of 5 is a candidate image preview size.
Step 305: and acquiring the currently acquired image to be processed according to the preview size of the candidate image.
In the step, the side length ratio of the adjacent preview of the preview size of the candidate image is taken as a reference, and the image to be processed with the minimum difference between the side length ratio of the adjacent image and the side length ratio of the adjacent preview of the preview size of the candidate image is acquired.
Step 306: and cutting the image to be processed according to the proportional relation between the preview size of the candidate image and the size of the display area to generate a preview image of the image to be processed.
In this step, in order to ensure that the preview image can be normally displayed and reduce image stretching, the image to be processed may be cropped according to the proportional relationship between the preview size of the candidate image and the size of the display area, and the cropped image of the image to be processed has the adjacent side length ratio equal to the adjacent side length ratio of the display area, so that the image can be normally displayed and the problems of image deformation and the like caused by image stretching are avoided.
Step 307: and acquiring the currently acquired image to be processed, and displaying a preview image of the image to be processed in the display area according to the target image preview size.
In this step, if the target image preview size exists in the candidate set, the image to be processed may be scaled in an equal ratio without being clipped, and may be adaptively displayed in a display area.
According to the preview image generation method, the selected candidate image preview size can be displayed according to the real size by dynamically adjusting the candidate image preview size, so that the problem of image stretching caused by mismatching of the candidate image preview size and the size of the image display area can be effectively avoided, and the problem of blurred preview images is solved. The method can be widely applied to photographing and picture preview scenes of a photographic lamp, and can also be applied to picture recognition scenes, such as scenes of correct and incorrect mouth calculation of children in photographing and recognition.
Please refer to fig. 4, which is a preview image generating method according to an embodiment of the present application, and the method can be executed by the electronic device 100 shown in fig. 2 to achieve the solution of the problem of the blur of the preview image caused by the mismatch between the preview size of the candidate image and the size of the image display area, and the method includes the following steps:
step 401: when a shooting instruction input by a user is received, the first display side length, the second display side length and the display area size of a terminal display screen are obtained. See the description of step 301 in the above embodiments for details.
Step 402: and selecting a first set of all image preview sizes with the first preview side length being the same as the first display side length from a preset size library.
In this step, taking the vertical screen direction of the mobile phone as an example, assuming that the first display edge is the wide edge of the display screen of the mobile phone, the second display edge is the high edge of the display screen of the mobile phone, and the first preview edge is overlapped with the wide edge direction of the display screen when displayed on the display screen.
In the prior art, when the adjacent preview side length ratio of the image preview size is correctly selected, but the pixel difference between the image preview size and the display area is too large, if the size of the display area is 1440 x 1080 and the size of the selected preview image is 720 x 540, the width and the height ratio of the two are the same, but the pixel difference is too large to be visually represented, and the problem of the preview image blurring appears.
Step 403: and selecting the candidate set of all image preview sizes with the second preview side length larger than or equal to the second display side length from the first set.
In this step, taking the vertical screen direction of the mobile phone as an example, when the second preview side is displayed on the display screen, the second preview side is overlapped with the high side direction of the display screen, and on the basis of step 402, the candidate set of all image preview sizes of which the second preview side length is greater than or equal to the high side of the display screen is further selected from the first set.
Step 404: and judging whether a target image preview size with the same side length ratio of the adjacent preview to the adjacent side length of the display area exists in the candidate set. If yes, go to step 410, otherwise go to step 405. See the description of step 303 in the above embodiments for details.
Step 405: and selecting the candidate image preview size with the maximum similarity between the adjacent preview side length proportion and the adjacent side length proportion of the display area from the candidate set. See the description of step 304 in the above embodiments for details.
Step 406: and acquiring the currently acquired image to be processed according to the preview size of the candidate image. See the description of step 305 in the above embodiments for details.
Step 407: a difference between a second preview side length of the candidate image preview size and a second region side length of the display region size is calculated.
In the step, the candidate image preview size comprises a first preview side length and a second preview side length, the display area size comprises a first area side length and a second area side length, and the first preview side is overlapped with the first area side direction when being displayed on the display screen; when the second preview side is displayed on the display screen, the second preview side is overlapped with the side direction of the second area, taking the vertical screen direction of the mobile phone as an example, namely the second preview side is a preview high side, and the difference value of the preview size of the candidate image and the size of the display area in the high side direction is calculated.
In this step, the preview high side size is larger than the high side size of the display area, as can be seen from step 403.
In this step, as shown in fig. 5, taking the vertical screen direction of the mobile phone as an example, assuming that the first display edge is the wide edge of the display screen of the mobile phone, and the second display edge is the high edge of the display screen of the mobile phone, the calculation process of the difference value is as follows: firstly, a virtual extension area is set above a high edge of a display area, when the preview size of a candidate image is matched with the size of the display area, the preview wide edge of the preview size of the candidate image is equal to the wide edge of the display area, and the preview high edge of the preview wide edge is larger than the high edge of the display area, so that the high edge of the display area needs to be extended along the high edge direction virtual extension area until the length of the high edge of the extended virtual display area is equal to the length of the preview high edge of the preview size of the candidate image, and the difference value between the length of the preview high edge and the length of the high edge of the display area in the extension process is recorded. It should be noted that the expansion described in this step does not substantially expand the display area, but obtains the difference between the preview high side length and the high side length of the display area through virtual expansion.
Step 408: and calculating the difference ratio between the difference and the second preview side length.
In this step, the difference ratio may be: difference/second preview side length. For example: if the high side of the candidate image preview size is 5 and the high side of the display area size is 4, the difference between the candidate image preview size and the display area size in the high side direction is 1, and the difference ratio is 1/5.
Step 409: and cutting the image to be processed according to the difference ratio to generate a preview image of the image to be processed.
In this step, taking the vertical screen direction of the mobile phone as an example, assuming that the first display edge is the wide edge of the mobile phone display screen, the second display edge is the high edge of the mobile phone display screen, and the preview wide edge is equal to the wide edge of the display area, in the trimming process, the image to be processed does not need to be trimmed in the wide edge direction, but the trimming is directly performed along the high edge of the image to be processed according to the difference ratio calculated in step 408.
In one embodiment, step 409 specifically includes: and according to the difference ratio, cutting the image to be processed along the second image side direction of the image to be processed, wherein the second image side is overlapped with the second area side direction when being displayed in the display area, and finally displaying the preview image after cutting the image to be processed in the display area. Taking the vertical screen direction of the mobile phone as an example, the second image edge is the high edge of the image to be processed, and when the clipping region is selected, the corresponding region at the top of the image can be clipped according to the difference ratio along the high edge direction of the image to be processed, or the corresponding position at the bottom of the image can be clipped.
Step 410: and acquiring the currently acquired image to be processed, and displaying a preview image of the image to be processed in the display area according to the target image preview size. See the description of step 307 in the above embodiments for details.
Please refer to fig. 6, which is a preview image generating apparatus 500 according to an embodiment of the present application, and the apparatus can be applied to the electronic device shown in fig. 2 to solve the problem of the blur of the preview image caused by the mismatch between the preview size of the candidate image and the size of the image display area. The device includes: the system comprises a first obtaining module 501, a first selecting module 502, a judging module 503, a second selecting module 504, a second obtaining module 505, a cutting module 506 and a display module 507, wherein the principle relationship of the modules is as follows:
a first obtaining module 501, configured to obtain a first display side length, a second display side length, and a display area size of a terminal display screen when a shooting instruction input by a user is received, refer to the description of step 301 in the foregoing embodiment in detail.
A first selecting module 502, configured to select a candidate set of image preview sizes from a preset size library according to the first display side length and the second display side length, as described in detail in the foregoing embodiment for step 302.
In an embodiment, the first selecting module 502 is configured to select a first set of all image preview sizes with a first preview side length equal to a first display side length from a preset size library, where the first preview side length coincides with the first display side length when displayed on the display screen. And selecting the candidate set of all image preview sizes with the second preview side length being greater than or equal to the second display side length from the first set, wherein the second preview side is overlapped with the second display side direction when being displayed on the display screen. See the description of steps 402 to 403 in the above embodiments for details.
The determining module 503 is configured to determine whether there is a target image preview size in the candidate set, where the adjacent preview side length ratio is the same as the adjacent side length ratio of the display area, for details, refer to the description of step 303 in the foregoing embodiment.
A second selecting module 504, configured to select, if the target image preview size does not exist in the candidate set, a candidate image preview size with the largest similarity between the adjacent preview side length ratio and the adjacent side length ratio of the display area from the candidate set, which is described in detail in the foregoing embodiment with reference to step 304.
A second obtaining module 505, configured to obtain a currently acquired to-be-processed image according to the preview size of the candidate image, which is described in detail in the foregoing embodiment with reference to step 305.
And a cropping module 506, configured to crop the to-be-processed image according to a proportional relationship between the candidate image preview size and the display area size, so as to generate a preview image of the to-be-processed image. See the description of step 306 in the above embodiments for details.
In an embodiment, the cropping module 506 is configured to calculate a difference between a second preview side length of the candidate image preview size and a second region side length of the display region size, where the second preview side length coincides with a direction of the second region side length when displayed in the display region. And calculating the difference ratio between the difference and the second preview side length. And cutting the image to be processed according to the difference ratio to generate a preview image of the image to be processed.
In one embodiment, the cropping module 506 is configured to crop the image to be processed along a second image edge direction of the image to be processed according to the difference ratio, wherein the second image edge is overlapped with the second area edge direction when being displayed in the display area; and displaying the preview image of the cut image to be processed in the display area. See the description of step 409 in the above embodiments for details.
The display module 507 is configured to, if a target image preview size exists in the candidate set, acquire a currently acquired image to be processed, and display a preview image of the image to be processed in the display area according to the target image preview size. See the description of step 307 in the above embodiments for details.
An embodiment of the present invention further provides a storage medium readable by an electronic device, including: a program that, when run on an electronic device, causes the electronic device to perform all or part of the procedures of the methods in the above-described embodiments. The storage medium may be a magnetic Disk, an optical Disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a Flash Memory (Flash Memory), a Hard Disk (Hard Disk Drive, abbreviated as HDD), a Solid State Drive (SSD), or the like. The storage medium may also comprise a combination of memories of the kind described above.
In the embodiments provided in the present application, the disclosed apparatus and method can be implemented in other ways. The apparatus embodiments described above are merely illustrative, and for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s).
In some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. The above description is only a preferred embodiment of the present application, and is only for the purpose of illustrating the technical solutions of the present application, and not for the purpose of limiting the present application. Any modification, equivalent replacement, improvement or the like, which would be obvious to one of ordinary skill in the art and would be within the spirit and principle of the present application, should be included within the scope of the present application.

Claims (10)

1. A preview image generating method, comprising:
when a shooting instruction input by a user is received, acquiring a first display side length, a second display side length and a display area size of a terminal display screen, wherein the first display side is adjacent to the second display side;
selecting a candidate set of image preview sizes from a preset size library according to the first display side length and the second display side length;
judging whether a target image preview size with the same side length ratio of adjacent previews and the adjacent side length ratio of the display area exists in the candidate set;
if the target image preview size does not exist in the candidate set, selecting a candidate image preview size with the maximum similarity between the adjacent preview side length proportion and the adjacent side length proportion of the display area from the candidate set;
acquiring a currently acquired image to be processed according to the candidate image preview size;
and cutting the image to be processed according to the proportional relation between the preview size of the candidate image and the size of the display area to generate a preview image of the image to be processed.
2. The method of claim 1, wherein selecting the candidate set of image preview sizes from a library of preset sizes based on the first display side length and the second display side length comprises:
selecting a first set of all image preview sizes with a first preview side length identical to the first display side length from the preset size library, wherein the first preview side length is overlapped with the first display side direction when displayed on the display screen;
and selecting the candidate set of all image preview sizes with a second preview side length larger than or equal to the second display side length from the first set, wherein the second preview side is overlapped with the second display side direction when displayed on the display screen.
3. The method according to claim 2, wherein the cropping the image to be processed according to the proportional relationship between the candidate image preview size and the display area size to generate the preview image of the image to be processed comprises:
calculating a difference value between a second preview side length of the candidate image preview size and a second region side length of the display region size, wherein the second preview side is overlapped with the second region side direction when being displayed in the display region;
calculating the difference ratio between the difference and the second preview side length;
and cutting the image to be processed according to the difference ratio to generate a preview image of the image to be processed.
4. The method of claim 3, wherein the cropping the image to be processed according to the difference ratio to generate a preview image of the image to be processed comprises:
according to the difference ratio, cutting the image to be processed along the second image side direction of the image to be processed, wherein the second image side is overlapped with the second area side direction when being displayed in the display area;
and displaying the preview image of the image to be processed after cutting in the display area.
5. The method of claim 1, further comprising:
and if the target image preview size exists in the candidate set, acquiring a currently acquired image to be processed, and displaying a preview image of the image to be processed in the display area according to the target image preview size.
6. A preview image generating apparatus, comprising:
the terminal comprises a first acquisition module, a second acquisition module and a display module, wherein the first acquisition module is used for acquiring a first display side length, a second display side length and a display area size of a terminal display screen when a shooting instruction input by a user is received, and the first display side length is adjacent to the second display side length;
the first selection module is used for selecting a candidate set of image preview sizes from a preset size library according to the first display side length and the second display side length;
the judging module is used for judging whether a target image preview size with the same side length ratio of adjacent previews and the display area exists in the candidate set or not;
a second selection module, configured to select, from the candidate set, a candidate image preview size with a largest similarity between the adjacent preview side length ratio and the adjacent side length ratio of the display area if the target image preview size does not exist in the candidate set;
the second acquisition module is used for acquiring the currently acquired image to be processed according to the preview size of the candidate image;
and the cropping module is used for cropping the image to be processed according to the proportional relation between the preview size of the candidate image and the size of the display area to generate a preview image of the image to be processed.
7. The apparatus of claim 6, wherein the first selection module is further configured to:
selecting a first set of all image preview sizes with a first preview side length identical to the first display side length from the preset size library, wherein the first preview side length is overlapped with the first display side direction when displayed on the display screen;
and selecting the candidate set of all image preview sizes with a second preview side length larger than or equal to the second display side length from the first set, wherein the second preview side is overlapped with the second display side direction when displayed on the display screen.
8. The apparatus of claim 7, wherein the cutting module is further configured to:
calculating a difference value between a second preview side length of the candidate image preview size and a second region side length of the display region size, wherein the second preview side is overlapped with the second region side direction when being displayed in the display region;
calculating the difference ratio between the difference and the second preview side length;
and cutting the image to be processed according to the difference ratio to generate a preview image of the image to be processed.
9. An electronic device, comprising:
a memory to store a computer program;
a processor to perform the method of any one of claims 1 to 5.
10. A non-transitory electronic device readable storage medium, comprising: program which, when run by an electronic device, causes the electronic device to perform the method of any one of claims 1 to 5.
CN202110127404.7A 2021-01-29 2021-01-29 Preview image generation method, device, equipment and storage medium Pending CN112911152A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110127404.7A CN112911152A (en) 2021-01-29 2021-01-29 Preview image generation method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110127404.7A CN112911152A (en) 2021-01-29 2021-01-29 Preview image generation method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112911152A true CN112911152A (en) 2021-06-04

Family

ID=76121280

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110127404.7A Pending CN112911152A (en) 2021-01-29 2021-01-29 Preview image generation method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112911152A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113422906A (en) * 2021-06-22 2021-09-21 平安普惠企业管理有限公司 Method and device for setting resolution, computer equipment and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103888670A (en) * 2014-02-21 2014-06-25 联想(北京)有限公司 Information processing method and electronic device
US9100588B1 (en) * 2012-02-28 2015-08-04 Bruce A. Seymour Composite image formatting for real-time image processing
CN106657761A (en) * 2016-09-29 2017-05-10 乐视控股(北京)有限公司 Picture shooting method and device for intelligent terminal
CN110765799A (en) * 2019-10-21 2020-02-07 高新兴科技集团股份有限公司 Client code scanning identification method, device, equipment and storage medium
CN110830716A (en) * 2019-11-08 2020-02-21 苏宁金融科技(南京)有限公司 Image generation method and device, computer equipment and storage medium
CN111345026A (en) * 2018-08-27 2020-06-26 深圳市大疆创新科技有限公司 Image processing and presentation
CN112511745A (en) * 2020-11-26 2021-03-16 珠海格力电器股份有限公司 Image acquisition method, device, equipment and medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9100588B1 (en) * 2012-02-28 2015-08-04 Bruce A. Seymour Composite image formatting for real-time image processing
CN103888670A (en) * 2014-02-21 2014-06-25 联想(北京)有限公司 Information processing method and electronic device
CN106657761A (en) * 2016-09-29 2017-05-10 乐视控股(北京)有限公司 Picture shooting method and device for intelligent terminal
CN111345026A (en) * 2018-08-27 2020-06-26 深圳市大疆创新科技有限公司 Image processing and presentation
CN110765799A (en) * 2019-10-21 2020-02-07 高新兴科技集团股份有限公司 Client code scanning identification method, device, equipment and storage medium
CN110830716A (en) * 2019-11-08 2020-02-21 苏宁金融科技(南京)有限公司 Image generation method and device, computer equipment and storage medium
CN112511745A (en) * 2020-11-26 2021-03-16 珠海格力电器股份有限公司 Image acquisition method, device, equipment and medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113422906A (en) * 2021-06-22 2021-09-21 平安普惠企业管理有限公司 Method and device for setting resolution, computer equipment and storage medium

Similar Documents

Publication Publication Date Title
KR101990089B1 (en) Method for creating for thumbnail and image an electronic device thereof
JP4782105B2 (en) Image processing apparatus and image processing method
US8184928B2 (en) Combining seam carving an image resizing
US8213745B2 (en) Seam carving for image resizing
US10317777B2 (en) Automatic zooming method and apparatus
CN107403409B (en) Image processing method and device before image splicing and image splicing method and device
CN104754223A (en) Method for generating thumbnail and shooting terminal
CN109561257B (en) Picture focusing method, device, terminal and corresponding storage medium
CN112954193B (en) Shooting method, shooting device, electronic equipment and medium
CN110765799B (en) Client code scanning identification method, device, equipment and storage medium
KR20230058458A (en) Picture processing method and apparatus, device and storage medium
EP2237228A2 (en) Combination of videos from multiple cameras
CN110443772B (en) Picture processing method and device, computer equipment and storage medium
CN114119373A (en) Image cropping method and device and electronic equipment
CN107330849B (en) Panoramic image splicing method, device, equipment and storage medium
US10573277B2 (en) Display device, display system, and non-transitory recording medium, to adjust position of second image in accordance with adjusted zoom ratio of first image
CN111201773A (en) Photographing method and device, mobile terminal and computer readable storage medium
CN112911152A (en) Preview image generation method, device, equipment and storage medium
CN105827987B (en) A kind of picture shooting method and mobile terminal
CN111127458A (en) Target detection method and device based on image pyramid and storage medium
CN113052763B (en) Fusion image generation method and device, computer equipment and storage medium
WO2022033088A1 (en) Image processing method, apparatus, electronic device, and computer-readable medium
US20140016914A1 (en) Editing apparatus, editing method, program and storage medium
CN111147694B (en) Photographing method, photographing apparatus, terminal device, and computer-readable storage medium
CN111179166B (en) Image processing method, device, equipment and computer readable storage 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
RJ01 Rejection of invention patent application after publication

Application publication date: 20210604

RJ01 Rejection of invention patent application after publication