Picture processing method, computing device and readable storage medium

文档序号:7089 发布日期:2021-09-17 浏览:22次 中文

阅读说明:本技术 一种图片处理的方法、计算设备及可读存储介质 (Picture processing method, computing device and readable storage medium ) 是由 邹亚 黄杰 张勇 于 2021-08-23 设计创作,主要内容包括:本发明公开了一种图片处理的方法,适于在驻留于计算设备的应用中执行,应用采用多个不同优先级的线程来进行图片处理,方法包括步骤:检测是否存在与当前图片相对应的缩略图;如果存在缩略图,则利用第一线程加载当前图片的缩略图,以渐显方式呈现加载完成的缩略图;以及以优先级高于第一线程的第二线程加载当前图片,将加载完成的当前图片进行呈现。本发明还一并公开了相应的计算设备和可读存储介质。(The invention discloses a picture processing method, which is suitable for being executed in an application resident in a computing device, wherein the application adopts a plurality of threads with different priorities to process pictures, and the method comprises the following steps: detecting whether a thumbnail corresponding to a current picture exists; if the thumbnail exists, loading the thumbnail of the current picture by using a first thread, and presenting the loaded thumbnail in a gradual display mode; and loading the current picture by a second thread with higher priority than the first thread, and presenting the loaded current picture. The invention also discloses corresponding computing equipment and a readable storage medium.)

1. A method of picture processing adapted to be executed in an application resident on a computing device, wherein the application employs a plurality of threads of different priorities for picture processing, the method comprising the steps of:

detecting whether a thumbnail corresponding to a current picture exists;

if the thumbnail of the current picture exists, loading the thumbnail of the current picture by using a first thread, and presenting the loaded thumbnail of the current picture in a gradual display mode; and

and loading the current picture by a second thread with priority higher than that of the first thread, and presenting the loaded current picture.

2. The method of claim 1, further comprising the step of:

and if the thumbnail of the current picture does not exist, presenting a default picture and creating the thumbnail of the current picture.

3. The method of claim 2, wherein the step of creating a thumbnail of the current picture comprises:

obtaining a wide pixel value and a high pixel value of a current picture;

if at least one of the wide pixel value and the high pixel value of the current picture is larger than a first preset value, compressing the current picture to obtain a thumbnail corresponding to the current picture;

and storing the thumbnail corresponding to the obtained current picture.

4. The method of claim 3, wherein the step of compressing the current picture comprises:

taking the ratio of the wide pixel value of the current picture to a first preset value as a first compression ratio of the current picture;

taking the ratio of the high pixel value of the current picture to a first preset value as a second compression ratio of the current picture;

if the first compression ratio and the second compression ratio exist at the same time, sampling the current picture by adopting a larger value in the first compression ratio and the second compression ratio;

and generating a thumbnail of the current picture based on the sampled pixel points of the current picture.

5. The method as claimed in claim 1, wherein after the step of presenting the loaded current picture, further comprising the steps of:

hiding the current picture in a fading mode in response to an operation of acquiring another picture, wherein the another picture is a picture different from the current picture;

detecting whether a thumbnail corresponding to the other picture exists;

if the thumbnail of the other picture exists, loading the thumbnail of the other picture by using a first thread, and presenting the thumbnail of the other picture after loading in a gradual display mode;

and loading the other picture by a second thread with higher priority than the first thread, and presenting the loaded other picture.

6. The method of claim 5, further comprising the step of:

if the thumbnail of the other picture does not exist, presenting a default picture and creating a thumbnail of the other picture.

7. The method of claim 1 or 5, wherein presenting the loaded thumbnail in a fading manner comprises:

acquiring a hiding factor based on a Gaussian function every preset time, wherein the hiding factor is increased from 0 to 1 along with the time;

and setting the transparency of the thumbnail according to the acquired apparent and hidden factors.

8. The method of claim 5 or 6, wherein the step of concealing the current picture in a dissolve manner comprises:

acquiring a hiding factor based on a Gaussian function every preset time, wherein the hiding factor is reduced from 1 to 0 along with the time;

and setting the transparency of the current picture according to the acquired apparent and hidden factors.

9. A computing device, comprising:

one or more processors;

a memory; and

one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs comprising instructions for performing any of the methods of claims 1-8.

10. A computer readable storage medium storing one or more programs, the one or more programs comprising instructions, which when executed by a computing device, cause the computing device to perform any of the methods of claims 1-8.

Technical Field

The present invention relates to the field of computer and internet technologies, and in particular, to a picture processing method, a computing device, and a readable storage medium.

Background

In the current graphical operating system, when a user browses pictures, the fluency of the process of checking and switching the pictures affects the use experience of the user to a great extent.

The existing desktop operating system provides a picture browsing tool, and provides a conventional picture browsing function, for example, the picture browsing tool on the Windows operating system only displays a current picture when browsing pictures, and when a user clicks a next picture, the next picture is loaded, and when the original picture of the picture is loaded, the next picture is displayed. Some application software (for example, WeChat, QQ) also has a similar picture browsing function, but the existing picture browsing tools basically only provide the basic functions required for browsing pictures, and do not consider the fluency when pictures are switched, and particularly when a user switches high-definition large-size pictures, the user often has a stuck situation when clicking the next picture or switching pictures quickly, which results in poor user experience.

Therefore, a method for processing pictures is needed to improve the smoothness of picture processing.

Disclosure of Invention

To this end, the present invention provides a method of picture processing, a computing device and a storable medium in an attempt to solve or at least alleviate the problems identified above.

According to an aspect of the present invention, there is provided a method of picture processing adapted to be executed in an application residing on a computing device, the application employing a plurality of threads of different priorities for picture processing, the method comprising the steps of: detecting whether a thumbnail corresponding to a current picture exists; if the thumbnail of the current picture exists, loading the thumbnail of the current picture by using a first thread, and presenting the loaded thumbnail of the current picture in a gradual display mode; and loading the current picture by a second thread with higher priority than the first thread, and presenting the loaded current picture.

Optionally, the picture processing method according to the present invention further includes: if no thumbnail of the current picture exists, presenting a default picture and creating a thumbnail of the current picture.

Optionally, in the picture processing method according to the present invention, the step of creating a thumbnail of the current picture includes: obtaining a wide pixel value and a high pixel value of a current picture; if at least one of the wide pixel value and the high pixel value of the current picture is larger than a first preset value, compressing the current picture to obtain a thumbnail corresponding to the current picture; and storing the thumbnail corresponding to the obtained current picture.

Optionally, according to the picture processing method of the present invention, if at least one of the wide pixel value and the high pixel value of the current picture is greater than the first predetermined value, the step of compressing the current picture includes: taking the ratio of the wide pixel value of the current picture to a first preset value as a first compression ratio of the current picture; taking the ratio of the high pixel value of the current picture to the first preset value as a second compression ratio of the current picture; if the first compression ratio and the second compression ratio exist at the same time, sampling the current picture by adopting a larger value in the first compression ratio and the second compression ratio; and generating a thumbnail of the current picture based on the sampled pixel points of the current picture.

Optionally, the picture processing method according to the present invention further includes: and if the number of the stored thumbnails does not exceed a second preset value, creating thumbnails for the next picture adjacent to the current picture.

Optionally, according to the image processing method of the present invention, after the step of presenting the loaded current image, the method further includes the steps of: in response to the operation of acquiring another picture, hiding the current picture in a fading mode, wherein the another picture is a picture different from the current picture; detecting whether a thumbnail corresponding to another picture exists; if the thumbnail of another picture exists, loading the thumbnail of another picture by using a first thread, and presenting the loaded thumbnail in a gradual display mode; and loading another picture by a second thread with higher priority than the first thread, and presenting the loaded another picture.

Optionally, the picture processing method according to the present invention further includes: if no thumbnail of another picture exists, the default picture is presented and a thumbnail of another picture is created.

Optionally, in the picture processing method according to the present invention, the step of presenting the loaded thumbnail pictures in a fade-in manner includes: acquiring a hiding factor at preset time intervals based on a Gaussian function, wherein the hiding factor is increased from 0 to 1 along with the time; and setting the transparency of the thumbnail according to the acquired apparent and hidden factors.

Optionally, in the picture processing method according to the present invention, the step of hiding the current picture in a dissolve manner includes: acquiring a hiding factor at preset time intervals based on a Gaussian function, wherein the hiding factor is reduced from 1 to 0 along with the time; and setting the transparency of the current picture according to the acquired apparent and hidden factors.

Optionally, the picture processing method according to the present invention further includes: determining a range for blurring the thumbnail based on the blurring radius; determining a weight matrix of pixel points in a fuzzy processing range based on a Gaussian function and pixel coordinates in the fuzzy processing range; and obtaining the image after the fuzzy processing based on the weight matrix and the pixel value of the pixel point in the fuzzy processing range.

Optionally, the picture processing method according to the present invention further includes: and after the picture is presented in a gradual-in mode, if the current picture is not loaded, presenting prompt information.

According to another aspect of the present invention, there is provided a computing device comprising: one or more processors; a memory; and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs including instructions for performing any of the above-described picture processing methods.

According to yet another aspect of the present invention, there is provided a computer readable storage medium storing one or more programs, the one or more programs comprising instructions, which when executed by a computing device, cause the computing device to perform any of the above-described picture processing methods.

According to the picture processing method, the thumbnail of the picture is preferentially presented to the user in the process that the user browses the picture, so that the time required by picture loading is reduced, and the picture is rapidly displayed. The pictures are presented in a gradual display mode, buffer time is provided for loading of the high-definition pictures, and a smooth transition display effect is provided for browsing of the pictures. The pictures are processed through multiple threads, and the current pictures are loaded through threads with higher priorities, so that the high-definition pictures are quickly loaded.

Further, the high-definition pictures are resampled to make small-size thumbnails, and a certain number of thumbnails are loaded in advance, so that even if a user quickly switches the pictures, the thumbnails of the pictures can be quickly displayed. In the process of switching pictures, the front picture and the rear picture are respectively transited in a fade-in and fade-out mode, so that the smooth transition of picture switching is realized, and the pause feeling of a user in the process of direct switching is reduced. The picture processing method has the advantages of small dependence, strong universality and high running performance, can be widely applied to each platform, and provides a convenient picture processing scheme for different desktop environments.

The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.

Drawings

To the accomplishment of the foregoing and related ends, certain illustrative aspects are described herein in connection with the following description and the annexed drawings, which are indicative of various ways in which the principles disclosed herein may be practiced, and all aspects and equivalents thereof are intended to be within the scope of the claimed subject matter. The above and other objects, features and advantages of the present disclosure will become more apparent from the following detailed description read in conjunction with the accompanying drawings. Throughout this disclosure, like reference numerals generally refer to like parts or elements.

FIG. 1 shows a flow diagram of a picture processing method according to one embodiment of the invention;

FIG. 2 is a timing diagram illustrating a picture processing method according to an embodiment of the present invention;

FIG. 3 shows a flow diagram of a wafer processing method according to another embodiment of the invention;

FIG. 4 is a timing diagram illustrating a picture processing method according to another embodiment of the present invention;

FIG. 5 illustrates a block diagram of a computing device 500, according to one embodiment of the invention;

FIG. 6 shows a schematic diagram of a Gaussian function according to one embodiment of the invention.

Detailed Description

Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.

The following first explains the terms involved in the present invention:

qt: qt is a faster, more intelligent way to create innovative devices, modern user interfaces, and applications for multiple screens. It is a cross-platform C + + application development framework. The method provides the functions required by the graphical user interface for developers to establish the graphical user interface, is widely used for developing graphical user interface programs, and can also be used for developing non-graphical user interface (such as command line interfaces) programs. Qt is fully object-oriented, easily scalable, and allows for true component programming.

QPropertylanimation: the Qt animation attribute class can realize the animation display of a certain attribute of the Qt control.

QFiture: the QFiture class represents the result of an asynchronous computation, allowing a thread to synchronize with one or more results that will be ready at a later point in time, which may be of any type having a default constructor and a copy constructor.

QtConcurrent: the multithreading method class provided by Qt provides high-level function interfaces (APIs), so that the developed program can automatically adjust the number of the running threads according to the number of CPU cores of the computer.

In the existing scheme, when a user browses a picture, picture browsing software carried by a Windows desktop operating system displays the picture, and the user loads the next picture after clicking a next key, and displays the picture when the original picture of the picture is loaded. The picture processing mode of the scheme has no buffer in the picture switching process, and if the resolution is very high and the picture with large size is clicked by a user next picture, the picture can be blocked because of no buffer, so that the switching process is not smooth, and the user experience is influenced.

The present invention provides a picture processing method to solve or at least alleviate the problems as described above. The picture processing method is suitable for being executed in an application in a computing device, and the application adopts a plurality of threads with different priorities to process pictures.

Fig. 1 shows a flow chart of a picture processing method according to an embodiment of the invention. As shown in fig. 1, the picture processing method starts in step S110. In step S110, it is detected whether there is a thumbnail corresponding to the current picture. The application firstly detects whether the thumbnail of the current picture exists in the memory space corresponding to the memory address for storing the thumbnail. If the thumbnail exists, the thumbnail is preferentially loaded in the subsequent steps. And if the thumbnail does not exist, preferentially loading the default picture in the subsequent step.

Subsequently, if the presence of the thumbnail is detected, step S120 is performed. In step S120, the thumbnail of the current picture is loaded. Subsequently, in step S122, the thumbnail of the current picture that has been loaded is presented, and the original image of the current picture is loaded.

Optionally, a thumbnail of the current picture is loaded with the first thread.

Optionally, the loaded thumbnail is presented in a fading manner. According to one embodiment, a dynamically changing fade-in and fade-out factor is used to effect the fade-in and fade-out mode transitions. The interval range of the hiding factor is changed between 0 and 1, wherein 0 represents hiding, and 1 represents all displaying. In the transition of the fade-in mode, a fade-out factor is acquired at preset time intervals, and the fade-out factor is increased to 1 along with the time. Here, the implicit factor is obtained according to the following gaussian function formula:

wherein a represents the height of the curve peak, b represents the coordinate of the peak center, c represents the standard deviation, and the width of the Gaussian function bell-shaped graph is characterized.

FIG. 6 shows a schematic diagram of a Gaussian function according to one embodiment of the invention. Fig. 6 shows a gaussian bell-shaped graph, wherein the ordinate 0 to 10 in the graph represents the interval range 0 to 1 of the implicit factor, i.e. the ordinate 10 represents the implicit factor 1, and the ordinate 0 represents the implicit factor 0. The process of the picture fading in is then represented by the part of the ordinate from 0 to 1, i.e. the part of the graph to the left of the ordinate in fig. 6.

According to one embodiment, after the user clicks a button indicating switching pictures, for example, clicking the next picture, a timer is started to set the presentation time for the fade-in process of the pictures. Optionally, the presentation time is set to 200ms, i.e. the fade-in animation duration is 200 ms. Optionally, a timeout time is set for the timer, for example, the timeout time is set to 10 ms. Then, the varying implicit factor is calculated from x on the abscissa from-6 to 0. And acquiring explicit and implicit factors based on the Gaussian function every preset time. For example, the implicit factors are sequentially obtained according to the abscissa-6, -5, -4, -3, -2, -1 and 0 every 6 equal parts of every 200ms, namely every 33.33 ms.

And then, gradually reducing the transparency of the thumbnail according to the acquired gradually-increased apparent and hidden factors until the thumbnail is completely displayed, and realizing a gradually-clear smooth display process of the thumbnail. Optionally, a transparent QPixmap is created as a drawing area according to the size of the picture, the picture is drawn by using a qpair, and the drawn picture covers the created drawing area. The QPair rendering mode is reset to modify the alpha channel values for the entire rendering region. And then, calculating a new alpha value of the picture according to the obtained apparent and hidden factors, and drawing a rectangle covering the whole picture according to the obtained new alpha value, thereby achieving the fading effect.

Next, the transition of the image dissolve method will be described. In the transition of the image in a fading mode, a fading factor is acquired every predetermined time, and the fading factor is reduced from 1 to 0 with time. The image of the image fade-in transition is shown as the right half of the bell-shaped graph of the gaussian function shown in fig. 6.

According to one embodiment, after the user clicks a button for switching pictures, for example, clicking the next picture, a timer is started to set the presentation time for the fading process of the pictures. Optionally, the presentation time is set to 200ms, i.e. the dissolve animation duration is 200 ms. Optionally, a timeout time is set for the timer, for example, the timeout time is set to 10 ms. Then, the varying implicit factor is calculated from x on the abscissa from 0 to 6. And acquiring explicit and implicit factors based on the Gaussian function every preset time. For example, the implicit factors are sequentially obtained every 6 equal parts of 200ms, namely every 33.33ms according to the abscissa 0, 1, 2, 3, 4, 5 and 6.

And then, according to the obtained gradually-reduced apparent and hidden factors, gradually increasing the transparency of the thumbnail until the thumbnail completely disappears, and realizing the gradually-blurred smooth hiding process of the thumbnail. Optionally, a transparent QPixmap is created as a drawing area according to the size of the picture, the picture is drawn by using a qpair, and the drawn picture covers the created drawing area. The QPair rendering mode is reset to modify the alpha channel values for the entire rendering region. And then, calculating a new alpha value of the picture according to the obtained apparent and hidden factors, and drawing a rectangle covering the whole picture according to the obtained new alpha value, thereby achieving the fading effect.

According to one embodiment of the invention, a display animation is used for presenting the pictures in the picture switching process, specifically, the previous picture is gradually hidden in a fade-out mode, and the picture to be displayed is gradually displayed in a fade-out mode, so that smooth transition of the high-definition pictures is realized. And starting a timer when the picture is switched, for example, setting the whole fade-in and fade-out process to be 400ms, wherein the fade-in and fade-out processes are 200ms respectively. The display and dissolve presentation mode of the picture can be realized by the above-mentioned combination of the display methods of fade-in and fade-out, which is not described herein again.

Through the picture presentation mode of the fade-in or fade-out animation, the display or the hiding of the picture is transited through the fade-in or fade-out animation, the time is strived for the loading of the picture, especially for a high-definition large picture, the strived time can effectively relieve the problem of long time required by the loading of the picture, a user cannot perceive that the picture is loaded for too long, and meanwhile, the smooth and dazzling display effect of the picture is also increased for the user.

According to one embodiment, the presented thumbnails are blurred, making the display of the thumbnails smoother. Since the thumbnail is obtained by clipping and compressing the original picture, the quality of the picture is lower than that of the original picture, which may result in the reduction of the definition of the picture, and this may cause a mosaic effect to the user visually, resulting in poor user experience. Optionally, the blurring process for the thumbnail is implemented by using a gaussian function. Firstly, determining the range of the thumbnail subjected to fuzzy processing according to a set fuzzy radius, and taking all pixel points around an origin point on the thumbnail by taking a central point as the origin point as the fuzzy range of the thumbnail. The larger the blur radius, the more pronounced the blur effect, and the smaller the blur radius, the less pronounced the blur effect. In the following, taking an image with a blur radius of 1, a standard deviation of 1.5 in gaussian distribution and a size of 3 × 3 as an example, assume that the image matrix is as follows:

assuming its center point coordinates are (0, 0), the remaining eight coordinates around the center point are as follows:

the image is then convolved with the gaussian blur formula as shown below:

assuming standard deviation of Gaussian distributionAt 1.5, substituting the coordinates into this formula yields a weight matrix as follows:

then, recalculating the weight matrix, dividing the weight of each pixel by the weight sum 0.4787147, so that the weight sum of 9 pixels is 1, and obtaining a final weight matrix:

and finally, multiplying each weight on the final weight matrix by the pixel value of the corresponding position of the image matrix to obtain the image matrix after Gaussian blur processing as shown in the specification:

optionally, the addition of gaussian blur to the picture is achieved by qgraphics bluffect in Qt.

After detecting whether the thumbnail corresponding to the current picture exists in step S110, if the thumbnail of the current picture does not exist, the process proceeds to step S124, and a default picture is loaded. After the loading is completed, the process proceeds to step S126, where the loaded default picture is presented, and a thumbnail of the current picture is created and the original image of the current picture is loaded.

Specifically, if no thumbnail of the current picture is detected, a default resource picture of the picture display tool or a default picture preset by the user is preferentially loaded. Preferably, the default resource picture occupies a small memory, so that the picture loading speed is high, and the application can load and present the picture quickly. Optionally, the default picture is presented in a fade-in manner, and the specific implementation manner refers to the above-mentioned method for presenting a picture in a fade-in manner, which is not described herein again.

According to one embodiment, a thumbnail of the current picture is created. Specifically, the pixel information of the current picture is read, including the wide pixel value and the high pixel value of the current picture. And if at least one of the wide pixel value and the high pixel value of the current picture is larger than a first preset value, compressing the current picture to obtain a thumbnail corresponding to the current picture. And if the pixel values of the width and the height of the current picture are less than or equal to the first preset value, the thumbnail does not need to be manufactured on the current picture.

The compression processing of the picture first needs to determine the compression ratio of the picture. Specifically, the ratio of the wide pixel value of the current picture to the first predetermined value is taken as the first compression ratio of the current picture. And taking the ratio of the high pixel value of the current picture to the first preset value as a second compression ratio of the current picture. And if the first compression ratio and the second compression ratio exist at the same time, sampling the current picture by adopting a larger value in the first compression ratio and the second compression ratio.

Specifically, a larger value of the first compression ratio and the second compression ratio is determined, then the width and height pixel values of the thumbnail are calculated according to the determined compression ratios, pixel point information of the original image of the current image is traversed, and sampling is performed according to the determined compression ratios. And assigning the sampled pixel point information of the current picture to the corresponding position in the thumbnail to generate the thumbnail of the current picture. Therefore, the width and the height of the compressed thumbnail can be ensured to be smaller than the first preset value, the ratio of the width and the height of the compressed thumbnail is kept consistent with the picture original image, and the picture can not be stretched or deformed even if the compressed thumbnail is compressed. And then, storing the compressed thumbnail in an application-specified hard disk position or storing the compressed thumbnail in a cache for subsequent use. If the thumbnail is stored in the cache, when a certain thumbnail is needed, the needed picture is transmitted to the main thread through the signal slot, and in the loading of the picture, the picture loading time can be saved, and unnecessary time loss is reduced.

Alternatively, the determination of the first predetermined value may be set by a person skilled in the art as needed. According to an embodiment of the present invention, the first predetermined value is 1000 pixels. The verification proves that when the width and height pixel values of the picture are within 1000 pixels, the picture can be loaded quickly and is not blocked, if the first preset value is set to be too small, the display of the thumbnail is too fuzzy, therefore, the first preset value is set to be optimal to be 1000 pixels, and the width and height pixel values of the thumbnail can be within 1000 pixels or 1000 pixels.

Subsequently, step S130 is performed after step S122 or S126. In step S130, it is detected whether the loading of the original image of the current picture is completed. If the loading of the original image of the current picture is completed, step S150 is executed to present the loaded original image. Optionally, a previous picture is hidden in a fade-out manner, and then the loaded original picture is directly displayed, where a specific implementation manner of the fade-out presentation manner refers to the above-described picture fade-out presentation method, which is not described herein again.

In step S130, it is detected whether the loading of the original image of the current picture is completed. If the loading of the original image of the current picture is not completed, step S140 is executed. In step S140, an icon indicating that the loading is in progress is presented, for example, prompt information of text and/or pictures is presented on the interface to wait for the completion of loading of the original image. Thereafter, the process proceeds to step S130 again, and whether or not the loading of the original is completed is detected, and until the loading of the original is completed, the display of the icon indicating the loading is stopped, and step S150 is executed to present the loaded original.

Next, the picture processing method will be further described. Fig. 2 shows a timing diagram corresponding to the picture processing method according to an embodiment of the invention. As shown in fig. 2, the main thread is used to start the application displaying the picture. For example, when a user opens a picture for the first time, the main thread is used to start the application. Then, when it is necessary to make a thumbnail, in step S210, a thumbnail of a picture is made using thread 1 (i.e., the first thread). Optionally, another thread (e.g., the first thread) is started through QThread, and a thumbnail of a picture to be displayed later is made. After the current thumbnail is manufactured, if the number of the stored thumbnails does not exceed a second preset value, the first thread continues to manufacture the thumbnail of the next picture adjacent to the current picture, continues to manufacture the next picture after the thumbnail of the next picture is manufactured, and so on until the number of the manufactured thumbnails meets the second preset value in step S260. The determination of the second predetermined value can be set by a person skilled in the art as desired. Optionally, the second predetermined value is 20, that is, the thread is stopped when the preloading of the first thread to the last 20 pictures of the current picture is completed. The method has the advantages that the thumbnail is preloaded through the first thread, pictures which can be selected by a user are pre-manufactured, when the user selects the next picture, the thumbnail of the picture can be loaded and presented in a gradually-displaying mode after being manufactured, and the process of manufacturing the thumbnail does not need to be waited. The thumbnail can be generated by the above thumbnail generation method, and details are not repeated here.

Subsequently, in step S220, another thread 2 (i.e., a second thread) is used to load the original image of the current picture. Preferably, the second thread has a higher priority than the first thread, so as to improve the efficiency of loading the original image and reduce the waiting time of the user. For example, the loading of the original image of the current picture can adopt a QtConcurrent class with higher thread priority provided by Qt, and the loading of the picture is executed in a separate thread (for example, a second thread) by utilizing a QtConcurrent:: run () function, wherein the thread is taken from a global thread pool QThreadPool, a return value is obtained through QFauture, and the picture loading of the explicit-implicit animation is closed when a result is obtained.

Subsequently, in step S230, it is detected whether a thumbnail exists, and a corresponding picture is displayed. According to the picture processing method, if the thumbnail corresponding to the current picture exists, the thumbnail is preferentially loaded and displayed, and if the thumbnail corresponding to the current picture does not exist, the default resource picture in the application is preferentially loaded and displayed. And then, storing the manufactured thumbnail, and loading and displaying when the main thread needs.

Subsequently, in step S240, after the second thread finishes loading the original image, the original image is returned to the main thread for displaying. Subsequently, in step S250, presentation is performed based on the returned original image of the current picture. Optionally, if there is a picture being displayed (for example, a default picture or a thumbnail), hiding the picture being displayed in a dissolve manner, and then directly presenting the original image of the returned current picture, where a specific implementation manner of presenting the picture in the dissolve manner refers to the above-described method of presenting the picture in a dissolve manner, and is not described herein again.

FIG. 3 shows a flow diagram of a wafer processing method according to another embodiment of the invention. As shown in fig. 3, the method begins at step S310. In step S310, in response to an operation of obtaining another picture triggered by the user, the current picture is hidden in a fade-out manner, where the fade-out manner may adopt a picture fade-out transition method as described above, which is not described herein.

Subsequently, in step S320, it is detected whether there is a thumbnail corresponding to another picture. Wherein, the other picture is a picture different from the current picture. If there is a thumbnail of another picture, step S330 is performed to load the thumbnail with the first thread. Then, step S332 is performed, the thumbnail animation is displayed, and the gaussian blur is added to the thumbnail. Optionally, the thumbnail animation is performed in a manner of using the explicit-implicit animation to present the picture in the picture switching process as described above, and the gaussian blur may be performed in a manner of adding the gaussian blur to the picture as described above, which is not described herein again.

In step S320, it is detected whether or not there is a thumbnail image corresponding to another picture. If the thumbnail of another picture exists, step S334 is executed to present a default picture and create a thumbnail of another picture. The default picture determination and the thumbnail creation may adopt the default picture determination method and the thumbnail creation method described above, which are not described herein again.

After steps S332 and S334, step S340 is executed to detect whether the dwell time of the current picture reaches a third predetermined value. The current picture is another picture in the picture processing method, and the processed another picture is the current picture. The determination of the second predetermined value can be set by a person skilled in the art as needed. According to an embodiment of the invention, the third predetermined value is 200 ms.

In step S340, if the staying time of the user in the current picture reaches the third predetermined value, the process proceeds to step S350, where an original image of another picture is loaded and displayed after the loading is completed. Optionally, the loading of the current picture may adopt a qtcurrent class with a higher thread priority provided by Qt, and the loading of the picture is performed in a thread of a single point by using a qtcurrent:: run () function, for example, a second thread with a higher priority than the first thread, which is taken from the global thread pool QThreadPool, and a return value is obtained by QFuture, and when a result is obtained, the explicit-implicit animation is closed and the obtained picture is displayed.

In step S340, if the staying time of the user in the current picture does not reach the third predetermined value, step S310 is executed. This is likely due to the fact that the user is scrolling through the pictures quickly, and thus the dwell time on one picture is short. After step S310, step S320 is executed continuously as described above, which is not described herein.

The picture processing method shown in fig. 1 described above is an operation performed when the user opens a picture for the first time, and the picture processing method shown in fig. 3 is an operation performed when the user continues to open a new picture after the picture processing method shown in fig. 1 is executed.

Next, the picture processing method shown in fig. 3 will be further described. Fig. 4 shows a timing diagram corresponding to a picture processing method according to another embodiment of the invention. As shown in fig. 4, in step S410, the main thread is used to load the next thumbnail, for example, when the application is in an opened state and the picture is displayed, the main thread is used to load the next thumbnail. Then, when it is necessary to make a thumbnail, in step S420, the next thumbnail is made using thread 1 (i.e., the first thread). After the next thumbnail is created, the method described in step S210 continues to create the next thumbnail until the number of thumbnails satisfies the second predetermined value, that is, the number of pictures after the current thumbnail satisfies the second predetermined value is stored, for example, the current picture is picture 1, and then the thumbnails of picture 1 and picture 2 … are stored. Subsequently, when the number of stored thumbnails satisfies a second predetermined value, the first thread executes step S460 to wait for triggering of thumbnail creation. Specifically, when the user triggers to display the next picture, the next thumbnail is made, for example, the thumbnails of picture 1 to picture 20 are made and stored completely, when the user triggers an operation of showing picture 2 (for example, clicks the next picture) in the interface of the application presenting picture 1, the number of thumbnails to be shown at this time is less than the second predetermined value, at this time, the next thumbnail is made, the thumbnail of picture 21 is made, and until the number of thumbnails satisfies the second predetermined value again, the first thread is stopped, so that the number of preloaded thumbnails is maintained at the second predetermined value.

Subsequently, in step S430, thread 2 (i.e., the second thread) is used to load the original image of the next picture. Preferably, the second thread has a higher priority than the first thread, so as to improve the efficiency of loading the original image and reduce the waiting time of the user. For example, the original image of the current picture may be loaded in a separate thread (for example, a second thread) by using a QtConcurrent class with a higher thread priority provided by Qt, and the loading of the picture is performed by using a QtConcurrent:: run () function, the thread is taken from a global thread pool QThreadPool, a return value is obtained by QFuture, and when a result is obtained, step S450 is performed, and after the original image is loaded, the original image is returned to the main thread for display.

Subsequently, in step S440, the corresponding picture is displayed according to whether the thumbnail of the next picture exists. Here, the same as step S320, if there is a thumbnail corresponding to the next picture, step S330 and step S332 are executed, and if there is no thumbnail corresponding to the next picture, step S334 is executed, which is not described herein again.

Optionally, in the present invention, when any thumbnail or default picture is displayed, the previous picture is faded out and the picture to be displayed is faded in, and the specific implementation manner is the manner of using the fade animation to display the picture in the picture switching process described above, which is not described herein again. In the present invention, any thumbnail is presented in a gaussian blur mode, and the specific implementation manner is the above-mentioned manner of performing gaussian blur processing on the picture, which is not described herein again.

According to an embodiment of the invention, the picture processing method is adapted to be executed in an application residing on a computing device. FIG. 5 illustrates a block diagram of a computing device 500, according to one embodiment of the invention. A schematic diagram of a computing device 500 is shown in fig. 5. in a basic configuration 502, the computing device 500 typically includes a system memory 506 and one or more processors 504. A memory bus 508 may be used for communicating between the processor 504 and the system memory 506.

Depending on the desired configuration, the processor 504 may be any type of processing, including but not limited to: a microprocessor (μ P), a microcontroller (μ C), a digital information processor (DSP), or any combination thereof. Processor 504 may include one or more levels of cache, such as a level one cache 510 and a level two cache 512, a processor core 514, and registers 516. Example processor cores 514 may include an Arithmetic Logic Unit (ALU), a Floating Point Unit (FPU), a digital signal processing core (DSP core), or any combination thereof. The example memory controller 518 may be used with the processor 504, or in some implementations the memory controller 518 may be an internal part of the processor 504.

Depending on the desired configuration, system memory 506 may be any type of memory, including but not limited to: volatile memory (such as RAM), non-volatile memory (such as ROM, flash memory, etc.), or any combination thereof. System memory 506 may include an operating system 520, one or more applications 522, and program data 524. In some embodiments, application 522 may be arranged to operate with program data 524 on an operating system. The program data 524 comprises instructions, and in the computing device 500 according to the invention the program data 524 comprises instructions for performing the method of picture processing.

The computing device 500 also includes a storage device 532, the storage device 532 including removable storage 536 and non-removable storage 538, each of the removable storage 536 and non-removable storage 538 being connected to the storage interface bus 534. In the present invention, data related to each event occurring during the execution of the program and time information indicating the occurrence of each event may be stored in the storage device 532, and the operating system 520 is adapted to manage the storage device 532. Storage 532 may be a magnetic disk, among others.

Computing device 500 may also include an interface bus 540 that facilitates communication from various interface devices (e.g., output devices 542, peripheral interfaces 544, and communication devices 546) to the basic configuration 502 via the bus/interface controller 530. The example output device 542 includes a graphics processing unit 548 and an audio processing unit 550. They may be configured to facilitate communications with various external devices, such as a display or speakers, via the one or more a/V ports 552. Example peripheral interfaces 544 may include a serial interface controller 554 and a parallel interface controller 556, which may be configured to facilitate communications with external devices such as input devices (e.g., keyboard, mouse, pen, voice input device, touch input device) or other peripherals (e.g., printer, scanner, etc.) via one or more I/O ports 558. An example communication device 546 may include a network controller 560, which may be arranged to facilitate communications with one or more other computing devices 562 over a network communication link via one or more communication ports 564.

A network communication link may be one example of a communication medium. Communication media may typically be embodied by computer readable instructions, data structures, program modules, and may include any information delivery media, such as carrier waves or other transport mechanisms, in a modulated data signal.Modulating data signalsA signal may be represented as a set of one or more of its data or its changes in a manner that encodes information in the signal. By way of non-limiting example, communication media may includeWired media such as a wired network or a private-wired network, and various wireless media such as acoustic, Radio Frequency (RF), microwave, Infrared (IR), or other wireless media. The term computer readable media as used herein may include both storage media and communication media.

Computing device 500 may be implemented as a server, such as a file server, a database server, an application server, a WEB server, etc., or as part of a small-form factor portable (or mobile) electronic device, such as a cellular telephone, a Personal Digital Assistant (PDA), a personal media player device, a wireless WEB-watch device, a personal headset device, an application specific device, or a hybrid device that include any of the above functions. Computing device 500 may also be implemented as a personal computer including both desktop and notebook computer configurations. In some embodiments, computing device 500 is configured to perform a method of picture processing in accordance with the present invention.

According to the picture processing method, the thumbnail of the picture is preferentially presented to the user in the process that the user browses the picture, so that the time required by picture loading is reduced, and quick display is realized. Through the presentation of the picture gradual-display mode, the buffer time is provided for the loading of the high-definition picture, and the smooth and smooth transition display effect is also provided for the browsing of the picture. The pictures are processed through multiple threads, and the current pictures are loaded through threads with higher priorities, so that the high-definition pictures are quickly loaded.

Further, the high-definition pictures are resampled to make small-size thumbnails, and a certain number of thumbnails are loaded in advance, so that even if a user quickly switches the pictures, the thumbnails of the pictures can be quickly displayed. In the process of switching pictures, the front picture and the rear picture are respectively transited in a fade-in and fade-out mode, so that the smooth transition of picture switching is realized, and the pause feeling of a user in the process of direct switching is reduced. The picture processing method has the advantages of small dependence, strong universality and high running performance, can be widely applied to each platform, and provides a convenient picture processing scheme for different desktop environments.

The various techniques described herein may be implemented in connection with hardware or software or, alternatively, with a combination of both. Thus, the methods and apparatus of the present invention, or certain aspects or portions thereof, may take the form of program code (i.e., instructions) embodied in tangible media, such as removable hard drives, U.S. disks, floppy disks, CD-ROMs, or any other machine-readable storage medium, wherein, when the program is loaded into and executed by a machine, such as a computer, the machine becomes an apparatus for practicing the invention.

In the case of program code execution on programmable computers, the computing device will generally include a processor, a storage medium readable by the processor (including volatile and non-volatile memory and/or storage elements), at least one input device, and at least one output device. Wherein the memory is configured to store program code; the processor is configured to execute the picture processing method of the present invention according to instructions in the program code stored in the memory.

By way of example, and not limitation, readable media may comprise readable storage media and communication media. Readable storage media store information such as computer readable instructions, data structures, program modules or other data. Communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media. Combinations of any of the above are also included within the scope of readable media.

In the description provided herein, algorithms and displays are not inherently related to any particular computer, virtual system, or other apparatus. Various general purpose systems may also be used with examples of this invention. The required structure for constructing such a system will be apparent from the description above. Moreover, the present invention is not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best mode of the invention.

In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.

Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects.

Those skilled in the art will appreciate that the modules or units or components of the devices in the examples disclosed herein may be arranged in a device as described in this embodiment or alternatively may be located in one or more devices different from the devices in this example. The modules in the foregoing examples may be combined into one module or may be further divided into multiple sub-modules.

Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification, and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except that at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification may be replaced by an alternative feature serving the same, equivalent or similar purpose, unless expressly stated otherwise.

Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments.

Furthermore, some of the described embodiments are described herein as a method or combination of method elements that can be performed by a processor of a computer system or by other means of performing the described functions. A processor having the necessary instructions for carrying out the method or method elements thus forms a means for carrying out the method or method elements. Further, the elements of the apparatus embodiments described herein are examples of the following apparatus: the apparatus is used to implement the functions performed by the elements for the purpose of carrying out the invention.

As used herein, unless otherwise specified the use of the ordinal adjectives "first", "second", "third", etc., to describe a common object, merely indicate that different instances of like objects are being referred to, and are not intended to imply that the objects so described must be in a given sequence, either temporally, spatially, in ranking, or in any other manner.

While the invention has been described with respect to a limited number of embodiments, those skilled in the art, having benefit of this description, will appreciate that other embodiments can be devised which do not depart from the scope of the invention as described herein. Furthermore, it should be noted that the language used in the specification has been principally selected for readability and instructional purposes, and may not have been selected to delineate or circumscribe the inventive subject matter.

21页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种列表展示方法、装置、电子设备及存储介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类