[go: up one dir, main page]

CN112308074A - Method and device for generating thumbnail - Google Patents

Method and device for generating thumbnail Download PDF

Info

Publication number
CN112308074A
CN112308074A CN202010022114.1A CN202010022114A CN112308074A CN 112308074 A CN112308074 A CN 112308074A CN 202010022114 A CN202010022114 A CN 202010022114A CN 112308074 A CN112308074 A CN 112308074A
Authority
CN
China
Prior art keywords
sub
image
images
split
preset
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010022114.1A
Other languages
Chinese (zh)
Other versions
CN112308074B (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.)
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information 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 Jingdong Century Trading Co Ltd, Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN202010022114.1A priority Critical patent/CN112308074B/en
Publication of CN112308074A publication Critical patent/CN112308074A/en
Application granted granted Critical
Publication of CN112308074B publication Critical patent/CN112308074B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/26Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion
    • G06V10/267Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion by performing operations on regions, e.g. growing, shrinking or watersheds
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/50Information retrieval; Database structures therefor; File system structures therefor of still image data
    • G06F16/51Indexing; Data structures therefor; Storage structures
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Software Systems (AREA)
  • Processing Or Creating Images (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The embodiment of the disclosure discloses a method and a device for generating a thumbnail. One embodiment of the method comprises: acquiring an image; determining a splitting quantity set corresponding to the image; selecting the minimum value from the split number set as a target split number, and executing the following processing steps: splitting the image into a target split number of sub-images to obtain a sub-image set; determining whether the number of sub-images in the sub-image set meeting the preset condition is smaller than a preset number threshold value; in response to the fact that the number of the sub-images meeting the preset condition in the sub-image set is not smaller than the preset number threshold, selecting a number threshold number of sub-images from the sub-images meeting the preset condition in the sub-image set; and respectively generating thumbnail images of the images by using the selected subgraphs. The embodiment can effectively generate a certain number of thumbnails meeting the preset conditions.

Description

Method and device for generating thumbnail
Technical Field
The embodiment of the disclosure relates to the technical field of computers, in particular to a method and a device for generating a thumbnail.
Background
At present, more and more terminal applications display various information to users in an information flow form, and specific display methods of the information flow are also various. For example, a list page may be presented to a user first, and the user may browse a detail page of the clicked information by clicking on the information in the list page. The list page can display partial content of each piece of information in a list item mode and the like, and more content of the information can be displayed on the detail page.
Generally, in order to make the user more intuitively understand the displayed information, the text description information and several matched thumbnails are commonly used for displaying the information for each information. Of course, the user can view the corresponding original image by clicking the thumbnail and the like. For example, a textual description of an item and thumbnails of several images of the item may be presented to a user simultaneously, so that the user may learn about the item's relevant information from a number of aspects.
In some cases, the number of thumbnails for which the information matches may be fewer or no matching thumbnails at all. At this time, usually only a few thumbnails or only textual description information can be presented to the user.
Disclosure of Invention
The embodiment of the disclosure provides a method and a device for generating a thumbnail.
In a first aspect, an embodiment of the present disclosure provides a method for generating a thumbnail, the method including: acquiring an image; determining a splitting quantity set corresponding to the image; selecting the minimum value from the split number set as a target split number, and executing the following processing steps: splitting the image into a target split number of sub-images to obtain a sub-image set; determining whether the number of sub-images in the sub-image set meeting the preset condition is smaller than a preset number threshold value; in response to the fact that the number of the sub-images meeting the preset condition in the sub-image set is not smaller than the preset number threshold, selecting a number threshold number of sub-images from the sub-images meeting the preset condition in the sub-image set; and respectively generating thumbnail images of the images by using the selected subgraphs.
In some embodiments, the processing step further comprises: in response to the fact that the number of the sub-images which meet the preset conditions in the sub-image set is smaller than the preset number threshold, determining whether the number of the unselected split numbers in the split number set is zero or not; and in response to determining that the number of the unselected split numbers in the split number set is not zero, reselecting the minimum value from the unselected split numbers in the split number set, and continuing to execute the processing steps by using the reselected minimum value as the target split number.
In some embodiments, the processing step further comprises: in response to determining that the number of the unselected split numbers in the split number set is zero, splitting the image to obtain a number threshold number of sub-images, and generating thumbnails of the image by using the obtained sub-images respectively.
In some embodiments, after splitting the image into the target split number of sub-images, obtaining a sub-image set, the method further includes: respectively carrying out image recognition on each subgraph in the subgraph set to obtain a recognition result of each subgraph; and determining whether the number of sub-images in the sub-image set meeting the preset condition is less than a preset number threshold, including: and determining whether the number of the sub-images of which the corresponding recognition results meet the preset conditions in the sub-image set is smaller than a preset number threshold.
In some embodiments, splitting the image into a target split number of subgraphs comprises: and equally dividing the image into a target division number of sub-images.
In some embodiments, determining a set of split numbers for an image comprises: and determining a splitting quantity set corresponding to the image according to the size information of the image.
In some embodiments, the above method further comprises: acquiring description information of an image; and displaying the thumbnail of the image and the description information, wherein the description information is presented as the context of the thumbnail of the image.
In a second aspect, an embodiment of the present disclosure provides an apparatus for generating a thumbnail, the apparatus including: an acquisition unit configured to acquire an image; a determining unit configured to determine a split number set corresponding to the image; a processing unit configured to select a minimum value from the split number set as a target split number, and to perform the following processing steps: splitting the image into a target split number of sub-images to obtain a sub-image set; determining whether the number of sub-images in the sub-image set meeting the preset condition is smaller than a preset number threshold value; in response to the fact that the number of the sub-images meeting the preset condition in the sub-image set is not smaller than the preset number threshold, selecting a number threshold number of sub-images from the sub-images meeting the preset condition in the sub-image set; and respectively generating thumbnail images of the images by using the selected subgraphs.
In some embodiments, the processing step further comprises: in response to the fact that the number of the sub-images which meet the preset conditions in the sub-image set is smaller than the preset number threshold, determining whether the number of the unselected split numbers in the split number set is zero or not; and in response to determining that the number of the unselected split numbers in the split number set is not zero, reselecting the minimum value from the unselected split numbers in the split number set, and continuing to execute the processing steps by using the reselected minimum value as the target split number.
In some embodiments, the processing step further comprises: in response to determining that the number of the unselected split numbers in the split number set is zero, splitting the image to obtain a number threshold number of sub-images, and generating thumbnails of the image by using the obtained sub-images respectively.
In some embodiments, the processing unit is further configured to perform image recognition on each sub-image in the sub-image set, so as to obtain a recognition result of each sub-image; and determining whether the number of the sub-images of which the corresponding recognition results meet the preset conditions in the sub-image set is smaller than a preset number threshold.
In some embodiments, the processing unit is further configured to split the image aliquot into a target split number of subgraphs.
In some embodiments, the processing unit is further configured to determine a set of splitting numbers corresponding to the images according to the size information of the images.
In some embodiments, the above-mentioned acquiring unit is further configured to acquire descriptive information of the image; the above-mentioned device still includes: the display unit is configured to display the thumbnail of the image and the description information, wherein the description information is presented as the context of the thumbnail of the image.
In a third aspect, an embodiment of the present disclosure provides a server, including: one or more processors; storage means for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the method as described in any implementation of the first aspect.
In a fourth aspect, embodiments of the present disclosure provide a computer-readable medium on which a computer program is stored, which computer program, when executed by a processor, implements the method as described in any of the implementations of the first aspect.
According to the method and the device for generating the thumbnail, the image is split according to a certain split number, and then whether the number of the sub-images which are obtained through splitting and meet the preset condition reaches the preset number threshold value or not is judged. And if so, selecting a threshold number of sub-images from the sub-images which are obtained by splitting and meet the preset conditions to respectively generate corresponding thumbnails. If not, splitting the image again to obtain more sub-images than the sub-images split at the previous time, similarly judging whether the number of the sub-images which are obtained by splitting at this time and meet the preset conditions reaches a preset number threshold value, and continuing processing according to the judgment result. If the number of the sub-images which are not less than the number threshold and meet the preset condition cannot be obtained by splitting the image according to each split number, the original image can be directly split into the number threshold of the sub-images to generate corresponding thumbnails.
Drawings
Other features, objects and advantages of the disclosure will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings in which:
FIG. 1 is an exemplary system architecture diagram in which one embodiment of the present disclosure may be applied;
FIG. 2 is a flow diagram of one embodiment of a method for generating thumbnails in accordance with the present disclosure;
FIG. 3 is a schematic diagram of one application scenario of a method for generating thumbnails in accordance with an embodiment of the present disclosure;
FIG. 4 is a flow diagram of yet another embodiment of a method for generating thumbnails in accordance with the present disclosure;
FIG. 5 is a schematic diagram illustrating the structure of one embodiment of an apparatus for generating thumbnails according to the present disclosure;
FIG. 6 is a schematic structural diagram of an electronic device suitable for use in implementing embodiments of the present disclosure.
Detailed Description
The present disclosure is described in further detail below with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant invention and not restrictive of the invention. It should be noted that, for convenience of description, only the portions related to the related invention are shown in the drawings.
It should be noted that, in the present disclosure, the embodiments and features of the embodiments may be combined with each other without conflict. The present disclosure will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
Fig. 1 illustrates an exemplary architecture 100 to which embodiments of the method for generating thumbnails or the apparatus for generating thumbnails of the present disclosure may be applied.
As shown in fig. 1, the system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The terminal devices 101, 102, 103 interact with a server 105 via a network 104 to receive or send messages or the like. Various client applications may be installed on the terminal devices 101, 102, 103. Such as browser-like applications, social platform software, shopping-like applications, news-like applications, image-like applications, and the like.
The terminal apparatuses 101, 102, and 103 may be hardware or software. When the terminal devices 101, 102, 103 are hardware, they may be various electronic devices including, but not limited to, smart phones, tablet computers, e-book readers, laptop portable computers, desktop computers, and the like. When the terminal apparatuses 101, 102, 103 are software, they can be installed in the electronic apparatuses listed above. It may be implemented as multiple pieces of software or software modules (e.g., multiple pieces of software or software modules to provide distributed services) or as a single piece of software or software module. And is not particularly limited herein.
The server 105 may be a server providing various services, such as a backend server providing backend support for the terminal devices 101, 102, 103. The server 105 may generate a thumbnail of the image and then transmit the thumbnail to the terminal device for presentation.
It should be noted that the method for generating the thumbnail provided by the embodiment of the present disclosure is generally performed by the server 105, and accordingly, the apparatus for generating the thumbnail is generally disposed in the server 105.
It should be noted that the terminal devices 101, 102, and 103 may also have image processing applications installed therein, and the terminal devices 101, 102, and 103 may also process images based on the image processing applications, in which case, the method for generating thumbnails may also be executed by the terminal devices 101, 102, and 103, and accordingly, the device 105 and the network 104. The means for generating the thumbnail may also be provided in the terminal devices 101, 102, 103. At this point, the exemplary system architecture 100 may not have a server 105.
The server 105 may be hardware or software. When the server 105 is hardware, it may be implemented as a distributed server cluster composed of a plurality of servers, or may be implemented as a single server. When the server 105 is software, it may be implemented as multiple pieces of software or software modules (e.g., multiple pieces of software or software modules used to provide distributed services), or as a single piece of software or software module. And is not particularly limited herein.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
With continued reference to FIG. 2, a flow 200 of one embodiment of a method for generating thumbnails in accordance with the present disclosure is shown. The method for generating the thumbnail includes the steps of:
step 201, acquiring an image.
In the present embodiment, the execution subject of the method for generating thumbnails (e.g., server 105 shown in fig. 1) may first acquire images from a local or other storage device (e.g., terminal devices 101, 102, 103 shown in fig. 1). The image may be an image designated by a technician in advance, or an image determined according to a preset screening condition.
Step 202, determining a splitting quantity set corresponding to the image.
In this embodiment, the split number in the split number set may be used to characterize the number of sub-graphs into which the image is desired to be split. The split number set may be composed of a plurality of split numbers specified by a technician according to an actual application scenario.
As an example, in an actual application scenario, if 3 thumbnails are desired to be presented, the minimum value in the split number set may be set to 3. For example, the split number set may include three split numbers of 3, 6, and 9. At this time, the method can be respectively used for representing and splitting the image into three subgraphs, six subgraphs and nine subgraphs.
Alternatively, the split numbers in the split number set may form an equal ratio number series in a descending order or in a descending order. As an example, the split number set may include 2, 4, 8 three split numbers. At this time, the method can be respectively used for representing and splitting the image into two subgraphs, four subgraphs and eight subgraphs.
Optionally, the splitting number set corresponding to the image may be determined according to the size information of the image.
Among them, the size information may refer to various information that can be used to characterize the size of an image. For example, the size information of the image may include at least one of: image size, image resolution, aspect ratio of the image, area of the image, and the like.
For example, the correspondence between the image size information and the split number set may be set in advance. At this time, after the image is acquired, a splitting number set corresponding to the image in advance may be searched for according to the size information of the image as the splitting number set corresponding to the image.
For another example, the size information of the desired sub-picture may be set in advance according to the actual application requirements. At this time, the splitting number set corresponding to the image may be calculated according to the size information of the image and the size information of the sub-image.
Step 203, selecting the minimum value from the split number set as the target split number, and executing the following processing steps:
step 2031, splitting the image into a number of target split sub-images to obtain a sub-image set.
In this step, for example, if the target splitting number is 4, the image is split into 4 sub-graphs, so as to obtain a sub-graph set including 4 sub-graphs. The method for splitting the image can be flexibly set according to actual application requirements.
For example, when the target splitting number is 2, the image may be split along the length direction of the parallel image to obtain two sub-images, or the image may be split along the width direction of the parallel image to obtain two sub-images.
Optionally, when splitting the image, the image may be split equally into a target split number of sub-images. Therefore, the size information of each sub-graph in the obtained sub-graph set can be ensured to be the same. Based on the method, in the subsequent processing process of the subgraph, the problem of different sizes does not need to be considered, and therefore convenience in the whole process of generating the thumbnail is improved.
When splitting an image, the sum of the areas of the sub-images in the split sub-image set may be equal to or smaller than the area of the original image. For example, when an image is split into four sub-images, the four sub-images may be determined from the upper left corner of the image according to the area of the predetermined sub-image. In this case, the image may have the remaining image area in addition to the four sub-images.
Step 2032, determining whether the number of subgraphs in the subgraph set meeting the preset condition is less than a preset number threshold.
In this step, the number threshold may be set by a technician according to the actual application requirements. For example, the quantity threshold may be set to the number of thumbnails desired to be generated. The preset conditions can be flexibly set by technicians according to actual application scenes and application requirements.
For example, the preset condition may include that the similarity with the original image is not less than a preset similarity threshold. At this time, after the image is split into the target split number of sub-images to obtain the sub-image set, the similarity between each sub-image in the sub-image set and the image may be calculated first. And then determining the corresponding subgraph with the similarity not less than the similarity threshold as the subgraph meeting the preset condition.
Optionally, after the image is split into the target split number of sub-images to obtain the sub-image set, image recognition may be performed on each sub-image in the sub-image set to obtain a recognition result of each sub-image, and then it may be determined whether the number of sub-images of which the recognition results meet the preset condition in the sub-image set is smaller than a preset number threshold. The image can be recognized by various conventional image recognition methods.
At this time, the preset condition may be related to the recognition result of the sub-graph. For example, the preset condition may include that the recognition result corresponding to the sub-graph belongs to a preset recognition result set. At this time, after the recognition result of each sub-graph is obtained, whether the recognition result of each sub-graph belongs to a preset recognition result set or not can be respectively determined. For a sub-graph, if the recognition result of the sub-graph belongs to a preset recognition result set, it can be determined that the recognition result of the sub-graph meets a preset condition. In other words, the sub-graph meets the preset condition.
Therefore, subgraphs in the subgraph set are filtered through preset conditions, subgraphs which are not in accordance with expectations can be filtered timely, the problems of resource waste and increased processing time caused by continuous processing of the subgraphs which are not in accordance with expectations are solved, and the processing efficiency is improved.
Step 2033, in response to determining that the number of the subgraphs in the subgraph set meeting the preset condition is not less than the preset number threshold, selecting a number threshold number of subgraphs from the subgraphs in the subgraph set meeting the preset condition.
In this step, the manner of selecting subgraphs from the subgraphs in the subgraph set which meet the preset conditions can be flexibly set. For example, a threshold number of subgraphs may be randomly selected from the subgraphs that meet the preset condition.
For another example, the subgraphs which meet the conditions may be sorted first to obtain a sorting result. And then sequentially selecting a number of threshold subgraphs according to the obtained sequencing result. As an example, the subgraphs which meet the condition may be sorted in the order of the similarity from the original image to the original image, and then the threshold number of subgraphs may be selected in the order of the similarity from the original image to the original image.
Step 2034, generate thumbnails of the images using the selected subgraphs, respectively.
In this step, for each selected sub-graph, the thumbnail corresponding to the sub-graph may be generated by using various existing thumbnail generation methods. Therefore, the thumbnail corresponding to each selected sub-image can be obtained.
For example, a thumbnail image corresponding to the sub-image may be obtained based on a size transformation of the sub-image. For another example, the sub-graph may be processed by some existing application for generating the thumbnail to obtain the thumbnail corresponding to the sub-graph.
Optionally, the processing step may further include: in response to the fact that the number of the sub-images which meet the preset conditions in the sub-image set is smaller than the preset number threshold, determining whether the number of the unselected split numbers in the split number set is zero or not; and in response to determining that the number of the unselected split numbers in the split number set is not zero, reselecting the minimum value from the unselected split numbers in the split number set, and continuing to execute the processing steps by using the reselected minimum value as the target split number.
If the number of sub-images meeting the preset condition in the current sub-image set is smaller than the number threshold, the sub-images with the number threshold cannot be obtained, and the thumbnails with the number threshold cannot be generated. At this time, if there is still unselected split quantity in the split quantity set, the minimum value of the unselected split quantities may be selected as the target split quantity, and the processing steps may be continuously performed.
In other words, the split numbers are selected from the split number set in order from small to large. This avoids splitting the image into too many sub-images, thereby making the image content of the later generated thumbnail representation too local.
Alternatively, each time the image is split, the image may be split equally. Therefore, the size information of each sub-image in the sub-image set obtained every time is ensured to be the same, and the subsequent image processing process is facilitated.
Optionally, the processing step may further include: in response to determining that the number of the unselected split numbers in the split number set is zero, splitting the image to obtain a number threshold number of sub-images, and generating thumbnails of the image by using the obtained sub-images respectively.
If the number of the unselected split numbers in the split numbers is determined to be zero, the method can represent that the image is split according to various split numbers, and sub-images with the number threshold value meeting the preset condition cannot be obtained. At this time, the number threshold value can be directly used as a split number, the image is split, and for each split sub-image, a thumbnail corresponding to the sub-image is generated, so as to ensure the number of generated thumbnails.
With continued reference to fig. 3, fig. 3 is an illustrative application scenario 300 of the method for generating thumbnails in accordance with the present embodiment. In the application scenario of fig. 3, the preset split number set may include two split numbers of 4 and 9, and the preset number threshold is 3. At this time, after the image 301 is acquired, the image 301 may be first quartered to obtain four subgraphs, a1, a2, A3 and a 4.
Then, image recognition can be performed on the four sub-images of a1, a2, A3 and a4 respectively, so that recognition results corresponding to the four sub-images of a1, a2, A3 and a4 are obtained respectively. Then, whether the recognition results corresponding to the four sub-images a1, a2, A3 and a4 respectively meet the preset conditions can be sequentially judged. As shown in the figure, the recognition results corresponding to the two sub-images a1 and a2 respectively meet the preset condition, and the recognition results corresponding to the sub-images A3 and a4 respectively do not meet the preset condition.
At this time, since the number of sub-images meeting the preset condition is less than 3, the image 301 may be further divided into nine divisions, resulting in nine sub-images of B1, B2, B3, B4, B5, B6, B7, B8, and B9. Then, image recognition can be performed on nine sub-images, namely B1, B2, B3, B4, B5, B6, B7, B8 and B9, so as to obtain recognition results corresponding to the sub-images.
Then, whether the recognition results corresponding to the nine sub-graphs B1, B2, B3, B4, B5, B6, B7, B8 and B9 respectively meet the preset conditions can be sequentially judged. As shown in the figure, the recognition results corresponding to the four sub-graphs B1, B2, B4 and B7 respectively meet the preset condition, and the recognition results corresponding to the five sub-graphs B3, B5, B6, B8 and B9 respectively do not meet the preset condition.
At this time, since the number of sub-images meeting the preset condition is greater than 3, three sub-images B B1, B2 and B4 can be picked from the sub-images to generate a thumbnail B1 corresponding to the B1 sub-image, a thumbnail B2 corresponding to the B2 sub-image and a thumbnail B4 corresponding to the B4 sub-image, respectively.
The method provided by the above embodiment of the present disclosure obtains a plurality of sub-images by splitting the image, and determines whether the number of sub-images meeting the preset condition meets a preset number threshold. And if so, selecting a threshold number of sub-images from the sub-images meeting the conditions to generate a thumbnail corresponding to each sub-image. And if the number of the sub-images is not consistent with the preset condition, the image is split again to obtain more sub-images than the sub-images split at the previous time, so that a threshold number of sub-images which are consistent with the preset condition are selected from the sub-images, and further a threshold number of thumbnail images are generated. If the number of sub-images meeting the preset condition is not obtained by splitting the image in different scales, the image can be directly split according to the number threshold to obtain the number threshold of sub-images, and the thumbnail corresponding to each sub-image is generated.
Thus, a certain number of thumbnails can be obtained based on one image to avoid various problems caused by an excessively small number of thumbnails. For example, in some application scenarios where thumbnails need to be generated and presented, it is often necessary to present a certain number of thumbnails. In this case, a page display error may occur due to too few thumbnails, and the method provided by the above embodiment of the present disclosure may effectively obtain a certain number of thumbnails meeting preset conditions, so as to avoid the page display thumbnail error.
With further reference to FIG. 4, a flow 400 of yet another embodiment of a method for generating thumbnails is shown. The flow 400 of the method for generating thumbnails includes the steps of:
step 401, an image is acquired.
Step 402, determining a splitting quantity set corresponding to the image.
Step 403, selecting the minimum value from the split number set as the target split number, and executing the following processing steps:
step 4031, split the image into a number of target split sub-graphs, to obtain a sub-graph set.
Step 4032, determine whether the number of subgraphs in the subgraph set meeting the preset condition is less than a preset number threshold. If the number of sub-graphs meeting the preset condition in the sub-graph set is not less than the preset number threshold, the following step 4033 may be performed. If the number of sub-graphs meeting the preset condition in the sub-graph set is smaller than the preset number threshold, the following step 4035 may be performed.
Step 4033, a threshold number of subgraphs are selected from the subgraphs in the subgraph set which meet the preset conditions.
Step 4034, thumbnail images of the images are generated respectively by using the selected subgraphs.
Step 4035, determine whether the number of unselected split numbers in the split number set is zero. If the number of unselected split numbers in the split number set is not zero, the following step 4036 may be performed. If the number of unselected split numbers in the split number set is zero, the following step 4037 may be performed.
4036, reselecting the minimum value from the unselected split numbers in the split number set, and continuing to execute the above 4031-4037 by using the reselected minimum value as the target split number.
Step 4037, the image is split to obtain a threshold number of sub-images, and the obtained sub-images are used to generate thumbnails of the image.
The specific implementation process of the steps 401, 402, and 403 may refer to the related description in the corresponding embodiment of fig. 2, and will not be described herein again.
At step 404, descriptive information of the image is obtained.
In the present embodiment, the description information of the image may refer to related information for describing the content presented by the image. The executing entity may retrieve the description information of the image from a local or other storage device.
The acquired image may be preset with corresponding description information. At this time, after the image is acquired, description information of the image may be acquired from the image. Of course, in some application scenarios, the description information of the image may be acquired at the same time as the image is acquired.
Step 405, displaying the thumbnail and the description information of the image.
In this embodiment, the generated thumbnail and the acquired description information may be presented to the user. The execution main body may display the thumbnail and the description information of the image, or the execution main body may send the thumbnail and the description information of the image to other terminal devices first, so that the other terminal devices display the thumbnail and the description information of the received image.
Alternatively, when a thumbnail of an image and description information are presented, the description information of the image may be presented as a context of the thumbnail of the image. As an example, when the content presented by the image is an article, the description information may be attribute information such as a name of the article. At this time, the user may be presented with description information of the article and the generated thumbnail may be presented under the description information.
As can be seen from fig. 4, compared with the embodiment corresponding to fig. 2, in the method for generating a thumbnail in this embodiment, after the thumbnail of the image is generated, the description information of the image may be further acquired, and the generated thumbnail and the acquired description information are displayed, so that the description information is presented as the context of the generated thumbnail, thereby matching a certain number of thumbnails with the description information of the image, and avoiding the display problem caused by too few thumbnails.
With further reference to fig. 5, as an implementation of the method shown in the above figures, the present disclosure provides an embodiment of an apparatus for generating a thumbnail, which corresponds to the method embodiment shown in fig. 2, and which is particularly applicable in various electronic devices.
As shown in fig. 5, the apparatus 500 for generating a thumbnail provided by the present embodiment includes an acquisition unit 501, a determination unit 502, and a processing unit 503. Wherein the acquiring unit 501 is configured to acquire an image; the determining unit 502 is configured to determine a set of split numbers corresponding to the images; the processing unit 503 is configured to select the minimum value from the split number set as the target split number, and perform the following processing steps: splitting the image into a target split number of sub-images to obtain a sub-image set; determining whether the number of sub-images in the sub-image set meeting the preset condition is smaller than a preset number threshold value; in response to the fact that the number of the sub-images meeting the preset condition in the sub-image set is not smaller than the preset number threshold, selecting a number threshold number of sub-images from the sub-images meeting the preset condition in the sub-image set; and respectively generating thumbnail images of the images by using the selected subgraphs.
In the present embodiment, in the apparatus 500 for generating a thumbnail: the specific processing of the obtaining unit 501, the determining unit 502, and the processing unit 503 and the technical effects thereof can refer to the related descriptions of step 201, step 202, and step 203 in the corresponding embodiment of fig. 2, which are not repeated herein.
In some optional implementations of this embodiment, the processing step further includes: in response to the fact that the number of the sub-images which meet the preset conditions in the sub-image set is smaller than the preset number threshold, determining whether the number of the unselected split numbers in the split number set is zero or not; and in response to determining that the number of the unselected split numbers in the split number set is not zero, reselecting the minimum value from the unselected split numbers in the split number set, and continuing to execute the processing steps by using the reselected minimum value as the target split number.
In some optional implementations of this embodiment, the processing step further includes: in response to determining that the number of the unselected split numbers in the split number set is zero, splitting the image to obtain a number threshold number of sub-images, and generating thumbnails of the image by using the obtained sub-images respectively.
In some optional implementation manners of this embodiment, the processing unit is further configured to perform image recognition on each sub-image in the sub-image set, so as to obtain a recognition result of each sub-image; and determining whether the number of the sub-images of which the corresponding recognition results meet the preset conditions in the sub-image set is smaller than a preset number threshold.
In some optional implementations of this embodiment, the processing unit is further configured to split the image equally into a target split number of sub-images.
In some optional implementations of this embodiment, the processing unit is further configured to determine a set of splitting numbers corresponding to the images according to the size information of the images.
In some optional implementations of the embodiment, the obtaining unit is further configured to obtain description information of the image; the above-mentioned device still includes: the display unit is configured to display the thumbnail of the image and the description information, wherein the description information is presented as the context of the thumbnail of the image.
The apparatus provided by the above embodiment of the present disclosure acquires an image by an acquisition unit; the determining unit determines a split number set corresponding to the image; the processing unit selects the minimum value from the split number set as a target split number, and executes the following processing steps: splitting the image into a target split number of sub-images to obtain a sub-image set; determining whether the number of sub-images in the sub-image set meeting the preset condition is smaller than a preset number threshold value; in response to the fact that the number of the sub-images meeting the preset condition in the sub-image set is not smaller than the preset number threshold, selecting a number threshold number of sub-images from the sub-images meeting the preset condition in the sub-image set; and respectively generating thumbnail images of the images by using the selected subgraphs. Therefore, based on image splitting, a plurality of thumbnails meeting preset conditions can be generated according to one image, so that the number of thumbnails is effectively increased, and various problems caused by too few thumbnails can be avoided.
Referring now to FIG. 6, a schematic diagram of an electronic device (e.g., the server of FIG. 1) 600 suitable for use in implementing embodiments of the present disclosure is shown. The server shown in fig. 6 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 6, electronic device 600 may include a processing means (e.g., central processing unit, graphics processor, etc.) 601 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)602 or a program loaded from a storage means 608 into a Random Access Memory (RAM) 603. In the RAM603, various programs and data necessary for the operation of the electronic apparatus 600 are also stored. The processing device 601, the ROM 602, and the RAM603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
Generally, the following devices may be connected to the I/O interface 605: input devices 606 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; output devices 607 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 608 including, for example, tape, hard disk, etc.; and a communication device 609. The communication means 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. While fig. 6 illustrates an electronic device 600 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided. Each block shown in fig. 6 may represent one device or may represent multiple devices as desired.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication means 609, or may be installed from the storage means 608, or may be installed from the ROM 602. The computer program, when executed by the processing device 601, performs the above-described functions defined in the methods of embodiments of the present disclosure.
It should be noted that the computer readable medium described in the embodiments of the present disclosure may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In embodiments of the disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In embodiments of the present disclosure, however, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
The computer readable medium may be embodied in the server; or may exist separately and not be assembled into the server. The computer readable medium carries one or more programs which, when executed by the server, cause the server to: acquiring an image; determining a splitting quantity set corresponding to the image; selecting the minimum value from the split number set as a target split number, and executing the following processing steps: splitting the image into a target split number of sub-images to obtain a sub-image set; determining whether the number of sub-images in the sub-image set meeting the preset condition is smaller than a preset number threshold value; in response to the fact that the number of the sub-images meeting the preset condition in the sub-image set is not smaller than the preset number threshold, selecting a number threshold number of sub-images from the sub-images meeting the preset condition in the sub-image set; and respectively generating thumbnail images of the images by using the selected subgraphs.
Computer program code for carrying out operations for embodiments of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. 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). It should also be noted that, 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.
The units described in the embodiments of the present disclosure may be implemented by software or hardware. The described units may also be provided in a processor, and may be described as: a processor includes an acquisition unit, a determination unit, and a processing unit. Where the names of these units do not in some cases constitute a limitation of the unit itself, for example, the acquisition unit may also be described as "unit to acquire an image".
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention in the embodiments of the present disclosure is not limited to the specific combination of the above-mentioned features, but also encompasses other embodiments in which any combination of the above-mentioned features or their equivalents is made without departing from the inventive concept as defined above. For example, the above features and (but not limited to) technical features with similar functions disclosed in the embodiments of the present disclosure are mutually replaced to form the technical solution.

Claims (10)

1. A method for generating a thumbnail, comprising:
acquiring an image;
determining a split number set corresponding to the image;
selecting the minimum value from the split number set as a target split number, and executing the following processing steps: splitting the image into a target split number of sub-images to obtain a sub-image set; determining whether the number of sub-images in the sub-image set meeting the preset condition is smaller than a preset number threshold value; in response to the fact that the number of the sub-images meeting the preset condition in the sub-image set is not smaller than the preset number threshold, selecting the sub-images meeting the preset condition from the sub-images in the sub-image set with the number threshold; and respectively generating thumbnails of the images by using the selected subgraphs.
2. The method of claim 1, wherein the processing step further comprises:
in response to the fact that the number of the sub-images which meet the preset conditions in the sub-image set is smaller than the preset number threshold, determining whether the number of the unselected split numbers in the split number set is zero or not;
in response to determining that the number of unselected split quantities in the split quantity set is not zero, reselecting a minimum value from the unselected split quantities in the split quantity set, and continuing to perform the processing step using the reselected minimum value as a target split quantity.
3. The method of claim 2, wherein the processing step further comprises:
in response to determining that the number of the unselected split numbers in the split number set is zero, splitting the image to obtain sub-images of the number threshold, and generating thumbnails of the image by using the obtained sub-images respectively.
4. The method of claim 1, wherein after said splitting the image into a target split number of subgraphs, resulting in a subgraph, further comprising:
respectively carrying out image recognition on each subgraph in the subgraph set to obtain a recognition result of each subgraph; and
the determining whether the number of sub-images meeting the preset condition in the sub-image set is less than a preset number threshold includes:
and determining whether the number of the sub-images of which the corresponding recognition results meet the preset conditions in the sub-image set is smaller than a preset number threshold.
5. The method of claim 1, wherein the splitting the image into a target split number of subgraphs comprises:
and equally dividing the image into a target division number of sub-images.
6. The method of claim 1, wherein the determining the set of split numbers to which the image corresponds comprises:
and determining a splitting quantity set corresponding to the image according to the size information of the image.
7. The method of claim 1, wherein the method further comprises:
acquiring description information of the image;
and displaying the thumbnail of the image and the description information, wherein the description information is presented as the context of the thumbnail of the image.
8. An apparatus for generating a thumbnail, comprising:
an acquisition unit configured to acquire an image;
a determining unit configured to determine a split number set corresponding to the image;
a processing unit configured to select a minimum value from the split number set as a target split number, and to perform the following processing steps: splitting the image into a target split number of sub-images to obtain a sub-image set; determining whether the number of sub-images in the sub-image set meeting the preset condition is smaller than a preset number threshold value; in response to the fact that the number of the sub-images meeting the preset condition in the sub-image set is not smaller than the preset number threshold, selecting the sub-images meeting the preset condition from the sub-images in the sub-image set with the number threshold; and respectively generating thumbnails of the images by using the selected subgraphs.
9. A server, comprising:
one or more processors;
a storage device having one or more programs stored thereon;
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-7.
10. A computer-readable medium, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1-7.
CN202010022114.1A 2020-01-09 2020-01-09 Method and device for generating thumbnail Active CN112308074B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010022114.1A CN112308074B (en) 2020-01-09 2020-01-09 Method and device for generating thumbnail

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010022114.1A CN112308074B (en) 2020-01-09 2020-01-09 Method and device for generating thumbnail

Publications (2)

Publication Number Publication Date
CN112308074A true CN112308074A (en) 2021-02-02
CN112308074B CN112308074B (en) 2024-09-24

Family

ID=74336362

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010022114.1A Active CN112308074B (en) 2020-01-09 2020-01-09 Method and device for generating thumbnail

Country Status (1)

Country Link
CN (1) CN112308074B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113256659A (en) * 2021-06-04 2021-08-13 北京有竹居网络技术有限公司 Picture processing method and device and electronic equipment

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001298711A (en) * 2000-04-17 2001-10-26 Sony Corp Image recording and reproducing device and method, and recording medium
KR20030056784A (en) * 2001-12-28 2003-07-04 엘지전자 주식회사 Thumbnail image generating system
JP4489153B1 (en) * 2010-01-15 2010-06-23 株式会社東芝 Information storage medium, information reproducing method, information recording method, and information reproducing apparatus
CN103310005A (en) * 2013-06-28 2013-09-18 北京小米科技有限责任公司 Thumbnail display method and device
CN106156313A (en) * 2016-06-30 2016-11-23 维沃移动通信有限公司 The inspection method of a kind of album picture and mobile terminal
CN106485653A (en) * 2016-10-19 2017-03-08 上海传英信息技术有限公司 User terminal and the generation method of panoramic pictures dynamic thumbnail

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001298711A (en) * 2000-04-17 2001-10-26 Sony Corp Image recording and reproducing device and method, and recording medium
KR20030056784A (en) * 2001-12-28 2003-07-04 엘지전자 주식회사 Thumbnail image generating system
JP4489153B1 (en) * 2010-01-15 2010-06-23 株式会社東芝 Information storage medium, information reproducing method, information recording method, and information reproducing apparatus
CN103310005A (en) * 2013-06-28 2013-09-18 北京小米科技有限责任公司 Thumbnail display method and device
CN106156313A (en) * 2016-06-30 2016-11-23 维沃移动通信有限公司 The inspection method of a kind of album picture and mobile terminal
CN106485653A (en) * 2016-10-19 2017-03-08 上海传英信息技术有限公司 User terminal and the generation method of panoramic pictures dynamic thumbnail

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
张琳: "基于显著度和形变控制的图像自适应剪裁算法", 中国优秀硕士学位论文全文数据库, no. 2, 15 February 2017 (2017-02-15) *
李峥嵘;刘晓平;李自元;丁厚本;: "图像分割多阈值法研究", CT理论与应用研究, no. 04, 20 December 2006 (2006-12-20) *
甘俊英, 张有为: "一种使用计算机提取人脸图像特征的阈值最优分层法", 计算机工程与应用, no. 02, 15 January 2002 (2002-01-15) *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113256659A (en) * 2021-06-04 2021-08-13 北京有竹居网络技术有限公司 Picture processing method and device and electronic equipment
CN113256659B (en) * 2021-06-04 2024-04-12 北京有竹居网络技术有限公司 Image processing method, device and electronic device

Also Published As

Publication number Publication date
CN112308074B (en) 2024-09-24

Similar Documents

Publication Publication Date Title
CN110059172B (en) Method and device for recommending answers based on natural language understanding
CN109359194B (en) Method and apparatus for predicting information categories
CN108595211B (en) Method and apparatus for outputting data
CN109862100B (en) Method and device for pushing information
CN110765752B (en) Test question generation method and device, electronic equipment and computer readable storage medium
CN110070076B (en) Method and device for selecting training samples
CN107402878B (en) Test method and device
CN109992719B (en) Method and apparatus for determining push priority information
CN113626301B (en) Method and device for generating test script
KR102712013B1 (en) Method and device for transmitting information
US20200050906A1 (en) Dynamic contextual data capture
CN113760488A (en) Method, device, equipment and computer readable medium for scheduling task
CN109446384B (en) Method and system for generating personnel organization architecture information
WO2024099171A1 (en) Video generation method and apparatus
CN111461967B (en) Picture processing method, device, equipment and computer readable medium
US20180139288A1 (en) Method, device, and non-transitory computer-readable recording medium
CN119065669B (en) Front-end code template generation method, device and medium based on image detection
CN113553123B (en) Data processing method, device, electronic equipment and storage medium
US20240419302A1 (en) Method and apparatus, electronic device and storage medium for pushing books
CN113781062B (en) User tag display method and device
CN112308074B (en) Method and device for generating thumbnail
CN111338621B (en) Method, apparatus, electronic device and computer readable medium for displaying data
CN113641930A (en) Information output method and device and electronic equipment
CN109522429B (en) Method and apparatus for generating information
CN110096392B (en) Method and device for outputting information

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