Image processing method and device, electronic equipment and storage medium
By assigning time periods to images to be switched to create an image sequence and dynamically determine the target time point based on user sliding events, the complexity of image switching and memory usage problems in traditional image editing applications are solved, and an efficient and smooth image browsing experience is achieved.
Patent Information
- Application Number
- CN202411545409.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2025-02-28
AI Technical Summary
Traditional image editing applications increase operational complexity and occupy device memory during the switching process from editing layer to preview layer.
By assigning a specific time period to the image to be switched to create an image sequence, and listening to the user's touch events, dynamically determine the target time point based on the sliding direction and sliding distance, image rendering switching in the image sequence is realized.
It improves the smoothness and visual appeal of image switching, reduces memory usage caused by layer switching, optimizes application performance, and provides an efficient, resource-saving and attractive image browsing method.
Smart Images

Figure CN119536600A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of data processing technology, specifically to the field of image processing technology, and in particular to image processing methods, devices, electronic devices and storage media. Background Art
[0002] In traditional image editing applications, processing a single image edit usually involves switching between the editing layer and the preview layer. Specifically, when users modify an image in edit mode, such as adding filters, cropping, or adding text, these editing operations are performed on a dedicated editing layer. Once the editing is complete, the edited image content can be updated to the screen through graphics drawing tools such as SurfaceView or Canvas. In order to view the editing effect, the user needs to switch to the preview layer, at which time the application will export the edited image as a new image file for display in the image view component.
[0003] This switching process from editing to previewing not only increases the operational complexity of the app, but also requires exporting new images after each edit, which undoubtedly increases the memory usage of the device. Summary of the invention
[0004] The present disclosure provides an image processing method, device, electronic device and storage medium.
[0005] According to one aspect of the present disclosure, there is provided an image processing method, the method comprising:
[0006] Allocate time periods for the images to be switched to obtain an image sequence;
[0007] A touch event is monitored, a target time point is determined according to a sliding direction and a sliding distance corresponding to the touch event, and rendering and switching of images in the image sequence are performed according to the target time point.
[0008] According to another aspect of the present disclosure, there is provided an image processing apparatus, comprising:
[0009] An allocation module, used for allocating time periods for images to be switched to obtain an image sequence;
[0010] The processing module is used to monitor the touch event, determine the target time point according to the sliding direction and sliding distance corresponding to the touch event, and render and switch the images in the image sequence according to the target time point.
[0011] According to a third aspect of the present disclosure, there is provided an electronic device, including:
[0012] at least one processor; and
[0013] a memory communicatively connected to the at least one processor; wherein,
[0014] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute any method in any of the above technical solutions.
[0015] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute any one of the methods described in the above technical solutions.
[0016] According to a fifth aspect of the present disclosure, a computer program product is provided, including a computer program, wherein the computer program implements any one of the methods described in the above technical solutions when executed by a processor.
[0017] The present disclosure provides an image processing method, apparatus, device and storage medium. The present disclosure creates an image sequence by allocating a specific time period to each image to be switched, and monitors the user's touch events at the same time, and dynamically determines the target time point according to the user's sliding direction and sliding distance. This process utilizes timeline data, so that when the images in the image sequence are rendered and switched according to the target time point, an intuitive browsing experience can be achieved. This method not only improves the smoothness and visual appeal of image switching, but also reduces the memory usage caused by layer switching, thereby optimizing application performance and providing users with an efficient, resource-saving and attractive way to browse images.
[0018] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0020] Figure 1 is a schematic diagram of the steps of the image processing method in an embodiment of the present disclosure;
[0021] Figure 2 A principle block diagram of an image processing device in an embodiment of the present disclosure;
[0022] Figure 3 It is a block diagram of an electronic device used to implement the image processing method according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0023] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0024] The present disclosure provides an image processing method, see Figure 1 As shown, Figure 1 : is a schematic diagram of the steps of the image processing method in an embodiment of the present disclosure, which can be applied to a server side, and includes:
[0025] Step S101, allocating time periods for images to be switched to obtain an image sequence.
[0026] Specifically, in this solution, allocating time periods to the images to be switched to obtain an image sequence refers to a method of arranging multiple images in time order and allocating a specific display time period to each image. This process involves organizing the images into a series of continuous time segments, each time period can correspond to the display of one or more images, thereby creating an image sequence that can be played in sequence.
[0027] When processing the image to be switched to obtain an image sequence, it can be achieved in the following way: first determine the start and end time points of each image, and then connect these time points in series to form a complete timeline. After obtaining the image sequence, it is beneficial to subsequent operations. For example, when a user interacts with the application, such as through sliding operations, the server will determine to switch to the correct image in the image sequence according to the current time point and the user's interactive action, and apply the Shader transition effect to achieve smooth image transition and switching effects. This method can make the browsing and switching of images smoother and more intuitive, while improving the user experience.
[0028] Step S102 , monitoring a touch event, determining a target time point according to a sliding direction and a sliding distance corresponding to the touch event, and rendering and switching images in the image sequence according to the target time point.
[0029] Specifically, monitoring touch events means that the server captures the user's interactive behavior, such as tapping, sliding, etc., by sensing the user's touch actions on the screen. Specifically, the server monitors events such as onTouchDown (touch down), onTouchMove (touch move), and onTouchUp (touch up) to respond to the user's sliding operation in real time. When the user slides on the screen, the server dynamically calculates a "target time point" based on the "sliding direction" (i.e., whether the user's finger moves left, right, up, or down) and the "sliding distance" (i.e., the pixel distance moved by the user's finger). This target time point refers to the start time of the next image that should be switched to in the time sequence. The server determines to switch to the correct image in the "image sequence" (i.e., a list of images arranged in chronological order) based on this target time point, and performs rendering operations to display the new image. This dynamic rendering switching based on touch events not only improves the responsiveness of user interaction, but also enhances the visual experience through smooth transition effects, making image browsing more intuitive and smooth.
[0030] In this way, accurate image switching can be achieved by monitoring touch events and dynamically determining the target time point according to the user's sliding direction and sliding distance. This method allows users to intuitively control the timing of switching according to their gestures when browsing pictures, thus providing a smooth and natural interactive experience. At the same time, the server renders and switches the image sequence according to the target time point, ensuring that each switch can be smoothly transitioned and reducing visual abruptness. This instant response mechanism not only improves the user's operational satisfaction, but also enhances the overall visual effect, making the picture browsing process more attractive and easy to use.
[0031] The present disclosure provides an image processing method, apparatus, device and storage medium. The present disclosure creates an image sequence by allocating a specific time period to each image to be switched, and at the same time monitors the user's touch events, and dynamically determines the target time point according to the user's sliding direction and sliding distance. This process utilizes timeline data, so that when rendering and switching images in the image sequence according to the target time point, an intuitive browsing experience can be achieved. This method not only improves the smoothness and visual appeal of image switching, but also reduces the memory usage caused by layer switching, thereby optimizing application performance and providing users with an efficient, resource-saving and attractive way to browse images.
[0032] In some optional embodiments, determining the target time point according to the sliding direction and sliding distance corresponding to the touch event includes:
[0033] If a first touch event is monitored, obtaining a sliding direction corresponding to the first touch event;
[0034] If the sliding direction is horizontal, the index value, current time and horizontal offset of the current image are obtained;
[0035] The target time point is determined according to the current image index value, the current time and the horizontal offset.
[0036] Specifically, the disclosed embodiment describes a process of controlling image sequence browsing based on user touch events. When the application "listens to the first touch event", the first touch event can be, for example, an onTouchMove event, that is, when the user performs a touch sliding operation on the screen for the first time, it will immediately obtain the sliding direction corresponding to the first touch event, and identify whether the user's finger is moving in the vertical direction or the horizontal direction. If the sliding direction is detected to be "horizontal", the scheme will further "obtain the index value, current time and horizontal offset of the current image", wherein the index value of the current image represents the position of the picture currently viewed by the user in the sequence, the current time represents the time elapsed from the beginning of browsing to the present, and the horizontal offset represents the distance the user slides in the horizontal direction. After obtaining the index value, current time and horizontal offset of the current image, this information is then used to determine the target time point", which refers to the start time of the next picture to be displayed corresponding to the user's sliding behavior. In this way, it is possible to dynamically render and switch to the correct picture according to the actual operation of the user, thereby providing an intuitive and smooth picture browsing experience.
[0037] In this way, by monitoring the first touch event and obtaining the corresponding sliding direction, when horizontal sliding is detected, the index value, current time and horizontal offset of the current image can be accurately captured. The real-time acquisition and analysis of these parameters enables the server to dynamically determine the target time point according to the user's sliding behavior, thereby achieving accurate rendering and smooth switching of images in the image sequence. This method not only improves the response speed and accuracy of image browsing, but also enhances the user experience, allowing users to control the browsing of images through intuitive gestures, making the entire interaction process more natural and seamless.
[0038] In some optional embodiments, if the first touch event is monitored, obtaining the sliding direction corresponding to the first touch event includes:
[0039] If the first touch event is monitored, the coordinate point corresponding to the first touch event is obtained to obtain the first coordinate;
[0040] If the second touch event is monitored, the current coordinate point corresponding to the second touch event is obtained to obtain the second coordinate;
[0041] Calculate the offset value between the first coordinate and the second coordinate in the horizontal direction to obtain a first offset value;
[0042] Calculate the offset value between the first coordinate and the second coordinate in the vertical direction to obtain a second offset value;
[0043] If the first offset value is greater than the second offset value, the sliding direction corresponding to the first touch event is a horizontal direction.
[0044] Specifically, when the application "listens to the first touch event", the first touch event may be, for example, an onTouchMove event. At this time, the coordinate point corresponding to the first touch event is obtained, that is, the coordinate point corresponding to the movement of the finger, which is called the "first coordinate". The second touch event may be, for example, an onTouchDown event. At this time, the coordinate point corresponding to the second touch event is obtained, that is, the coordinate point when the user first touches the screen, which is called the "second coordinate". After obtaining the first coordinate and the second coordinate, by comparing the two coordinate points, the offset value of the first coordinate and the second coordinate in the horizontal direction is calculated to obtain the first offset value, and the offset value of the first coordinate and the second coordinate in the vertical direction is calculated to obtain the "second offset value". If the first offset value is greater than the second offset value, it indicates that the movement of the user's finger is mainly in the horizontal direction, so it can be determined that the sliding direction corresponding to the first touch event is the horizontal direction. This judgment process is a key step in realizing gesture recognition and picture browsing control. It allows the application to decide how to respond according to the user's horizontal or vertical sliding, such as switching pictures or scrolling pages, thereby providing a smooth and intuitive user experience.
[0045] In this way, by monitoring the first touch event and the second touch event, the server can accurately obtain the user's touch coordinates on the screen, thereby calculating the offset values in the horizontal and vertical directions. This process enables the application to determine the user's sliding direction. If the horizontal offset value is greater than the vertical offset value, the server confirms that the user's sliding is mainly in the horizontal direction. This precise gesture recognition capability not only improves the user's interactive experience with the application, making image switching and browsing smoother and more natural, but also provides a reliable basis for subsequent image rendering and transition effects, thereby enhancing the overall visual effect and intuitiveness of operation.
[0046] In some optional embodiments, determining the target time point according to the index value of the current image, the current time, and the horizontal offset includes:
[0047] If the horizontal offset is greater than the preset value, the previous image adjacent to the current image is determined according to the index value of the current image to obtain the first image;
[0048] If the current time is greater than the start time of the first image, the difference between the current time and the horizontal offset is calculated to obtain the target time point.
[0049] Specifically, when the user slides on the screen, the server will monitor the horizontal offset generated by the sliding in real time. If this horizontal offset exceeds the preset threshold, the server will assume that the user intends to switch to the adjacent previous image. At this time, the server will determine the previous image adjacent to the current image based on the index value of the current image. This image is called the "first image". Next, the server will check whether the current time is greater than the start time of the first image to determine whether the current time is at or exceeds the time point when the first image should start to be displayed. If so, the server will further calculate the difference between the current time and the horizontal offset. This difference will be used to obtain the target time point, that is, the server will decide when and how to switch the display to the first image based on this, ensuring that the image switching is synchronized with the user's sliding action, thereby providing a consistent and smooth user experience.
[0050] In this way, by monitoring the horizontal offset and comparing it with the preset value, the user's sliding intention can be intelligently identified. When the user is detected to be willing to switch to the previous picture, the server will automatically locate the predecessor image of the current picture. In addition, by comparing the current time with the start time of the previous image, the server can accurately calculate the target time point to ensure that the rendering and switching of the picture are synchronized with the user's expectations. This method not only improves the response speed and accuracy of picture browsing, but also enhances the user experience, allowing users to control the browsing of pictures through intuitive gestures, making the entire interaction process more natural and seamless, thereby improving user satisfaction and operational convenience when using picture browsing or editing applications.
[0051] In some optional embodiments, determining the target time point according to the index value of the current image, the current time, and the horizontal offset further includes:
[0052] If the horizontal offset is less than or equal to the preset value, the next image adjacent to the current image is determined according to the index value of the current image to obtain a second image;
[0053] If the current time is greater than the start time of the second image, the difference between the current time and the horizontal offset is calculated to obtain the target time point.
[0054] Specifically, the horizontal offset refers to the horizontal distance that the finger moves when the user slides on the screen. The preset value is a threshold used to determine the user's sliding intention. When the horizontal offset generated by the user's sliding is less than or equal to this preset value, the server will interpret this behavior as the user's intention to view the next adjacent image. At this time, the server will "determine the next image adjacent to the current image based on the index value of the current image", which is called the "second image". If the "current time is greater than the start time of the second image", it means that the time point when the second image should start to be displayed is now or has passed, the server will calculate the difference between the current time and the horizontal offset, and this difference is the target time point. This target time point is used to guide the server to render and switch to the second image at the right time, thereby providing users with a coherent and smooth browsing experience. In short, this feature ensures that the server will only prepare to display the next image when the user's sliding is small enough and the current time is appropriate to achieve a smooth image transition effect.
[0055] In this way, by setting a preset value to determine the user's sliding intention, when the horizontal offset is less than or equal to this preset value, the server will intelligently identify that the user wants to view the next adjacent image, and determine the second image accordingly. Subsequently, if the current time has exceeded the start time of the second image, the server will calculate the difference between the current time and the horizontal offset to obtain the target time point. This process ensures that the rendering and switching of the image are precisely synchronized with the user's sliding action, providing users with a responsive and intuitive image browsing experience. This method not only improves the smoothness and accuracy of image switching, but also optimizes the performance of the application by reducing unnecessary operations and calculations, making the user experience more natural and pleasant.
[0056] In some optional embodiments, determining the target time point according to the sliding direction and sliding distance corresponding to the touch event further includes:
[0057] If the third touch event is monitored, the index value, current time and horizontal offset of the current image are obtained;
[0058] If the horizontal offset is greater than the preset value and the current time is less than the midpoint of the current image time period, the start time point of the previous image adjacent to the current image is used as the target time point.
[0059] Specifically, when the server "listens to the third touch event", i.e., the onTouchUp event, it collects three key parameters: the index value of the current image, the current time, and the horizontal offset. The horizontal offset refers to the horizontal distance that the user's finger moves when sliding on the screen, and the preset value is a threshold set in advance to determine whether the amplitude of the user's sliding is sufficient to trigger the image switch. If in this process, the horizontal offset is greater than the preset value, this indicates that the user's sliding action is significant enough and may want to switch to another image; at the same time, the current time is less than the midpoint of the current image time period, which means that the user slid during the first half of the current image display. In this case, the server will use the start time point of the previous image adjacent to the current image as the target time point, so as to prepare for the fallback switch of the image. This implementation process ensures that the server will respond to the image switch only when the user's sliding action is clear and occurs within the appropriate time, thereby providing a smooth and user-expected image browsing experience.
[0060] In this way, by obtaining the index value, current time and horizontal offset of the current image when monitoring the third touch event, the user's sliding intention can be intelligently judged. When it is detected that the horizontal offset exceeds the preset value and the current time is not halfway through, the server will recognize the user's sliding as an intention to roll back to the previous picture, and accordingly set the target time point to the start time of the previous picture. This design not only improves the application's response speed and accuracy to user operations, but also enhances the user's sense of control when browsing pictures, making the switching of pictures more in line with the user's immediate needs, thereby providing users with an intuitive, flexible and efficient picture browsing experience.
[0061] In some optional embodiments, the method further comprises:
[0062] If the horizontal offset is greater than a preset value, and the current time is greater than or equal to the midpoint of the current image time period, a preset time unit after the end time point of the current image is used as the target time point.
[0063] Specifically, the horizontal offset refers to the horizontal distance that the finger moves when the user slides on the screen; the preset value is a benchmark value set in advance to measure the significance of the user's sliding. When the user's horizontal offset exceeds this preset value, the server will assume that the user has a clear intention to switch to the next picture. At the same time, the current time refers to the time point from the beginning of the picture sequence to the present, and the midpoint of the current image time period refers to the time point halfway through the currently displayed picture. If the current time is greater than or equal to this midpoint, it means that the user has performed a sliding operation at a certain moment after half of the current picture has been displayed. In this case, the server sets a preset time unit after the end time point of the current picture as the target time point. This preset time unit can ensure that after the user slides, the server has enough time to prepare for the loading and display of the next picture. This implementation process ensures that the picture switching not only responds to the user's sliding operation, but also takes into account the integrity of the picture display, providing a smooth browsing experience that meets user expectations.
[0064] In this way, by evaluating the relationship between the horizontal offset and the preset value and the comparison between the current time and the midpoint of the image time period, it is intelligently determined when to hand over control to the next image. When the user's sliding amplitude exceeds the preset value and has viewed more than half of the current image, the server sets the target time point to a preset time unit after the end time of the current image, thereby ensuring that the image switching is both timely and in line with the user's browsing expectations. This method effectively improves the user experience, making the image transition smoother and more natural, while reducing the confusion caused by switching too early or too late, providing users with a more intuitive and comfortable way to browse images.
[0065] In some optional embodiments, before allocating time periods for the images to be switched to obtain the image sequence, the method further includes:
[0066] Set the transition time between different images to be switched.
[0067] Specifically, before generating the image sequence, each image to be switched is first assigned a time period. This step ensures that each image has a clear time frame when it is played. Specifically, this process involves "setting transition time between different images to be switched", which means that between the time periods of two adjacent images in the sequence, the server will reserve a specific time as the transition time. Transition time refers to the duration used to perform the transition effect between two images. Such transitions can be visual effects such as dissolve, slide, fade in and fade out. In this way, the solution achieves smooth transitions between images, enhances visual effects, and provides the possibility of creating attractive dynamic displays. After setting the transition time, all images together with their transition times are integrated into a continuous image sequence, providing accurate time guidance for subsequent image rendering and switching, thereby providing a coherent and visually engaging experience when users browse.
[0068] In this way, by setting the transition time between different images to be switched, a smooth and visually engaging transition effect between images is achieved. This design not only enhances the user experience, making image browsing more smooth and natural, but also provides the possibility to create creative display effects. The setting of transition time allows each image to have an appropriate display length, while ensuring that the switching between images does not appear abrupt, but is connected by carefully designed special effects, thereby enhancing the overall visual expression and professionalism of the application. In addition, this transition processing also helps to maintain the user's attention and interest during the browsing process, making the user feel a more pleasant and immersive experience when enjoying the content.
[0069] In order to facilitate the overall understanding of the technical solution of the present application, an example is given below. The method includes: first, a group of images is selected by the user, and these images are the images to be switched. After the user selects a group of images, the picture data is connected in series using a timeline data, which is similar to the timeline data of splicing images into a playable video. If 3 images are selected, a time period can be set for each image. For example, the time period corresponding to the first image can be 0-3s, the time period corresponding to the second image can be 3s-6s, and the time period corresponding to the third image can be 6s-9s. Next, the transition data is used to connect different images in series, and the transition effects are configured. Assuming that the transition time between different images is set to 1s, the time period corresponding to the first image is 0-3s, and the first transition is 3s-4s. In a similar manner, the subsequent images and the transition data time are extended accordingly.
[0070] Next, we monitor touch events. When the user touches the screen, the server monitors the onTouchDown event and records the coordinates of the touch point, which are downX and downY. For example, if the user's finger presses at (100, 200) on the screen, then downX = 100 and downY = 200.
[0071] When the user slides his finger, the server will listen to the onTouchMove event and calculate the difference between the coordinates x and y of the current touch point and the initial touch point downX and downY to get xDiff and yDiff. Here xDiff and yDiff represent the horizontal and vertical offsets respectively. If the condition xDiff*0.5>yDiff holds, it means that the user is mainly sliding in the horizontal direction. At this time, the server will obtain the index and current time of the current image and record dx, which is the sliding offset each time onTouchMove is called back, also known as the horizontal offset.
[0072] After obtaining the index of the current image and the current time, find the previous image to the left (left) and the next image to the right (right) of the current image according to the index of the current image and the current time, and select the corresponding image to switch according to the user's sliding direction (left or right).
[0073] Specifically, if dx>0, it means that the user slides from left to right (slides forward), the server will check whether the current time playTime is greater than the start time left.start of the previous picture. If so, the target time point seekTo=(long)(playTime-dx*2) is calculated, where seekTo represents the time of the picture to be rendered, playTime represents the current time, and dx represents the horizontal offset of the finger sliding when the user slides on the screen and each time the onTouchMove event is called back. A positive value indicates sliding to the right, and a negative value indicates sliding to the left. Here, the horizontal offset dx is multiplied by 2 to adjust the jump time point according to the user's sliding speed. This multiplier is used to simulate an acceleration effect, so that the faster the sliding, the more time to jump, and long represents a numerical type. If dx<=0, it is determined whether the current time playTime is greater than the start time right.start of the next picture, and seekTo=(long)(playTime-dx*2) is calculated in the same way. Since the parameter meaning of this expression is the same as the function function of the above expression, it will not be repeated here. Finally, the server will drive the screen rendering based on the calculated seekTo time point to ensure that the user sees the correct image and transition effect.
[0074] When the onTouchUp event is detected, that is, when the user lifts their finger, the server will perform inertial sliding to automatically switch the images. This process first involves determining the display ratio of the two currently displayed images to determine which image has a larger display ratio. The server will then automatically slide the image with a larger display ratio to the left or right side of the screen to complete the image switching. If the display ratios of the two images are the same, the server will determine the switching direction based on the direction of the last slide before the finger was lifted.
[0075] The specific implementation method is that the server will record the index and current time of the current image, and find the adjacent pictures. For example, if dx>0, it means that the user is sliding from left to right, and the server will record the start time of the current picture as start=current.start. If there is a previous picture on the left, its end time is recorded as end=left.end. The server will then determine whether the current time playTime is less than start+(end-start) / 2. If so, it is considered necessary to switch to the picture on the left and set seekTo to left.start; otherwise, seekTo will be set to end+10, which means rendering at a time point 10 time units after the end of the previous picture.
[0076] On the contrary, if dx<=0, it means that the user is sliding from right to left, and the server will record the start time of the next picture as start=right.start. If there is a next picture on the right, the end time of the current picture will be recorded as end=current.end. Similarly, the server will decide whether to switch to the current picture or the next picture based on the comparison result of playTime and start+(end-start) / 2, and seekTo will be set to current.start or end+10.
[0077] Finally, the server uses ValueAnimator to slide the attribute animation, setting the start time of the animation to playTime and the end time to seekTo. By configuring the appropriate interpolator, the server starts playing the attribute animation, achieving smooth and automatic sliding from the current image to the target image, providing users with a natural browsing experience.
[0078] The following describes an apparatus embodiment of the present application, which can be used to execute the image processing method in the above-mentioned embodiment of the present application. For details not disclosed in the apparatus embodiment of the present application, please refer to the above-mentioned embodiment of the image processing method of the present application.
[0079] The present disclosure also provides an image processing device 200, such as Figure 2As shown, including:
[0080] An allocation module 201 is used to allocate time periods for images to be switched to obtain an image sequence;
[0081] The processing module 202 is used to monitor the touch event, determine the target time point according to the sliding direction and sliding distance corresponding to the touch event, and render and switch the images in the image sequence according to the target time point.
[0082] In some optional embodiments, the processing module 202 determines the target time point according to the sliding direction and sliding distance corresponding to the touch event, including:
[0083] If a first touch event is monitored, obtaining a sliding direction corresponding to the first touch event;
[0084] If the sliding direction is horizontal, the index value, current time and horizontal offset of the current image are obtained;
[0085] The target time point is determined according to the current image index value, the current time and the horizontal offset.
[0086] In some optional embodiments, if the processing module 202 monitors the first touch event, obtaining the sliding direction corresponding to the first touch event includes:
[0087] If the first touch event is monitored, the coordinate point corresponding to the first touch event is obtained to obtain the first coordinate;
[0088] If the second touch event is monitored, the current coordinate point corresponding to the second touch event is obtained to obtain the second coordinate;
[0089] Calculate the offset value between the first coordinate and the second coordinate in the horizontal direction to obtain a first offset value;
[0090] Calculate the offset value between the first coordinate and the second coordinate in the vertical direction to obtain a second offset value;
[0091] If the first offset value is greater than the second offset value, the sliding direction corresponding to the first touch event is a horizontal direction.
[0092] In some optional embodiments, the processing module 202 determines the target time point according to the index value of the current image, the current time, and the horizontal offset, including:
[0093] If the horizontal offset is greater than the preset value, the previous image adjacent to the current image is determined according to the index value of the current image to obtain the first image;
[0094] If the current time is greater than the start time of the first image, the difference between the current time and the horizontal offset is calculated to obtain the target time point.
[0095] In some optional embodiments, the processing module 202 determines the target time point according to the index value of the current image, the current time and the horizontal offset, and further includes:
[0096] If the horizontal offset is less than or equal to the preset value, the next image adjacent to the current image is determined according to the index value of the current image to obtain a second image;
[0097] If the current time is greater than the start time of the second image, the difference between the current time and the horizontal offset is calculated to obtain the target time point.
[0098] In some optional embodiments, the processing module 202 determines the target time point according to the sliding direction and sliding distance corresponding to the touch event, and further includes:
[0099] If the third touch event is monitored, the index value, current time and horizontal offset of the current image are obtained;
[0100] If the horizontal offset is greater than the preset value and the current time is less than the midpoint of the current image time period, the start time point of the previous image adjacent to the current image is used as the target time point.
[0101] In some optional embodiments, the processing module 202 is further used to set a preset time unit after the end time point of the current image as the target time point if the horizontal offset is greater than a preset value and the current time is greater than or equal to the midpoint of the current image time period.
[0102] In some optional embodiments, the processing module 202 is further configured to set transition times between different images to be switched before allocating time periods for the images to be switched and obtaining the image sequence.
[0103] In the technical solution disclosed herein, the acquisition, storage and application of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0104] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0105] Figure 3A schematic block diagram of an example electronic device 300 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0106] like Figure 3 As shown, the electronic device 300 includes a computing unit 301, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 302 or a computer program loaded from a storage unit 308 into a random access memory (RAM) 303. In the RAM 303, various programs and data required for the operation of the device 300 can also be stored. The computing unit 301, the ROM 302, and the RAM 303 are connected to each other via a bus 304. An input / output (I / O) interface 305 is also connected to the bus 304.
[0107] A number of components in the device 300 are connected to the I / O interface 305, including: an input unit 306, such as a keyboard, a mouse, etc.; an output unit 307, such as various types of displays, speakers, etc.; a storage unit 308, such as a disk, an optical disk, etc.; and a communication unit 309, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 309 allows the device 300 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0108] The computing unit 301 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 301 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 301 performs the various methods and processes described above, such as image processing methods. For example, in some embodiments, the image processing method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 308. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 300 via ROM 302 and / or communication unit 309. When the computer program is loaded into RAM 303 and executed by the computing unit 301, one or more steps of the applet distribution described above may be performed. Alternatively, in other embodiments, the computing unit 301 may be configured to perform the image processing method in any other appropriate manner (e.g., by means of firmware).
[0109] Various embodiments of the server and technology described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0110] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0111] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0112] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0113] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0114] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0115] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0116] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. An image processing method, the method comprising: Allocate time periods for the images to be switched to obtain an image sequence; A touch event is monitored, a target time point is determined according to a sliding direction and a sliding distance corresponding to the touch event, and rendering and switching of images in the image sequence are performed according to the target time point.
2. The method according to claim 1, wherein: Determining a target time point according to a sliding direction and a sliding distance corresponding to the touch event includes: If a first touch event is monitored, obtaining a sliding direction corresponding to the first touch event; If the sliding direction is horizontal, the index value, current time and horizontal offset of the current image are obtained; A target time point is determined according to the current image index value, the current time, and the horizontal offset.
3. The method according to claim 2, wherein: If the first touch event is monitored, obtaining the sliding direction corresponding to the first touch event includes: If a first touch event is monitored, a coordinate point corresponding to the first touch event is acquired to obtain a first coordinate; If a second touch event is monitored, the current coordinate point corresponding to the second touch event is acquired to obtain a second coordinate; Calculating an offset value between the first coordinate and the second coordinate in a horizontal direction to obtain a first offset value; Calculating an offset value between the first coordinate and the second coordinate in a vertical direction to obtain a second offset value; If the first offset value is greater than the second offset value, the sliding direction corresponding to the first touch event is a horizontal direction.
4. The method according to claim 2, wherein: The determining the target time point according to the index value of the current image, the current time and the horizontal offset includes: If the horizontal offset is greater than a preset value, determining a previous image adjacent to the current image according to the index value of the current image to obtain a first image; If the current time is greater than the start time of the first image, the difference between the current time and the horizontal offset is calculated to obtain the target time point.
5. The method according to claim 4, wherein: The determining the target time point according to the index value of the current image, the current time and the horizontal offset further includes: If the horizontal offset is less than or equal to a preset value, determining a next image adjacent to the current image according to the index value of the current image to obtain a second image; If the current time is greater than the start time of the second image, the difference between the current time and the horizontal offset is calculated to obtain the target time point.
6. The method according to any one of claims 1 to 5, wherein: The determining of the target time point according to the sliding direction and sliding distance corresponding to the touch event also includes: If the third touch event is monitored, the index value, current time and horizontal offset of the current image are obtained; If the horizontal offset is greater than a preset value, and the current time is less than the midpoint of the current image time period, the start time point of the previous picture adjacent to the current image is used as the target time point.
7. The method according to claim 6, wherein: The method further comprises: If the horizontal offset is greater than a preset value, and the current time is greater than or equal to the midpoint of the current image time period, a preset time unit after the end time point of the current image is used as the target time point.
8. The method according to any one of claims 1 to 5, wherein: Before allocating time periods for the images to be switched to obtain the image sequence, the method further includes: A transition time is set between different images to be switched.
9. An image processing device, comprising: An allocation module, used for allocating time periods for images to be switched to obtain an image sequence; The processing module is used to monitor touch events, determine a target time point according to a sliding direction and a sliding distance corresponding to the touch event, and render and switch images in the image sequence according to the target time point.
10. The device according to claim 9, wherein: The processing module determines the target time point according to the sliding direction and the sliding distance corresponding to the touch event, including: If a first touch event is monitored, obtaining a sliding direction corresponding to the first touch event; If the sliding direction is horizontal, the index value, current time and horizontal offset of the current image are obtained; A target time point is determined according to the current image index value, the current time, and the horizontal offset.
11. The device according to claim 10, wherein: If the processing module monitors the first touch event, obtaining the sliding direction corresponding to the first touch event includes: If a first touch event is monitored, a coordinate point corresponding to the first touch event is acquired to obtain a first coordinate; If a second touch event is monitored, the current coordinate point corresponding to the second touch event is acquired to obtain a second coordinate; Calculating an offset value between the first coordinate and the second coordinate in a horizontal direction to obtain a first offset value; Calculating an offset value between the first coordinate and the second coordinate in a vertical direction to obtain a second offset value; If the first offset value is greater than the second offset value, the sliding direction corresponding to the first touch event is a horizontal direction.
12. The device according to claim 10, wherein: The processing module determines the target time point according to the index value of the current image, the current time and the horizontal offset, including: If the horizontal offset is greater than a preset value, determining a previous image adjacent to the current image according to the index value of the current image to obtain a first image; If the current time is greater than the start time of the first image, the difference between the current time and the horizontal offset is calculated to obtain the target time point.
13. The device according to claim 12, wherein: The processing module determines the target time point according to the index value of the current image, the current time and the horizontal offset, and further includes: If the horizontal offset is less than or equal to a preset value, determining a next image adjacent to the current image according to the index value of the current image to obtain a second image; If the current time is greater than the start time of the second image, the difference between the current time and the horizontal offset is calculated to obtain the target time point.
14. The device according to any one of claims 9 to 13, wherein: The processing module determines the target time point according to the sliding direction and sliding distance corresponding to the touch event, and further includes: If the third touch event is monitored, the index value, current time and horizontal offset of the current image are obtained; If the horizontal offset is greater than a preset value, and the current time is less than the midpoint of the current image time period, the start time point of the previous picture adjacent to the current image is used as the target time point.
15. The device according to claim 14, wherein: The processing module is also used to set a preset time unit after the end time point of the current image as the target time point if the horizontal offset is greater than a preset value and the current time is greater than or equal to the midpoint of the current image time period.
16. The device according to any one of claims 9 to 13, wherein: The processing module is further used to set transition time between different images of the to-be-switched images before allocating time periods for the to-be-switched images to obtain an image sequence.
17. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 8.
18. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-8.
19. A computer program product, comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 8.