Image display method and apparatus, and electronic device
By distinguishing between deformable and non-deformable elements in an image, generating a target region and filling it with deformable elements, the problems of image distortion and disharmony in proportion are solved, ensuring the visual aesthetic effect of the image when it adapts to changes.
Patent Information
- Application Number
- PCT/CN2025/086214
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-08-05
- Filing Date
- 2025-03-31
- Publication Date
- 2026-02-12
AI Technical Summary
Existing technologies can easily lead to image element distortion and disproportion when changing the size and aspect ratio of image materials, affecting the visual aesthetics.
By responding to user actions, the system identifies deformable and non-deformable elements in the image, generates target regions and fills them with deformable elements, while keeping non-deformable elements unchanged. This enables the image to adaptively stretch or shrink, avoiding element distortion.
It ensures that the image maintains its original layout and alignment when its size changes, without causing element deformation or distortion, thus guaranteeing a visually appealing aesthetic.
Smart Images

Figure CN2025086214_12022026_PF_FP_ABST
Abstract
Description
Method, device and electronic equipment for image display
[0001] The present application claims priority to the Chinese patent application No. 202411069516.1, filed on August 5, 2024, entitled "Method, device and electronic equipment for image display", the content of which is incorporated herein by reference in its entirety. TECHNICAL FIELD
[0002] The present application relates to the technical field of image processing, and more particularly, to a method, device and electronic equipment for image display. BACKGROUND
[0003] In various scenarios (such as handwriting notes, making presentations, etc.), users often need to change the size and aspect ratio of image materials to adapt to individual content needs. However, when using ordinary image scaling, the image elements will be distorted, the proportions will be uncoordinated and unattractive, and it will be difficult for users to accept. SUMMARY
[0004] The present application provides a method, device and electronic equipment for image display, which can adaptively change the image layout with the size of the image, avoid image distortion and distortion, and ensure visual aesthetic perception.
[0005] In a first aspect, a method for image display is provided, which includes: in response to a user operation of stretching a first image in a first direction, determining a stretching size of the first image, the first image including deformable elements and non-deformable elements; displaying a second image, a target region of the second image including target pixels, the target pixels being pixels repeated in the first direction for the deformable elements, a size of the target region in the first direction being equal to the stretching size, and the non-deformable elements being located outside the target region.
[0006] The first image is the image before stretching, and the second image is the image after stretching. The size of the second image is greater than the size of the first image. The first image can include deformable elements and non-deformable elements. The deformable elements can be understood as elements whose size changes during image stretching or image shrinking do not affect the display effect of the elements. The deformable elements can include straight lines, rectangles, etc. The non-deformable elements can be understood as elements whose size is fixed and cannot be deformed during image stretching or image shrinking. If the elements are deformed, it may affect the display effect of the elements. The non-deformable elements can include special characters, symbols, fonts, patterns formed by certain arrangement and combination, special-shaped patterns, etc.
[0007] The target pixel being a pixel repeated by the deformable element in the first direction can be understood as follows: in the first direction, the pixel value of the target pixel is the same as the pixel value of the deformable element.
[0008] In the embodiments of the present application, the electronic device can generate and display the second image according to the operation of the user stretching the first image. The second image includes a target region (i.e., a newly added region), the target region includes target pixels that are pixels repeated by the deformable element in the stretching direction, and the non-deformable element is located outside the target region. That is, in the case where the first image includes the deformable element and the non-deformable element, when the first image is stretched, the size of the deformable element on the first image changes and can be lengthened, and the size of the non-deformable element on the first image does not change and maintains the original alignment. Thus, the image layout can be adapted to the size of the image, so that the stretched image can maintain the original layout and alignment, without causing deformation and distortion of the elements, thereby ensuring the visual aesthetic perception.
[0009] In combination with the first aspect, in some implementations of the first aspect, the first image further includes a repeatable element, and the method further includes: in a case where the first direction is the same as the arrangement direction of the repeatable element, displaying the repeatable element in the target region.
[0010] It should be understood that the repeatable element is an element that appears repeatedly in the first image, that is, an element with a number of occurrences greater than or equal to 2 in the first image can be considered a repeatable element. For example, the first image can include multiple repeatable circles, straight lines, etc.
[0011] In the embodiments of the present application, in the case where the first image includes the repeatable element, when the first image is stretched, the repeatable element can be adaptively added according to the arrangement rule of the repeatable element, so that the image layout can be adapted to the change in the aspect ratio of the image.
[0012] In combination with the first aspect, in some implementations of the first aspect, before the second image is displayed, the method further includes: in response to a first operation of the user, determining a first division line, and the pixels on the first division line include the target pixels.
[0013] In the embodiments of the present application, the user can draw a first division line on the first image, so that the first image can be stretched according to the first division line, that is, the pixel filling of the target region is realized by repeatedly filling the pixels on the target region, and the second image is obtained.
[0014] In combination with the first aspect, in some implementations of the first aspect, the pixels on the first division line do not include the pixels of the non-deformable element.
[0015] In the embodiments of the present application, the pixels on the first split line do not include pixels of the non-deformable element, that is, when the first image is stretched based on the first split line, the non-deformable element on the first image will not be distorted, and will not affect the image layout of the second image after stretching, thereby ensuring the visual aesthetic perception.
[0016] With reference to the first aspect, in some implementations of the first aspect, the pixels on the first split line do not include pixels of the repeatable element.
[0017] In the embodiments of the present application, the pixels on the first split line do not include pixels of the repeatable element, that is, when the first image is stretched based on the first split line, the repeatable element on the first image will not be distorted, thereby avoiding affecting the image layout of the second image after stretching, and ensuring the visual aesthetic perception.
[0018] With reference to the first aspect, in some implementations of the first aspect, the non-deformable element includes a first element, and the first split line is arranged in a preset range of the first element.
[0019] In the embodiments of the present application, the first split line can avoid the non-deformable element and be arranged in a preset range of the non-deformable element, so that when the pixels on the first split line are repeatedly filled in the target area, the non-deformable element will not be distorted, and will not affect the image layout of the second image after stretching, thereby ensuring the visual aesthetic perception.
[0020] With reference to the first aspect, in some implementations of the first aspect, the method further includes: in response to a second operation of a user, determining a second split line, and the second split line and the first split line are located on two sides of the first element.
[0021] In the embodiments of the present application, the user can arrange the split line on both sides of the non-deformable first element, so that when the first image is stretched, the first element will not be distorted, and will not affect the image layout of the second image after stretching, thereby ensuring the visual aesthetic perception.
[0022] With reference to the first aspect, in some implementations of the first aspect, the non-deformable element further includes a second element, the second element is arranged at intervals with the first element along the first direction, and the first element and the second element are located inside the deformable element. The method further includes: in response to a second operation of a user, determining a second split line, and the second split line is arranged in a preset range of the second element.
[0023] In the embodiments of the present application, when there are multiple non-deformable elements, multiple segmentation lines can be drawn in the preset range of the multiple non-deformable elements, so that the non-deformable elements on the first image will not be distorted when the first image is stretched, and the image layout of the second image after stretching will not be affected, thereby ensuring the visual aesthetic perception.
[0024] With reference to the first aspect, in some implementations of the first aspect, the target region further includes background pixels, and pixel values on the background pixels are filled according to pixel values on the first segmentation line.
[0025] In the embodiments of the present application, when the background color of the first image is operated, the background pixels of the target region can be filled according to the pixel values on the stretching segmentation line (such as the first segmentation line), so that the second image after stretching retains the original color, thereby ensuring the visual aesthetic perception.
[0026] With reference to the first aspect, in some implementations of the first aspect, the non-deformable element includes a third element, and a relative position of the third element on the first image is different from a relative position of the third element on the second image.
[0027] In the embodiments of the present application, during the stretching of the first image, the position of the non-deformable element on the first image can change, for example, from a first position to a second position, that is, the relative position of the non-deformable third element on the first image is different from the relative position of the non-deformable third element on the second image, so that the non-deformable element on the first image will not be distorted, and at the same time, the original layout design of the image is ensured, thereby ensuring the visual aesthetic perception.
[0028] With reference to the first aspect, in some implementations of the first aspect, before the second image is displayed, the method further includes: displaying an intermediate image, the intermediate image including the first image and a first region, the first region being a region between the boundary of the first image and the boundary of the second image, and the display color of the first region and the background color of the first image belonging to the same color system.
[0029] In the embodiments of the present application, considering the different performance of electronic devices, in some examples, before displaying the second image, an intermediate image can be displayed on the electronic device, the intermediate image including the first image and a first region, the first region being a region between the boundary of the first image and the boundary of the second image, and the display color of the first region and the background color of the first image belonging to the same color system, for example, the first region can fill the background color of the first image with a transparency of 30%. Further, the above method can realize the filling of the first region, and finally display the stretched second image, so that the non-deformable elements in the stretched second image do not deform, and the layout is neat and beautiful.
[0030] In a second aspect, a method for image display is provided, including: determining a stretching direction and a stretching size of a first image; determining an element type included in the first image according to the stretching direction, the element type including a deformable element and a non-deformable element; determining a stretching split line according to the element type of the first image and the stretching direction; determining a target region of a second image according to the first image, the stretching direction and the stretching size, the second image being a stretched image; and filling the target region according to pixels on the stretching split line.
[0031] In the embodiments of the present application, when the first image is stretched, first, the element type included in the first image is determined based on the stretching direction; then, the stretching split line can be determined according to the element type of the first image and the stretching direction; finally, the target region (or the new region) of the second image can be filled by the pixels on the stretching split line; thereby, the image layout can be adapted to the size of the image, so that the stretched image can maintain the original layout and alignment, without causing deformation and distortion of the elements, and the visual aesthetic perception is ensured.
[0032] In combination with the second aspect, in some implementations of the second aspect, the element type further includes a repeatable element, and the method further includes: if the repeatable element is located on both sides of the stretching split line, filling the target region with the repeatable element.
[0033] In the embodiments of the present application, in the case that the first image includes the repeatable element and the repeatable element is located on both sides of the stretching split line, the repeatable element can be filled in the target region (or the new region). That is, for the repeatable element in the image, the repeatable element can be adaptively increased according to the arrangement rule of the repeatable element, so that the image layout can be adapted to the change of the aspect ratio of the image.
[0034] With reference to the second aspect, in some implementations of the second aspect, before the filling the repeatable element on the target region, the method further includes: removing the repeatable element from the first image; and filling pixel values at positions corresponding to the repeatable element on the first image using a mean value of pixels within a preset range outside the repeatable element.
[0035] In the embodiments of the present application, for the repeatable element on the first image, the repeatable element can be first removed from the first image, and then the background hole repair of the first image can be performed, for example, pixel values at positions corresponding to the repeatable element on the first image are filled using a mean value of pixels within a preset range outside the repeatable element, so that the first image after removing the repeatable element can be obtained, and then the pixel filling of the new region or the target region can be realized by repeatedly copying and stretching the pixels on the stretching division line.
[0036] With reference to the second aspect, in some implementations of the second aspect, the filling the repeatable element on the target region includes: determining a total number of repeatable elements to be filled on the second image according to the stretching size, a maximum distance of the repeatable element on the first image, and a distance between adjacent repeatable elements; and determining a filling position of the repeatable element on the second image according to the total number of repeatable elements, a position of a first repeatable element, and the distance between adjacent repeatable elements.
[0037] In the embodiments of the present application, when the repeatable element is located on both sides of the stretching division line, all the repeatable elements are first removed from the first image, and the background hole repair of the first image is performed; then the pixel filling of the target region of the second image is realized by repeatedly copying and stretching the pixels on the stretching division line; finally, the total number of repeatable elements to be filled on the second image is determined according to the stretching size, the maximum distance of the repeatable element on the first image, and the distance between adjacent repeatable elements; and the filling of the repeatable elements is sequentially performed from the first repeatable element as a starting point according to the total number of repeatable elements and the distance between adjacent repeatable elements, and the target region of the second image is also filled with corresponding repeatable elements.
[0038] With reference to the second aspect, in some implementations of the second aspect, the stretching division line does not overlap with the non-deformable element.
[0039] In the embodiments of the present application, the pixels on the stretching division line do not include the pixels of the non-deformable element, that is, when the first image is stretched based on the stretching division line, the non-deformable element on the first image will not be distorted, and the image layout of the second image after stretching will not be affected, thereby ensuring the visual aesthetic feeling.
[0040] With reference to the second aspect, in some implementations of the second aspect, the determining the element type of each hierarchical element according to the stretching direction comprises: performing binarization processing on the first image to obtain a binarization image corresponding to the first image; performing contour detection and line segment detection on the binarization image to obtain hierarchical elements of the first image; and performing element classification on each hierarchical element according to the stretching direction to determine the element type of each hierarchical element.
[0041] In the embodiments of the present application, after the first image is obtained, the first image can be classified hierarchically according to the stretching direction of the first image to determine the element type of each hierarchical element, so that based on the hierarchical classification result, the original alignment of the non-deformable element can be maintained, the size of the deformable element can be changed, and the repeatable element can be increased at equal intervals in the stretching direction.
[0042] With reference to the second aspect, in some implementations of the second aspect, the hierarchical elements include first hierarchical elements, and the determining the element type of each hierarchical element comprises: determining a first element of the first hierarchical element as a repeatable element if the shape similarity degree, the area intersection ratio, and the distance of the average color vector of the first element and a second element of the first hierarchical element all satisfy a preset condition; and determining the first element as a non-repeatable element if any one of the shape similarity degree, the area intersection ratio, and the distance of the average color vector of the first element and the second element of the first hierarchical element does not satisfy the preset condition.
[0043] In a possible implementation, if the shape similarity degree of a first element and another element (such as a second element) is greater than a first threshold, the area intersection ratio of the first element and the other element (such as the second element) is greater than a second threshold, and the distance of the average color vector of the first element and the other element (such as the second element) is less than a third threshold, the first element can be considered as a same repeatable element.
[0044] In the embodiments of the present application, when the element classification is performed on each hierarchical element, whether there is a repeatable element can be determined based on the shape similarity degree, the area intersection ratio, and the distance of the average color vector, so that based on the hierarchical classification result, the original alignment of the non-deformable element can be maintained, the size of the deformable element can be changed, and the repeatable element can be increased at equal intervals in the stretching direction.
[0045] With reference to the second aspect, in some implementations of the second aspect, in response to determining that the first element is a non-repeatable element, the determining of the element type of each element of each level comprises: determining that the first element is a deformable element if it is determined that the first element is located in a deformable image library; and determining that the first element is a non-deformable element if it is determined that the first element is not located in the deformable image library.
[0046] In the embodiments of the present application, in response to determining that the first element is a non-repeatable element, the first element can be further matched with a deformable image library. If it is determined that the first element is located in the deformable image library, the first element is determined to be a deformable element. Otherwise, the first element is determined to be a non-deformable element. Thus, based on the hierarchical classification result, the original alignment can be maintained for non-deformable elements, the size of deformable elements can be changed, and the repeatable elements can be increased at equal intervals in the stretching direction.
[0047] In a third aspect, a method for displaying an image is provided. The method comprises: in response to an operation of a user contracting a first image in a first direction, determining a contraction size of the first image, the first image comprising deformable elements and non-deformable elements, the first image comprising a target region and a non-target region, the target region comprising target pixels, the target pixels being pixels repeated by the deformable elements in the first direction, a size of the target region being shortened in the first direction being equal to the contraction size, the non-deformable elements being located outside the target region; and displaying a second image, the second image comprising the non-target region.
[0048] In the third aspect, the first image is an image before contraction, and the second image is an image after contraction. The size of the second image is smaller than the size of the first image. The first image can comprise deformable elements and non-deformable elements. The deformable elements can be understood as elements whose size changes do not affect the display effect of the elements during image stretching or image contraction. The deformable elements can comprise, for example, straight lines, rectangles, etc. The non-deformable elements can be understood as elements whose size is fixed and cannot be deformed during image stretching or image contraction. If the elements are deformed, the display effect of the elements can be affected. The non-deformable elements can comprise, for example, special characters, symbols, fonts, patterns formed by certain arrangement and combination, special-shaped patterns, etc.
[0049] In the embodiments of the present application, the electronic device can generate and display a second image according to the user's operation of shrinking the first image. The first image includes a target region and a non-target region, the target region includes pixels repeated in the stretching direction of the deformable element, and the non-deformable element is located outside the target region, that is, in the non-target region. The second image obtained by shrinking only includes the non-target region, that is, the target region is deleted and the non-target region is retained. That is, in the case where the first image includes deformable elements and non-deformable elements, when the first image is shrunk, the size of the deformable element on the first image changes and can be shortened, and the size of the non-deformable element on the first image does not change and maintains the original alignment. Thus, the image layout can be adapted to the size of the image, so that the stretched image can maintain the original layout and alignment, without causing deformation and distortion of the elements, thereby ensuring the visual aesthetic perception.
[0050] In combination with the third aspect, in some implementations of the third aspect, the first image further includes a plurality of repeatable elements, and in a case where the first direction is the same as the arrangement direction of the repeatable elements, the target region includes at least one of the repeatable elements.
[0051] It should be understood that the repeatable element is an element that appears repeatedly in the first image, that is, an element with a number of occurrences greater than or equal to 2 in the first image can be considered as a repeatable element. For example, the first image can include a plurality of repeatable circles, straight lines, etc.
[0052] In the embodiments of the present application, in the case where the first image includes repeatable elements, when the first image is shrunk, the repeatable elements in the target region are deleted and can be adaptively reduced according to the arrangement rule of the repeatable elements, so that the image layout can be adapted to the aspect ratio of the image.
[0053] In combination with the third aspect, in some implementations of the third aspect, before the second image is displayed, the method further includes: in response to a first operation of the user, determining a first division line, and the pixels on the first division line include the pixels repeated in the first direction of the deformable element.
[0054] In the embodiments of the present application, the user can draw a first division line on the first image, so that the first image can be shrunk according to the first division line, that is, the pixels on the first division line are repeatedly deleted to achieve the purpose of deleting the target region, and the second image obtained does not include the target region.
[0055] In combination with the third aspect, in some implementations of the third aspect, the pixels on the first division line do not include the pixels on the non-deformable element.
[0056] In the embodiments of the present application, the pixels on the first split line do not include pixels on the non-deformable element, that is, when the first image is shrunk based on the first split line, the non-deformable element on the first image will not be distorted, and will not affect the image layout of the second image after shrinking, thereby ensuring the visual aesthetic perception.
[0057] With reference to the third aspect, in some implementations of the third aspect, the pixels on the first split line do not include pixels of the repeatable element.
[0058] In the embodiments of the present application, the pixels on the first split line do not include pixels of the repeatable element, that is, when the first image is shrunk based on the first split line, the repeatable element on the first image will not be distorted, thereby avoiding affecting the image layout of the second image after shrinking, and ensuring the visual aesthetic perception.
[0059] With reference to the third aspect, in some implementations of the third aspect, the non-deformable element includes a first element, and the first split line is arranged in a preset range of the first element.
[0060] In the embodiments of the present application, the first split line can avoid the non-deformable element and be arranged in a preset range of the non-deformable element, so that when the pixels on the first split line are repeatedly deleted in the target area, the non-deformable element will not be distorted, and will not affect the image layout of the second image after shrinking, thereby ensuring the visual aesthetic perception.
[0061] With reference to the third aspect, in some implementations of the third aspect, the method further includes: in response to a second operation of the user, determining a second split line, and the second split line and the first split line are located on two sides of the first element.
[0062] In the embodiments of the present application, the user can arrange the split line on both sides of the non-deformable first element, so that when the first image is shrunk, the first element will not be distorted, and will not affect the image layout of the second image after shrinking, thereby ensuring the visual aesthetic perception.
[0063] With reference to the third aspect, in some implementations of the third aspect, the non-deformable element further includes a second element, the second element is arranged at intervals with the first element along the first direction, the first element and the second element are located inside the deformable element, and the method further includes: in response to a second operation of the user, determining a second split line, and the second split line is arranged in a preset range of the second element.
[0064] In the embodiments of the present application, when there are multiple non-deformable elements, multiple segmentation lines can be drawn in the preset range of the multiple non-deformable elements, so that the non-deformable elements on the first image will not be distorted when the first image is shrunk, and the image layout of the second image after shrinking will not be affected, thereby ensuring the visual aesthetic perception.
[0065] With reference to the third aspect, in some implementations of the third aspect, the non-deformable element includes a third element, and a relative position of the third element on the first image is different from a relative position of the third element on the second image.
[0066] In the embodiments of the present application, during the process of shrinking the first image, the position of the non-deformable element on the first image can be changed, for example, from a first position to a second position, that is, the relative position of the non-deformable third element on the first image is different from the relative position of the non-deformable third element on the second image, so that the non-deformable element on the first image will not be distorted, and the original layout design of the image is ensured, thereby ensuring the visual aesthetic perception.
[0067] The fourth aspect provides a method for displaying an image, which includes: determining a shrinking direction and a shrinking size of a first image; determining an element type included in the first image according to the shrinking direction, the element type including a deformable element and a non-deformable element; determining a shrinking segmentation line according to the element type of the first image and the shrinking direction; determining a target area of the first image according to the first image, the shrinking direction and the shrinking size; and repeatedly deleting pixels on the shrinking segmentation line to delete the target area.
[0068] In the embodiments of the present application, when the first image is shrunk, the element type included in the first image is first determined based on the shrinking direction, then the shrinking segmentation line is determined according to the element type of the first image and the shrinking direction, and finally the target area of the first image is deleted by repeatedly deleting the pixels on the shrinking segmentation line, thereby realizing the adaptive change of the image layout with the size of the image, so that the original layout and alignment of the shrunk image can be maintained, the deformation and distortion of the element can be avoided, and the visual aesthetic perception is ensured.
[0069] With reference to the fourth aspect, in some implementations of the fourth aspect, the element type further includes a repeatable element, and the method further includes: if the repeatable element is located on both sides of the shrinking segmentation line, deleting the repeatable element in the target area.
[0070] In the embodiments of the present application, in the case that the first image includes repeatable elements and the repeatable elements are located on both sides of the stretching split line, the repeatable elements in the target region can be deleted. That is, for the repeatable elements in the image, the reduction can be adaptively performed according to the arrangement rule of the repeatable elements, so that the image layout can be adaptively changed following the image aspect ratio.
[0071] With reference to the fourth aspect, in some implementations of the fourth aspect, before the pixels on the repeat deletion contraction split line are deleted, the method further includes: removing the repeatable elements from the first image; and filling the pixel values at the positions corresponding to the repeatable elements on the first image using the average values of the pixels within a preset range outside the repeatable elements.
[0072] In the embodiments of the present application, for the repeatable elements on the first image, the repeatable elements can be first removed from the first image, and then the background holes of the first image can be repaired, for example, the pixel values at the positions corresponding to the repeatable elements on the first image are filled using the average values of the pixels within a preset range outside the repeatable elements, so that the first image after the repeatable elements are removed can be obtained, and then the pixels on the repeat deletion contraction split line are deleted to realize the deletion of the target region.
[0073] With reference to the fourth aspect, in some implementations of the fourth aspect, the method further includes: determining the total number of the repeatable elements to be filled on the second image according to the contraction size, the maximum distance of the repeatable elements on the first image, and the interval of adjacent repeatable elements; and determining the filling positions of the repeatable elements on the second image according to the total number of the repeatable elements, the position of the first repeatable element, and the interval of the adjacent repeatable elements.
[0074] In the embodiments of the present application, when the repeatable elements are located on both sides of the contraction split line, all the repeatable elements are first removed from the first image, and the background holes of the first image are repaired; then the pixels on the repeat deletion contraction split line are deleted to realize the deletion of the target region; finally, the total number of the repeatable elements to be filled on the second image is determined according to the contraction size, the maximum distance of the repeatable elements on the first image, and the interval of adjacent repeatable elements; and the filling of the repeatable elements is sequentially performed from the first repeatable element as the starting point according to the total number of the repeatable elements and the interval of adjacent repeatable elements.
[0075] With reference to the fourth aspect, in some implementations of the fourth aspect, the contraction split line does not overlap with the non-deformable element.
[0076] In the embodiments of the present application, the pixels on the contraction segmentation line do not include the pixels on the non-deformable element, that is, when the first image is stretched based on the contraction segmentation line, the non-deformable element on the first image will not be distorted, and will not affect the image layout of the second image after contraction, thereby ensuring the visual aesthetic perception.
[0077] With reference to the fourth aspect, in some implementations of the fourth aspect, the determining, according to the contraction direction, the element type of each element of the first image, comprises: performing a binaryzation processing on the first image to determine a binaryzation image corresponding to the first image; performing contour detection and line segment detection on the binaryzation image to determine hierarchical elements of the first image; and performing element classification on each hierarchical element according to the contraction direction to determine the element type of each hierarchical element.
[0078] In the embodiments of the present application, after the first image is obtained, the first image can be classified hierarchically according to the contraction direction of the first image to determine the element type of each hierarchical element, so that based on the hierarchical classification result, the original alignment of the non-deformable element can be maintained, the size of the deformable element can be changed, and the repeatable element can be reduced at equal intervals in the contraction direction.
[0079] With reference to the fourth aspect, in some implementations of the fourth aspect, the hierarchical elements include first hierarchical elements, and the determining the element type of each hierarchical element comprises: if the shape similarity degree, the area intersection ratio, and the distance of the average color vector of a first element of the first hierarchical element and a second element of the first hierarchical element all satisfy a preset condition, determining that the first element is a repeatable element; and if any one of the shape similarity degree, the area intersection ratio, and the distance of the average color vector of the first element of the first hierarchical element and the second element of the first hierarchical element does not satisfy the preset condition, determining that the first element is a non-repetitive element.
[0080] In a possible implementation, if the shape similarity degree of a first element and another element (such as a second element) is greater than a first threshold value, the area intersection ratio of the first element and the other element (such as the second element) is greater than a second threshold value, and the distance of the average color vector of the first element and the other element (such as the second element) is less than a fourth threshold value, it can be considered that the first element and the other element (such as the second element) are the same repeatable element.
[0081] In the embodiments of the present application, when the element classification is performed on each hierarchical element, whether there is a repeatable element can be determined based on the shape similarity degree, the area intersection ratio, and the distance of the average color vector, so that based on the hierarchical classification result, the original alignment of the non-deformable element can be maintained, the size of the deformable element can be changed, and the repeatable element can be reduced at equal intervals in the contraction direction.
[0082] In some implementations of the fourth aspect, in a case where it is determined that the first element is a non-repeatable element, the determining of the element type of each element of each level comprises: determining that the first element is a deformable element if it is determined that the first element is located in a deformable image library; and determining that the first element is a non-deformable element if it is determined that the first element is not located in the deformable image library.
[0083] In the embodiments of the present application, in a case where it is determined that the first element is a non-repeatable element, the first element can be further matched with the deformable image library, and if it is determined that the first element is located in the deformable image library, the first element is determined to be a deformable element; otherwise, the first element is determined to be a non-deformable element. Thus, based on the hierarchical classification result, the original alignment can be maintained for non-deformable elements, the size of deformable elements can be changed, and repeatable elements can be reduced at equal intervals in the contraction direction.
[0084] In a fifth aspect, a method for displaying an image is provided. The method comprises: in response to a user operation of stretching a first image in a first direction, determining a stretching size of the first image, the first image comprising repeatable elements; and displaying a second image, a target region of the second image comprising the repeatable elements, a size of the target region in the first direction being equal to the stretching size.
[0085] In the embodiments of the present application, the first image can be a beautiful sticker image or an artistic line formed by a special arrangement of repeatable elements. In a case where the first image only comprises repeatable elements, the electronic device can generate and display a second image according to the user operation of stretching the first image, the second image comprising a target region (i.e., a new region), and the target region can present the repeatable elements at equal intervals, so that the repeatable elements can be added adaptively according to the arrangement rule of the repeatable elements when the first image is stretched, and manual copying of the repeatable elements is avoided, which is more efficient and convenient.
[0086] In a sixth aspect, a method for displaying an image is provided. The method comprises: in response to a user operation of contracting a first image in a first direction, determining a contraction size of the first image, the first image comprising repeatable elements, the first image comprising a target region and a non-target region, the target region comprising at least one of the repeatable elements, and a size of the target region in the first direction being equal to the contraction size; and displaying a second image, the second image comprising the non-target region.
[0087] In the embodiments of the present application, the first image can be a beautiful sticker image or artistic line formed by special arrangement of repeatable elements. In the case that the first image only includes repeatable elements, the electronic device can generate and display the second image according to the operation of the user shrinking the first image; wherein the first image includes a target region and a non-target region, and the second image only includes the non-target region, which is equivalent to deleting the repeatable elements in the target region, so that the repeatable elements can be automatically reduced according to the arrangement rule of the repeatable elements when the first image is shrunk, avoiding manual deletion of the repeatable elements, and being more efficient and convenient.
[0088] The detailed explanations and beneficial effect descriptions in the following technical solutions can refer to the related contents in the first aspect to the sixth aspect, and will not be repeated here.
[0089] In a seventh aspect, an apparatus for image display is provided, which includes a processing module and a display module. The processing module is configured to: in response to an operation of a user stretching a first image in a first direction, determine a stretching size of the first image, the first image including deformable elements and non-deformable elements; and the display module is configured to: display a second image, a target region of the second image including target pixels, the target pixels being pixels of the deformable elements repeated in the first direction, a size of the target region in the first direction being equal to the stretching size, and the non-deformable elements being located outside the target region.
[0090] In combination with the seventh aspect, in some implementations of the seventh aspect, the first image further includes repeatable elements, and the display module is further configured to: in a case that the first direction is the same as an arrangement direction of the repeatable elements, display the repeatable elements in the target region.
[0091] In combination with the seventh aspect, in some implementations of the seventh aspect, before the second image is displayed, the processing module is further configured to: in response to a first operation of the user, determine a first division line, pixels on the first division line including the target pixels.
[0092] In combination with the seventh aspect, in some implementations of the seventh aspect, the pixels on the first division line do not include pixels on the non-deformable elements.
[0093] In combination with the seventh aspect, in some implementations of the seventh aspect, the pixels on the first division line do not include pixels of the repeatable elements.
[0094] In combination with the seventh aspect, in some implementations of the seventh aspect, the non-deformable elements include first elements, and the first division line is arranged in a preset range of the first elements.
[0095] In some embodiments of the seventh aspect, in response to a second operation of the user, the processing module is further configured to determine a second split line, the second split line and the first split line being located on two sides of the first element.
[0096] In some embodiments of the seventh aspect, the non-deformable element further includes a second element, the second element being arranged apart from the first element along the first direction, the first element and the second element being located inside the deformable element, and in response to a second operation of the user, the processing module is further configured to determine a second split line, the second split line being arranged within a preset range of the second element.
[0097] In some embodiments of the seventh aspect, the target region further includes a background pixel, a pixel value of the background pixel being filled according to a pixel value on the first split line.
[0098] In some embodiments of the seventh aspect, the non-deformable element includes a third element, a relative position of the third element on the first image being different from a relative position of the third element on the second image.
[0099] In some embodiments of the seventh aspect, before displaying the second image, the display module is further configured to display an intermediate image, the intermediate image including the first image and a first region, the first region being a region between a boundary of the first image and a boundary of the second image, a display color of the first region and a background color of the first image belonging to a same color system.
[0100] An eighth aspect provides an apparatus for image display, the apparatus including a processing module configured to: determine a stretching direction and a stretching size of a first image; determine, according to the stretching direction, an element type included in the first image, the element type including a deformable element and a non-deformable element; determine a stretching split line according to the element type of the first image and the stretching direction; determine a target region of a second image according to the first image, the stretching direction and the stretching size, the second image being a stretched image; and fill the target region according to a pixel on the stretching split line.
[0101] In some embodiments of the eighth aspect, the element type further includes a repeatable element, and in response to the repeatable element being located on two sides of the stretching split line, the processing module is further configured to fill the target region with the repeatable element.
[0102] In some implementations of the eighth aspect, in combination with the eighth aspect, before filling the repeatable elements on the target region, the processing module is further configured to: remove the repeatable elements from the first image; and fill pixel values in positions corresponding to the repeatable elements on the first image using a mean value of pixels within a preset range outside the repeatable elements.
[0103] In some implementations of the eighth aspect, in combination with the eighth aspect, the processing module is further configured to: determine a total number of repeatable elements to be filled on the second image according to the stretching size, a maximum distance of repeatable elements on the first image, and a distance between adjacent repeatable elements; and determine filling positions of repeatable elements on the second image according to the total number of repeatable elements, a position of a first repeatable element, and the distance between adjacent repeatable elements.
[0104] In some implementations of the eighth aspect, in combination with the eighth aspect, the stretching split line does not overlap with the non-deformable element.
[0105] In some implementations of the eighth aspect, in combination with the eighth aspect, the processing module is further configured to: perform a binarization process on the first image to determine a binarized image corresponding to the first image; perform contour detection and line segment detection on the binarized image to determine hierarchical elements of the first image; and perform element classification on each hierarchical element according to the stretching direction to determine an element type of the each hierarchical element.
[0106] In some implementations of the eighth aspect, in combination with the eighth aspect, the hierarchical elements include a first hierarchical element, and the processing module is further configured to: if a shape similarity degree, an area intersection-over-union ratio, and a distance of average color vectors of a first element of the first hierarchical element and a second element of the first hierarchical element all satisfy a preset condition, determine that the first element is a repeatable element; and if any one of the shape similarity degree, the area intersection-over-union ratio, and the distance of average color vectors of the first element of the first hierarchical element and the second element of the first hierarchical element does not satisfy the preset condition, determine that the first element is a non-repeatable element.
[0107] In some implementations of the eighth aspect, in combination with the eighth aspect, in a case where the first element is determined to be a non-repeatable element, the processing module is further configured to: if it is determined that the first element is located in a deformable image library, determine that the first element is a deformable element; and if it is determined that the first element is not located in the deformable image library, determine that the first element is a non-deformable element.
[0108] In a ninth aspect, an apparatus for image display is provided, the apparatus comprising a processing module and a display module, the processing module configured to: in response to an operation of a user to contract a first image in a first direction, determine a contraction size of the first image, the first image comprising a deformable element and a non-deformable element, the first image comprising a target region and a non-target region, the target region comprising target pixels, the target pixels being pixels of the deformable element repeated in the first direction, a size of the target region shortened in the first direction being equal to the contraction size, the non-deformable element being located outside the target region; and the display module configured to: display a second image, the second image comprising the non-target region.
[0109] With reference to the ninth aspect, in some implementations of the ninth aspect, the first image further comprises a plurality of repeatable elements, and in a case where the first direction is the same as a direction of arrangement of the repeatable elements, the target region comprises at least one of the repeatable elements.
[0110] With reference to the ninth aspect, in some implementations of the ninth aspect, before the display of the second image, the processing module is further configured to: in response to a first operation of the user, determine a first division line, pixels on the first division line comprising the target pixels.
[0111] With reference to the ninth aspect, in some implementations of the ninth aspect, the pixels on the first division line do not comprise pixels on the non-deformable element.
[0112] With reference to the ninth aspect, in some implementations of the ninth aspect, the pixels on the first division line do not comprise pixels of the repeatable elements.
[0113] With reference to the ninth aspect, in some implementations of the ninth aspect, the non-deformable element comprises a first element, and the first division line is disposed within a preset range of the first element.
[0114] With reference to the ninth aspect, in some implementations of the ninth aspect, the processing module is further configured to: in response to a second operation of the user, determine a second division line, the second division line and the first division line being located on two sides of the first element.
[0115] With reference to the ninth aspect, in some implementations of the ninth aspect, the non-deformable element further comprises a second element, the second element being arranged apart from the first element in the first direction, the first element and the second element being located inside the deformable element, and the processing module is further configured to: in response to the second operation of the user, determine the second division line, the second division line being disposed within a preset range of the second element.
[0116] In conjunction with the ninth aspect, in some implementations of the ninth aspect, the indeformable element includes a third element, the relative position of which on the first image is different from the relative position of which on the second image.
[0117] In a tenth aspect, an image display apparatus is provided, the apparatus including a processing module configured to: determine a shrinkage direction and a shrinkage size of a first image; determine, based on the shrinkage direction, an element type comprising deformable elements and non-deformable elements in the first image; determine a shrinkage dividing line based on the element type of the first image and the shrinkage direction; determine a target region of the first image based on the first image, the shrinkage direction, and the shrinkage size; and repeatedly delete pixels on the shrinkage dividing line to delete the target region.
[0118] In conjunction with the tenth aspect, in some implementations of the tenth aspect, the element type further includes repeatable elements, and the processing module is further configured to: if the repeatable elements are located on both sides of the shrinking dividing line, then delete the repeatable elements in the target area.
[0119] In conjunction with the tenth aspect, in some implementations of the tenth aspect, before repeatedly deleting pixels on the shrinking dividing line, the processing module is further configured to: remove the repeatable element from the first image; and fill the pixel value at the position corresponding to the repeatable element on the first image with the average pixel value within a preset range surrounding the repeatable element.
[0120] In conjunction with the tenth aspect, in some implementations of the tenth aspect, the processing module is further configured to: determine the total number of repeatable elements to be filled in the second image based on the shrinkage size, the maximum distance between repeatable elements in the first image, and the spacing between adjacent repeatable elements; and determine the filling position of the repeatable elements in the second image based on the total number of repeatable elements, the position of the first repeatable element, and the spacing between adjacent repeatable elements.
[0121] In conjunction with aspect ten, in some implementations of aspect ten, the contraction dividing line does not overlap with the non-deformable element.
[0122] In conjunction with the tenth aspect, in some implementations of the tenth aspect, the processing module is further configured to: perform binarization processing on the first image to determine the binarized image corresponding to the first image; perform contour detection and line segment detection on the binarized image to determine the hierarchical elements of the first image; and classify each hierarchical element according to the contraction direction to determine the element type of each hierarchical element.
[0123] In some implementations of the tenth aspect, in conjunction with the tenth aspect, the hierarchical elements include a first hierarchical element, and the processing module is further configured to: determine the first element as a repeatable element if the first element of the first hierarchical element and a second element of the first hierarchical element satisfy the preset condition in terms of shape similarity, area intersection-over-union ratio, and distance of average color vectors; and determine the first element as a non-repeatable element if the first element of the first hierarchical element and the second element of the first hierarchical element do not satisfy the preset condition in terms of any one of shape similarity, area intersection-over-union ratio, and distance of average color vectors.
[0124] In some implementations of the tenth aspect, in conjunction with the tenth aspect, in a case where the first element is determined as a non-repeatable element, the processing module is further configured to: determine the first element as a deformable element if the first element is determined to be located in a deformable image library; and determine the first element as a non-deformable element if the first element is determined not to be located in the deformable image library.
[0125] In an eleventh aspect, an apparatus for image display is provided. The apparatus includes a processing module and a display module. The processing module is configured to: determine a stretch size of a first image in response to an operation of a user stretching the first image in a first direction, the first image including repeatable elements; and the display module is configured to: display a second image, a target region of the second image including the repeatable elements, a size of the target region in the first direction being equal to the stretch size.
[0126] In a twelfth aspect, an apparatus for image display is provided. The apparatus includes a processing module and a display module. The processing module is configured to: determine a shrink size of a first image in response to an operation of a user shrinking the first image in a first direction, the first image including repeatable elements, the first image including a target region and a non-target region, the target region including at least one of the repeatable elements, a size of the target region in the first direction being equal to the shrink size; and the display module is configured to: display a second image, the second image including the non-target region.
[0127] In a twelfth aspect, an electronic device is provided, the electronic device comprising a memory and a processor, wherein the memory is configured to store computer program code, and the processor is configured to execute the computer program code stored in the memory to implement the method of the first aspect or any possible implementation of the first aspect, or implement the method of the second aspect or any possible implementation of the second aspect, or implement the method of the third aspect or any possible implementation of the third aspect, or implement the method of the fourth aspect or any possible implementation of the fourth aspect, or implement the method of the fifth aspect or any possible implementation of the fifth aspect, or implement the method of the sixth aspect or any possible implementation of the sixth aspect.
[0128] In a thirteenth aspect, a computer-readable storage medium is provided, the computer-readable storage medium having stored thereon computer programs or instructions that, when executed, implement the method of the first aspect or any possible implementation of the first aspect, or implement the method of the second aspect or any possible implementation of the second aspect, or implement the method of the third aspect or any possible implementation of the third aspect, or implement the method of the fourth aspect or any possible implementation of the fourth aspect, or implement the method of the fifth aspect or any possible implementation of the fifth aspect, or implement the method of the sixth aspect or any possible implementation of the sixth aspect.
[0129] In a fourteenth aspect, a chip is provided, the chip having stored therein instructions that, when executed on a device, cause the chip to perform the method of the first aspect or any possible implementation of the first aspect, or perform the method of the second aspect or any possible implementation of the second aspect, or perform the method of the third aspect or any possible implementation of the third aspect, or implement the method of the fourth aspect or any possible implementation of the fourth aspect, or implement the method of the fifth aspect or any possible implementation of the fifth aspect, or implement the method of the sixth aspect or any possible implementation of the sixth aspect.
[0130] In a fifteenth aspect, a computer program product is provided, the computer program product having stored therein computer programs or instructions that, when executed, implement the method of the first aspect or any possible implementation of the first aspect, or implement the method of the second aspect or any possible implementation of the second aspect, or implement the method of the third aspect or any possible implementation of the third aspect, or implement the method of the fourth aspect or any possible implementation of the fourth aspect, or implement the method of the fifth aspect or any possible implementation of the fifth aspect, or implement the method of the sixth aspect or any possible implementation of the sixth aspect. BRIEF DESCRIPTION OF DRAWINGS
[0131] FIG. 1 is a structural schematic diagram of an electronic device according to an embodiment of the present application.
[0132] FIG. 2 is a software structural block diagram of an electronic device according to an embodiment of the present application.
[0133] FIG. 3 is a schematic flowchart of a method for image stretching according to an embodiment of the present application.
[0134] FIG. 4 is a schematic diagram of a graphical user interface of an electronic device according to an embodiment of the present application.
[0135] FIGS. 5 to 10 are schematic diagrams of image stretching according to an embodiment of the present application.
[0136] FIGS. 11 to 16 are schematic diagrams of stretching a split line according to an embodiment of the present application.
[0137] FIGS. 17 to 20 are schematic diagrams of a graphical user interface of an electronic device according to an embodiment of the present application.
[0138] FIG. 21 is a schematic diagram of an image stretching or shrinking process according to an embodiment of the present application.
[0139] FIG. 22 is a schematic flowchart of another method for image stretching according to an embodiment of the present application.
[0140] FIGS. 23 and 24 are schematic flowcharts of a method for image classification according to an embodiment of the present application.
[0141] FIG. 25 is a schematic flowchart of another method for image stretching according to an embodiment of the present application.
[0142] FIG. 26 is a schematic flowchart of a method for image shrinking according to an embodiment of the present application.
[0143] FIG. 27 is a schematic diagram of image shrinking according to an embodiment of the present application.
[0144] FIG. 28 is a schematic diagram of a graphical user interface of another electronic device according to an embodiment of the present application.
[0145] FIGS. 29 and 30 are schematic flowcharts of a method for image shrinking according to an embodiment of the present application.
[0146] FIG. 31 is a schematic diagram of an apparatus for picture display according to an embodiment of the present application.
[0147] FIG. 32 is a schematic diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0148] In the description of the present embodiments, unless otherwise stated, " / " means the meaning of or, for example, A / B can mean A or B; the "and / or" in this document only describes the association relationship of the associated objects, which means that there can be three relationships, for example, A and / or B, which can represent the three cases of A alone, A and B together, and B alone. In addition, in the description of the present embodiments, "plurality" or "multiple" means two or more than two.
[0149] Hereinafter, the terms "first" and "second" are only for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined with "first" and "second" can explicitly or implicitly include one or more of the features. In the description of the present embodiments, unless otherwise stated, the meaning of "multiple" is two or more than two.
[0150] The terms used in the following embodiments are only for the purpose of describing the specific embodiments and are not intended to be limiting on the present application. As used in the specification and the appended claims of the present application, the singular forms "a," "an," and "the" are intended to include, for example, the expression "one or more," unless the context clearly indicates otherwise. It should also be understood that in the following embodiments of the present application, "at least one" or "one or more" means one, two or more than two. The term "and / or" is used to describe the association relationship of the associated objects, which means that there can be three relationships; for example, A and / or B, which can represent the three cases of A alone, A and B together, and B alone, where A and B can be singular or plural. The character " / " generally represents an "or" relationship between the associated objects before and after.
[0151] In the present specification, the reference to "one embodiment" or "some embodiments" and the like means that the specific features, structures or characteristics described in connection with the embodiment are included in one or more embodiments of the present application. Therefore, the statements "one embodiment", "some embodiments", "another embodiment", "other embodiments" and the like appearing in different places in the present specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized. The terms "include", "contain", "have" and their variants mean "include but not limited to", unless otherwise specifically emphasized.
[0152] The method for image display provided in the embodiments of the present application can be applied to electronic devices such as mobile phones, tablet computers, wearable devices, vehicle-mounted devices, augmented reality (AR) / virtual reality (VR) devices, notebook computers, ultra-mobile personal computers (UMPCs), netbooks, personal digital assistants (PDAs), smart home devices, office large screens, and the like. The embodiments of the present application do not limit the specific type of the electronic device, and the electronic device can be controlled by touch or by a mouse. When a user attempts to change the size and the aspect ratio of an image by touch or by a mouse, the system identifies the direction and the size of the user's dragging, and adaptively changes the image in real time to make it into a target size, avoids the deformation and distortion of elements, and ensures the visual aesthetic perception.
[0153] For example, FIG. 1 shows a structural schematic diagram of an electronic device 100. The electronic device 100 can include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a loudspeaker 170A, a receiver 170B, a microphone 170C, a headset interface 170D, a sensor module 180, a key 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, and the like. The sensor module 180 can include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, and the like.
[0154] It can be understood that the structure shown in the embodiments of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 can include more or fewer components than shown, or combine certain components, or split certain components, or different arrangement of components. The components shown can be implemented in hardware, software, or a combination of software and hardware.
[0155] The processor 110 can include one or more processing units, for example: the processor 110 can include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units can be independent devices or integrated in one or more processors.
[0156] The controller can be the nerve center and command center of the electronic device 100. The controller can generate operation control signals according to instruction operation codes and timing signals, and complete the control of fetching and executing instructions.
[0157] The memory in the processor 110 can also be configured to store instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory can save instructions or data that the processor 110 has just used or repeatedly uses. If the processor 110 needs to use the instructions or data again, it can directly call from the memory. This avoids repeated access and reduces the waiting time of the processor 110, thereby improving the efficiency of the system.
[0158] In some embodiments, the processor 110 can include one or more interfaces. The interfaces can include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0159] The USB interface 130 is an interface conforming to the USB standard specification, and can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transmit data between the electronic device 100 and a peripheral device. It can also be used to connect a headset to play audio through the headset. The interface can also be used to connect other electronic devices, such as AR devices, etc.
[0160] It can be understood that the interface connection relationship between the modules shown in the embodiments of the present application is only illustrative and does not constitute a structural limitation on the electronic device 100. In some other embodiments of the present application, the electronic device 100 can also use different interface connection modes or combinations of multiple interface connection modes in the above embodiments.
[0161] The charging management module 140 is used to receive charging input from a charger. The charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 can receive charging input from a wired charger through the USB interface 130. In some wireless charging embodiments, the charging management module 140 can receive wireless charging input through the wireless charging coil of the electronic device 100. The charging management module 140 can charge the battery 142 while also supplying power to the electronic device through the power management module 141.
[0162] The power management module 141 is used to connect the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140 to supply power to the processor 110, the internal memory 121, the external memory, the display screen 194, the camera 193, and the wireless communication module 160, etc. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle count, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 141 can also be disposed in the processor 110. In some other embodiments, the power management module 141 and the charging management module 140 can also be disposed in the same device.
[0163] The wireless communication function of the electronic device 100 can be realized through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor, and the baseband processor, etc.
[0164] The antenna 1 and the antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be multiplexed to improve the utilization rate of the antennas. For example, the antenna 1 can be multiplexed as a diversity antenna for a wireless local area network. In some other embodiments, the antennas can be used in combination with a tuning switch.
[0165] The mobile communication module 150 can provide a solution for wireless communication including 2G / 3G / 4G / 5G, etc. applied to the electronic device 100. The mobile communication module 150 can include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves by the antenna 1, and perform filtering, amplification, etc. on the received electromagnetic waves, and transfer the same to the modem processor for demodulation. The mobile communication module 150 can also amplify signals modulated by the modem processor, and radiate the same as electromagnetic waves through the antenna 1. In some embodiments, at least part of the functional modules of the mobile communication module 150 can be disposed in the processor 110. In some embodiments, at least part of the functional modules of the mobile communication module 150 can be disposed in the same device as at least part of the modules of the processor 110.
[0166] The modem processor can include a modulator and a demodulator. The modulator is configured to modulate a low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is configured to demodulate a received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. The low-frequency baseband signal processed by the baseband processor is transmitted to the application processor. The application processor outputs a sound signal through an audio device (not limited to the speaker 170A, the microphone 170B, etc.), or displays an image or a video through the display screen 194. In some embodiments, the modem processor can be a separate device. In other embodiments, the modem processor can be independent of the processor 110, and disposed in the same device as the mobile communication module 150 or other functional modules.
[0167] The wireless communication module 160 can provide a solution for wireless communication including wireless local area networks (WLAN) (e.g., wireless fidelity (Wi-Fi) network), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR) technology, etc. applied to the electronic device 100. The wireless communication module 160 can be one or more devices that integrate at least one communication processing module. The wireless communication module 160 receives an electromagnetic wave via the antenna 2, frequency-modulates and filters the electromagnetic wave signal, and transmits the processed signal to the processor 110. The wireless communication module 160 can also receive a signal to be transmitted from the processor 110, frequency-modulate it, amplify it, and radiate it as an electromagnetic wave via the antenna 2.
[0168] In some embodiments, the antenna 1 and the mobile communication module 150 of the electronic device 100 are coupled, and the antenna 2 and the wireless communication module 160 are coupled, so that the electronic device 100 can communicate with a network and other devices through wireless communication technology. The wireless communication technology can include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology, etc. The GNSS can include a global positioning system (GPS), a global navigation satellite system (GLONASS), a beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS), and / or a satellite based augmentation systems (SBAS).
[0169] The electronic device 100 implements a display function through a GPU, a display screen 194, and an application processor, etc. The GPU is a microprocessor for image processing, which is connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 can include one or more GPUs, which execute program instructions to generate or change display information.
[0170] The display screen 194 is configured to display images, videos, and the like. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flex light-emitting diode (FLED), a Miniled, a MicroLed, a Micro-oLed, a quantum dot light emitting diodes (QLED), or the like. In some embodiments, the electronic device 100 can include one or N display screens 194, where N is a positive integer greater than 1.
[0171] The electronic device 100 can implement the photographing function through the ISP, the camera 193, the video codec, the GPU, the display screen 194, and the application processor.
[0172] The ISP is configured to process the data fed back by the camera 193. For example, when taking a photo, the shutter is opened, the light is transmitted to the camera photosensitive element through the lens, the light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing to convert it into an image visible to the naked eye. The ISP can also optimize the noise, brightness, and skin color of the image. The ISP can also optimize the exposure, color temperature, and other parameters of the shooting scene. In some embodiments, the ISP can be disposed in the camera 193.
[0173] The camera 193 is configured to capture still images or videos. An object generates an optical image through a lens and projects it onto a photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, which is then transmitted to the ISP to convert it into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV, or the like format. In some embodiments, the electronic device 100 can include one or N cameras 193, where N is a positive integer greater than 1.
[0174] The digital signal processor is used to process digital signals, in addition to being able to process digital image signals, it can also process other digital signals. For example, when the electronic device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy, etc.
[0175] The video codec is used to compress or decompress digital video. The electronic device 100 can support one or more video codecs. In this way, the electronic device 100 can play or record videos in multiple encoding formats, such as: moving picture experts group (MPEG) 1, MPEG 2, MPEG 3, MPEG 4, etc.
[0176] The NPU is a neural-network (NN) calculation processor, which can quickly process input information by drawing on the structure of a biological neural network, such as drawing on the transmission mode between human brain neurons, and can also constantly self-learn. Through the NPU, the electronic device 100 can realize intelligent cognition applications such as image recognition, face recognition, voice recognition, text understanding, etc.
[0177] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to realize data storage functions. For example, music, video, etc. Files are saved in the external memory card.
[0178] The internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 executes various function applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 can include a program storage area and a data storage area. The program storage area can store an operating system, at least one App required by a function (such as a sound playing function, an image playing function, etc.), etc. The data storage area can store data created during the use of the electronic device 100 (such as audio data, a phonebook, etc.), etc. In addition, the internal memory 121 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, a universal flash memory (UFS), etc.
[0179] The electronic device 100 can realize audio functions through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the earphone interface 170D, and the application processor, etc. For example, music playing, recording, etc.
[0180] The audio module 170 is configured to convert digital audio information into an analog audio signal output, and to convert an analog audio input into a digital audio signal. The audio module 170 can also be configured to encode and decode audio signals. In some embodiments, the audio module 170 can be disposed in the processor 110, or some of the functions of the audio module 170 can be disposed in the processor 110.
[0181] The speaker 170A, also referred to as a "loudspeaker", is configured to convert an audio electrical signal into a sound signal. The electronic device 100 can listen to music or listen to a hands-free call through the speaker 170A.
[0182] The receiver 170B, also referred to as a "earpiece", is configured to convert an audio electrical signal into a sound signal. When the electronic device 100 receives a call or a voice message, the user can listen to the voice through the receiver 170B close to the ear.
[0183] The microphone 170C, also referred to as a "microphone", "sound collector", is configured to convert a sound signal into an electrical signal. When making a call or sending a voice message, the user can make a sound through the mouth close to the microphone 170C, and input the sound signal into the microphone 170C. The electronic device 100 can be provided with at least one microphone 170C. In other embodiments, the electronic device 100 can be provided with two microphones 170C, in addition to collecting sound signals, noise reduction functions can also be realized. In other embodiments, the electronic device 100 can also be provided with three, four or more microphones 170C, in addition to collecting sound signals, noise reduction, and can also identify the source of the sound, realize directional recording function, etc.
[0184] The earphone interface 170D is configured to connect a wired earphone. The earphone interface 170D can be a USB interface 130, or a 3.5mm open mobile terminal platform (OMTP) standard interface, a cellular telecommunications industry association of the USA (CTIA) standard interface.
[0185] The keys 190 include a power key, a volume key, etc. The keys 190 can be mechanical keys. They can also be touch keys. The electronic device 100 can receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 100.
[0186] The motor 191 can generate a vibration prompt. The motor 191 can be used for incoming call vibration prompt, and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, playing audio, etc.) can correspond to different vibration feedback effects. The motor 191 can also correspond to different vibration feedback effects for touch operations acting on different regions of the display screen 194. Different application scenarios (such as time reminders, received messages, alarms, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also be customized.
[0187] The indicator 192 can be an indicator light, which can be used to indicate a charging state, a power change, and can also be used to indicate a message, a missed call, a notification, etc.
[0188] The SIM card interface 195 is used to connect a SIM card. The SIM card can be inserted into or pulled out of the SIM card interface 195 to realize contact and separation with the electronic device 100. The electronic device 100 can support one or N SIM card interfaces, and N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, etc. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the multiple cards can be the same or different. The SIM card interface 195 can also be compatible with different types of SIM cards. The SIM card interface 195 can also be compatible with external storage cards. The electronic device 100 interacts with a network through a SIM card to realize functions such as calling and data communication. In some embodiments, the electronic device 100 uses an embedded SIM (eSIM) card, that is, an embedded SIM card. The eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100.
[0189] It should be understood that the phone card in the embodiments of the present application includes but is not limited to a SIM card, an eSIM card, a universal subscriber identity module (USIM), a universal integrated circuit card (UICC), etc.
[0190] The software system of the electronic device 100 can adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture. The embodiments of the present application take an Android system with a layered architecture as an example to exemplarily illustrate the software structure of the electronic device 100.
[0191] FIG. 2 is a software structure block diagram of the electronic device 100 according to an embodiment of the present application. A layered architecture divides the software into several layers, each of which has a clear role and division of labor. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom, the application layer, the application framework layer, the Android runtime and system library, and the kernel layer. The application layer can include a series of application packages.
[0192] As shown in FIG. 2, the application package can include camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, etc.
[0193] The application framework layer provides the application layer with application programming interfaces (APIs) and programming frameworks. The application framework layer includes some pre-defined functions.
[0194] As shown in FIG. 2, the application framework layer can include window manager, content provider, view system, phone manager, resource manager, notification manager, etc.
[0195] The window manager is used to manage window programs. The window manager can obtain the size of the display screen, determine whether there is a status bar, lock the screen, and take screenshots, etc.
[0196] The content provider is used to store and obtain data, and make the data accessible to the application. The data can include video, image, audio, dialed and received calls, browsing history and bookmarks, phonebook, etc.
[0197] The view system includes visual controls, such as controls that display text, controls that display pictures, etc. The view system can be used to build an application. A display interface can be composed of one or more views. For example, a display interface that includes a short message notification icon can include a view that displays text and a view that displays a picture.
[0198] The phone manager is used to provide the communication function of the electronic device 100. For example, the management of the call state (including call connection, call hang-up, etc.).
[0199] The resource manager provides various resources for the application, such as localized strings, icons, pictures, layout files, video files, etc.
[0200] The notification manager enables an application to display notification information in the status bar, which can be used to convey a message of the notification type, and can automatically disappear after a short stay without user interaction. For example, the notification manager is used to notify the completion of downloading, message reminders, etc. The notification manager can also be a notification in the form of a chart or a scroll bar text appearing in the top status bar of the system, such as a notification of a background running application, and can also be a notification in the form of a dialog window appearing on the screen. For example, the status bar prompts text information, emits a prompt sound, the electronic device vibrates, the indicator light flashes, etc.
[0201] The Android runtime includes a core library and a virtual machine. The Android runtime is responsible for scheduling and managing the Android system.
[0202] The core library includes two parts: one part is the function function that the java language needs to call, and the other part is the core library of Android.
[0203] The application layer and the application framework layer run in the virtual machine. The virtual machine executes the java file of the application layer and the application framework layer into a binary file. The virtual machine is used to perform the management of the object life cycle, the management of the stack, the management of the thread, the management of the security and the exception, and the garbage collection, etc.
[0204] The system library can include multiple functional modules. For example: a surface manager, media libraries, a three-dimensional graphics processing library (for example: OpenGL ES), a 2D graphics engine (for example: SGL), etc.
[0205] The surface manager is used to manage the display subsystem, and provides a fusion of 2D and 3D layers for multiple applications.
[0206] The media library supports multiple commonly used audio, video format playback and recording, and static image files, etc. The media library can support multiple audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
[0207] The three-dimensional graphics processing library is used to realize three-dimensional graphics drawing, image rendering, synthesis, and layer processing, etc.
[0208] The 2D graphics engine is a drawing engine for 2D drawing.
[0209] The kernel layer is a layer between hardware and software. The kernel layer at least includes a display driver, a camera driver, an audio driver, and a sensor driver.
[0210] It should be understood that the technical solutions in the embodiments of the present application can be used in Android, IOS, Harmony, etc.
[0211] The technical solution of the embodiment of the application can be applied to an editing and creating scene that needs to stretch or shrink an image. For example, the technical solution can be applied to a scene of handwriting notes, making a presentation, and the like.
[0212] The electronic device can be a television, an office large screen, a desktop computer, a notebook computer, and can also be a portable electronic device such as a mobile phone, a foldable screen, a tablet computer, a camera, a video camera, a video recorder, and can also be a smart home device such as a refrigerator, a washing machine, a sweeping machine, or any electronic device with an image processing capability, and can also be an electronic device in a 5G network or an electronic device in a future evolved public land mobile network (PLMN), and the like.
[0213] FIG. 3 is a schematic flowchart of a method for stretching an image according to an embodiment of the application. As shown in FIG. 3, the method 300 for stretching an image can include S310 to S330, and the method 300 for stretching an image can be applied to the electronic device 100.
[0214] S310, obtaining a first image, the first image can include a deformable element and a non-deformable element.
[0215] For example, the first image can be a sticker image provided by the electronic device, or can be a custom image imported by a user.
[0216] For example, as shown in FIG. 4, FIG. 4 shows a schematic diagram of a graphical user interface of an electronic device. For example, when a user edits a note 1, the user can perform an operation of stretching or shrinking a loaded first image. The graphical interface of the note 1 can include a title bar A1, a toolbar A2, and a work area A3. The title bar A1 can be used to display the name of a current file, for example, “note 1”. The toolbar A2 can be used to display function buttons that can be used to edit a note, for example, a “gallery” function button B1, a “sticker” function button B2, a “zoom in” function button, and the like. The work area A3 can be used to display a sticker or an image obtained by the user.
[0217] In one example, in response to an operation of the user clicking the “gallery” function button B1 in the toolbar A2, a plurality of images in the gallery can be displayed on the display interface of the electronic device, and the plurality of images include an image 1. In response to an operation of the user selecting the image 1, the image 1 can be displayed on the display interface of the electronic device.
[0218] In another example, in response to the operation of the user pressing the "sticker" function button B2 in the toolbar A2, a plurality of stickers can be displayed on the display interface of the electronic device, and the plurality of stickers include a sticker C1; in response to the operation of the user selecting the sticker C1, the sticker C1 can be displayed on the display interface of the electronic device.
[0219] It should be understood that the first image can include deformable elements and non-deformable elements. Among them, the deformable element can be understood as the change of the size of the element itself during the image stretching or image shrinking process does not affect the display effect of the element; the deformable element may, for example, include straight lines, rectangles, etc. The non-deformable element can be understood as the size of the element itself is fixed and cannot be deformed and distorted during the image stretching or image shrinking process, and if the element is deformed, it may affect the display effect of the element; the non-deformable element may, for example, include special characters, symbols, fonts, patterns formed by a certain arrangement and combination, special-shaped patterns, etc.
[0220] For example, the first image can include a plurality of repeatable circles, straight lines, etc.
[0221] It should be noted that after the first image is obtained, the first image can be classified according to the image classification method provided in the present application to determine the element type included in the first image, and the element type can include repeatable elements, deformable elements and non-deformable elements. The content of the image classification will be specifically described in combination with FIG. 23 and FIG. 24.
[0222] S320, stretching the first image in a first direction to determine a stretching size of the first image.
[0223] In some examples, in response to the operation of the user stretching the first image in the first direction, the stretching size of the first image can be determined. For example, the stretching size can be determined according to the starting position and the end position of the first image. Among them, the first direction can be horizontal or vertical, that is, the first image can be stretched horizontally or vertically.
[0224] For example, as shown in FIG. 5, the user can stretch the original image horizontally, and the horizontal stretching size of the original image is d1. In addition, the non-deformable element (such as the three-petal flower pattern) in the original image does not change, and the relative position of the non-deformable element in the image after horizontal stretching does not change compared with the relative position in the original image. The deformable element (such as the straight line) in the original image is stretched horizontally, and the total length of the straight line after horizontal stretching is d1.
[0225] In some examples, in response to the user clicking or long-pressing the first image, the display interface displays a first control including options for image stretch size and / or image target size; in response to the user clicking the options for image stretch size and / or image target size, the display interface displays a second control including option boxes for at least one of image horizontal stretch size, image vertical stretch size, and image target size; and in response to the user filling in values in the option boxes, the electronic device determines the stretch size of the first image.
[0226] It should be understood that during the stretching of the first image, the stretch size of the first image can be confirmed synchronously, so that the second image after stretching can be displayed synchronously on the display interface of the electronic device.
[0227] S330, display the second image. The target region of the second image includes target pixels, which are pixels repeated by the deformable elements in the first direction, and the size of the target region in the first direction is equal to the stretch size. The target region can be considered as an added region of the second image relative to the first image, and the non-deformable elements are located outside the target region.
[0228] It should be understood that during the image stretching, the deformable elements on the image are stretched, the non-deformable elements are located outside the target region, and no deformation distortion occurs. The layout arrangement of the second image obtained by this method is consistent with that of the first image, and problems such as layout disorder and proportion disorder do not occur.
[0229] In some examples, as shown in (a) of FIG. 6, the second image can include a target region, which can be located in a partial region at the bottom end of the second image. The first image is stretched downward along the first direction to form the second image. The target region on the second image can be the portion of the first image that is stretched downward. The target region includes pixels repeated by the deformable elements (two rectangles) in the first direction, and the non-deformable elements (characters REMNDER) are located outside the target region.
[0230] In some examples, as shown in (b) of FIG. 6, the second image can include a target region (i.e., the region between the dashed lines in (b) of FIG. 6), which can be located in the middle part of the second image. The target region can include target pixels, which can be repeated pixels of the deformable elements (such as two rectangles) in the first direction, and the non-deformable elements (such as characters REMNDER) are located outside the target region. That is, after the first image is stretched by the stretching method of the present application, the deformable elements in the first image are stretched, and the non-deformable elements in the first image maintain the original alignment without deformation distortion, so that when the first image is stretched, the image layout can follow the adaptive change of the image aspect ratio, ensuring that the image layout is neat, coordinated, and aesthetically pleasing.
[0231] In some embodiments, the size of the target region along the first direction can be equal to the stretching size. For example, the first direction can be a horizontal direction (transverse direction) or a vertical direction (longitudinal direction). In this case, the first image can be stretched along the horizontal direction or the vertical direction.
[0232] For example, before stretching the first image, the stretching split line of the first image can be determined, and the first image can be stretched based on the stretching split line.
[0233] As shown in (b) of FIG. 6, the first image can be a sticker, and the first image can include a non-deformable element (REMINDER) and a deformable element (two rectangles). Before stretching the first image, the stretching split line of the first image can be determined, and the stretching split line can be perpendicular to the stretching direction (i.e., the first direction, the vertical direction). The part of the first image above the stretching split line is the first part, and the part below the stretching split line is the second part. After stretching the first image along the first direction to obtain the second image, the added region of the second image relative to the first image can be the target region, and the target region can include target pixels, which can be repeated pixels of the deformable element along the first direction. That is, when stretching downward along the first direction, the newly added region can be filled by copying the pixels on the stretching split line, so that the length of the first image is increased, but the overall layout of the second image is not changed, and the layout is neat and coordinated.
[0234] For example, the stretching split line can be multiple, as shown in FIG. 7. When the first image shown in FIG. 7 is stretched in the horizontal direction, the non-deformable element REMNDER is centered and arranged in the first direction (horizontal direction), so that when the first image is stretched in the horizontal direction, the non-deformable element REMNDER will be deformed and stretched in the conventional manner, affecting the appearance. When the first image is stretched in the manner of the present application, a stretching split line (i.e., a first split line and a second split line) can be generated on both sides of the non-deformable element, the first split line can be located on the left side of the non-deformable element REMNDER, and the second split line can be located on the right side of the non-deformable element REMNDER. The first image can be divided into a first part, a second part, and a third part. When the first image is stretched in the first direction (horizontal direction), the first part where the non-deformable element REMNDER is located does not deform, and the target area 1 is filled by copying the pixels on the first split line, and the target area 2 is filled by copying the pixels on the second split line. The target area 1 and the target area 2 form the target area described above, so that the width of the first image increases, but the overall layout of the second image formed does not change, and the layout is neat and coordinated.
[0235] In some examples, in the case where the first image includes a repeatable element, the method 300 can further include: in the case where the first direction is the same as the arrangement direction of the repeatable element, displaying the repeatable element in the target area.
[0236] For example, as shown in FIG. 8, the first image can be the sticker C1 shown in FIG. 4, the first image can include deformable elements (rounded rectangles and right-angle rectangles), non-deformable elements (character list TO DO LIST and date ______), and repeatable elements (circles and straight lines), and the arrangement direction of the repeatable elements is the same as the first direction. During the stretching of the first image in the first direction, the non-deformable elements do not change and maintain the original alignment; the size of the deformable elements changes and is elongated; the repeatable elements increase at equal intervals in the stretching direction, and the target area can display the repeatable elements.
[0237] Exemplarily, as shown in FIG. 9, the first image can be a sticker image of the password manager, for the user to record the account and password. The first image can include deformable elements, non-deformable elements, and repeatable elements, where the deformable elements include a rectangle; the non-deformable elements include a key icon, a text password manager, an account, a password, a character, and the like; and the repeatable elements include a text account, a password, a same-side rounded rectangle, a horizontal line segment, a vertical line segment, and a dashed line segment. Wherein, the arrangement direction of the repeatable elements is the same as the stretching direction (i.e., the first direction), and thus, during stretching of the first image along the first direction, the non-deformable elements do not change and maintain the original alignment; the size of the deformable elements changes and is elongated; and the repeatable elements increase at equal intervals in the stretching direction, and the target region can display the repeatable elements.
[0238] Exemplarily, as shown in (a) of FIG. 10 and (b) of FIG. 10, the first image can be an image composed of repeatable elements, for example, the first image can be a sticker image or an artistic line that is formed by a special arrangement of repeatable elements. That is, the first image can only include repeatable elements, and stretching of the first image along the first direction can form a second image, and the target region (or the newly added region) of the second image can display one or more groups of repeatable elements, and the repeatable elements increase at equal intervals in the stretching direction, and the number of repeatable elements can be determined according to the stretching size and the size of the repeatable elements.
[0239] It should be noted that, during stretching of the image, the stretching of the image can be based on a stretching division line. The stretching division line can be generated by the electronic device based on a preset rule, can be pre-configured by the background, or can be specified by the user in real time through a gesture.
[0240] In some examples, the electronic device can determine the stretching division line of the first image based on a preset rule, which can include, for example, the following: starting from the middle position of the first image, ignoring the repeatable elements, bypassing the non-deformable elements on the first image; when passing through the deformable elements, generally adjusting to the middle line of the deformable elements; if there are multiple non-deformable elements in the first image, multiple stretching division lines can be set, and the stretching division lines are set within the preset range of the non-deformable elements. And the pixels on the stretching division line include the target pixels described above, that is, the pixels on the stretching division line include the pixels of the deformable elements repeated along the first direction.
[0241] For example, as shown in FIG. 11, the first image can be the sticker C1 in the note shown in FIG. 4. For the sticker C1, the element types contained in the sticker C1 can be determined based on the classification method provided in the embodiments of the present application. The sticker C1 can include deformable elements (rounded rectangle and right-angle rectangle), non-deformable elements (character list TO DO LIST and date ______), and repeatable elements (circle and straight line). When determining the stretching division line (including the horizontal division line and the vertical division line), the various elements on the sticker C1 need to be considered comprehensively. For the horizontal division line or the vertical division line, the non-deformable elements (list TO DO LIST and date ______) should be avoided, and the repeatable elements can be ignored. Meanwhile, the midlines of the rounded rectangle and the right-angle rectangle can be selected to form the stretching division line in different directions.
[0242] In some other examples, the first image can be an image or a sticker provided by the electronic device itself, such as the sticker C1 in the note shown in FIG. 4. For the image stored in the electronic device in advance, the stretching division line can be pre-configured in the background. That is, when the electronic device stores the image, the position of the horizontal stretching division line and the position of the vertical stretching division line of the image are also stored synchronously. For example, the configuration file of the electronic device stores the coordinate sequence of the plurality of points constituting the stretching division line.
[0243] For example, as shown in FIG. 12, taking the first image as a rounded right arrow image as an example, the rounded right arrow image can be stored in the electronic device in advance, and the coordinate sequence value of the horizontal division line and the coordinate sequence value of the vertical division line can also be stored in the electronic device. In the process of horizontally stretching the rounded right arrow image, the pixels on the horizontal division line can be copied to fill the target area or the newly added area, so that the length of the horizontal direction of the rounded right arrow image is increased, but the rounded part of the rounded right arrow image is not deformed. In the process of vertically stretching the rounded right arrow image, the pixels on the vertical division line can be copied to fill the target area or the newly added area, so that the length of the vertical direction of the rounded right arrow image is increased, but the rounded part of the rounded right arrow image is not deformed.
[0244] In some other examples, before displaying the second image, the method can further include: in response to the operation of the user drawing the stretching division line, determining and displaying the stretching division line, the pixels on the stretching division line including the target pixels, that is, the pixels on the stretching division line including the pixels repeated in the first direction of the deformable element. It should be understood that the user can draw the stretching division line on the first image based on gesture touch sliding or mouse click sliding, read the coordinate information on the stretching division line, and stretch the image based on the stretching division line when stretching the image.
[0245] For example, the pixels on the stretching split line can not include the pixels on the non-deformable element. For example, the pixels on the stretching split line can not include the pixels on the repeatable element of the non-deformable element. Thus, when the first image is stretched based on the stretching split line, the non-deformable element and the repeatable element on the first image can not be deformed, so as to avoid affecting the image layout of the second image after stretching.
[0246] In one example, the stretching split line can include a first split line. For example, in response to a first operation of a user, the first split line is determined, the first operation can be an operation of drawing a split line, and the first split line can be arranged close to a first element, the first element being a non-deformable element on the first image, that is, the first split line can be arranged within a preset range of the first element.
[0247] For example, as shown in FIG. 13, in response to an operation of the user drawing a first split line on the first image, a position of the first split line on the first image can be displayed on the electronic device. After the first split line is determined, the first image is stretched in a first direction (horizontally), and the pixels on the first split line can be copied and filled in a target area to form a second image.
[0248] In another example, the stretching split line can include a first split line and a second split line, and the second split line and the first split line are respectively located on two sides of a first element, the first element being a non-deformable element on the first image. For example, in response to a first operation of a user, the first split line is determined; in response to a second operation of the user, the second split line is determined; and the first split line and the second split line can be respectively located on two sides of the first element.
[0249] For example, as shown in FIG. 14, the user can draw a split line 1 and a split line 2 on two sides of a non-deformable element of the first image, and when the first image is stretched in a first direction (horizontally), the areas on two sides of the non-deformable element can be filled based on the pixels on the split line 1 and the split line 2, so that a second image can be displayed on the electronic device.
[0250] For example, as shown in FIG. 15, the user can draw multiple split lines on the first image, for example, a split line 1, a split line 2, a split line 3, and a split line 4, to separate multiple non-deformable elements on the first image, and when the first image is stretched in a first direction (horizontally), the areas on two sides of the multiple non-deformable elements can be filled based on the pixels on the split line 1, the split line 2, the split line 3, and the split line 4, so that a second image after horizontal stretching can be displayed on the electronic device.
[0251] In yet another example, the non-deformable elements on the first image include a first element and a second element, the second element is arranged apart from the first element along the first direction, the first element and the second element are located inside the deformable element, the method further includes: in response to a first operation of the user, determining a first split line, the first split line is close to the first element, i.e., the first split line is arranged within a preset range of the first element; in response to a second operation of the user, determining a second split line, the second split line is close to the second element, i.e., the second split line is arranged within a preset range of the second element.
[0252] For example, as shown in FIG. 16, the horizontal split line on the first image can include two split lines, one of which can be arranged close to the first element (e.g., review target), and the other of which can be arranged close to the second element (e.g., evaluation result). The vertical split line on the first image can include two split lines, which can be located on the two sides of the first element (e.g., analyze reason) or the second element (e.g., summarize experience), respectively.
[0253] It should be understood that in some embodiments, the positions of the non-deformable elements on the first image can remain unchanged or can change, for example, the position of the first element remains unchanged, and the position of the second element changes from a first position to a second position. For example, as shown in FIG. 16, when the first image is horizontally stretched, the relative positions of the characters REPLAY, review target, and analyze reason on the first image do not change, while the relative positions of the date _______, evaluation result, and summarize experience on the first image change and all move to the right. When the first image is vertically stretched, the relative positions of the characters REPLAY, date _______, review target, and evaluation result on the first image do not change, while the relative positions of the characters analyze reason and summarize experience on the first image change and all move downward.
[0254] In some examples, the target region further includes background pixels, and the pixel values of the background pixels are filled according to the pixel values on the stretch split line. For example, as shown in FIG. 16, the background of the rectangular region is a hatched region, and the background of the rounded rectangular region is a white filled region. The background of the rounded rectangular region covers part of the rectangular region. After the image is stretched, the pixel values of the background pixels of the target region are filled according to the pixel values on the stretch split line, so that the stretched image is consistent with the background of the first image.
[0255] In some examples, before displaying the second image, the method 300 further includes displaying the first image and a first region, the first region being a region between the boundary of the first image and the boundary of the second image, and the display color of the first region and the background color of the first image belong to the same color system.
[0256] As shown in FIG. 17, in response to the operation of the user clicking the first image, a drag box is displayed at the position of the border of the first image, and the drag box can be dragged to realize horizontal stretching or shortening, vertical stretching or shortening, equal magnification or equal reduction, etc. of the first image. Considering the difference in performance of the electronic device, in some examples, in response to the user dragging the right side line of the drag box in the first direction (horizontally), the electronic device can display an intermediate image, the intermediate image includes the first image and a first area, the first area is the area between the border of the first image and the border of the second image, and the display color of the first area and the background color of the first image belong to the same color system, for example, the first area can be filled with the background color of the first image with a transparency of 30%. Further, the above method can realize the filling of the first area, and finally display the stretched second image. The second image is stretched horizontally relative to the first image, but the non-deformable elements in the second image are not deformed, and the layout is neat and beautiful.
[0257] In some examples, in response to the operation of the user clicking the first image, a drag box is displayed within a preset range of the outer border (outer contour) of the first image, and the drag box can be dragged to realize equal magnification or equal reduction of the first image. As shown in FIG. 18, in response to the user dragging any one of the four corner points (black dots shown in FIG. 18) of the drag box outward, a second image is displayed, which is an image obtained by equal magnification of the first image.
[0258] In some examples, in response to the operation of the user clicking the first image, a drag box is displayed within a preset range of the outer border (outer contour) of the first image, and the drag box can be dragged to realize horizontal stretching or shortening of the first image. As shown in FIG. 19, in response to the user dragging any one of the two middle points (black dots shown in FIG. 19) of the drag box in the first direction (horizontally), a second image is displayed, which is an image obtained by horizontally stretching the first image.
[0259] In some examples, in response to the operation of the user clicking the first image, a drag box is displayed within a preset range of the outer border (outer contour) of the first image, and the drag box can be dragged to realize horizontal stretching or shortening of the first image. As shown in FIG. 20, in response to the user dragging any one of the two middle points (black dots shown in FIG. 20) of the drag box in the first direction (vertically), a second image is displayed, which is an image obtained by vertically stretching the first image.
[0260] It should be understood that when the user changes the size and aspect ratio of the first image by touch or mouse dragging, the electronic device can identify the direction and size of the user's dragging, adaptively change the image in real time to make it become the target size, avoid the deformation and distortion of the elements, and ensure the visual aesthetic perception.
[0261] For example, as shown in FIG. 21, during the stretching or shrinking of the image, the elements on the image do not deform and distort, and the overall design layout of the image does not change. During the changes of the image 1 to the image 6, the image stretching or image shrinking operation can be performed, but the size of the stretched / shrunk image is still larger than that of the original image (i.e., the image 1). Specifically: on the basis of the image 1, by ① dragging the four corner points of the surrounding box outward, the image can be enlarged at a constant ratio to obtain the image 2, and the size of the image 2 is larger than that of the image 1; on the basis of the image 2, by ② dragging the left and right two middle points of the surrounding box outward, the image can be stretched horizontally to obtain the image 3, and the size of the image 3 is larger than that of the image 2 and the image 1; on the basis of the image 3, by ③ dragging the upper and lower two middle points of the surrounding box outward, the image can be stretched vertically to obtain the image 4, and the size of the image 4 is larger than that of the image 3, the image 2 and the image 1; on the basis of the image 4, by ④ dragging the left and right two middle points of the surrounding box inward, the image can be shrunk horizontally to obtain the image 5, and the size of the image 5 is smaller than that of the image 4 but larger than that of the image 1; on the basis of the image 5, by ⑤ dragging the upper and lower two middle points of the surrounding box inward, the image can be shrunk vertically to obtain the image 6, and the size of the image 6 is smaller than that of the image 5 but larger than that of the image 1.
[0262] It should be noted that the image stretching method provided by the embodiment of the present application can realize the constant-ratio enlargement, horizontal stretching and vertical stretching of the image, so that the stretched image can maintain the original layout and alignment manner, without causing the distortion of the elements, and ensure that the element layout is consistent with the original image. In addition, for the repeatable elements in the image, the repeatable elements can be adaptively increased according to the arrangement rule of the repeatable elements, so that the image layout can adaptively change with the aspect ratio of the image.
[0263] FIG. 22 is a schematic flowchart of an image stretching method provided by an embodiment of the present application. The image stretching method 500 can include S510 to S550.
[0264] S510, determining the stretching direction and stretching size of the first image.
[0265] For example, when the user stretches the first image, the electronic device can detect the stretching direction and stretching size of the first image.
[0266] The content of this step can be referred to the related description in S320, which will not be repeated here.
[0267] S520, determining the element type included in the first image according to the stretching direction.
[0268] For example, after the electronic device obtains the first image, the element included in the first image can be classified by levels based on the stretching direction to determine the element type included in the first image. The element type can include non-deformable elements and deformable elements. In some examples, the first image can also include repeatable elements, and the element type can also include repeatable elements. The related content of the first image can refer to S310, which will not be repeated here.
[0269] In some examples, the elements can be classified by manual annotation. For example, the attributes of the elements in the first image can be annotated in advance, and the main annotation content includes: the coordinates of the outline points of the first image, the element type (including deformable elements, non-deformable elements, and repeatable elements), and the outline level. The outline level can be understood as the element level.
[0270] For example, as shown in FIG. 8, the outermost rectangle of the first image belongs to the first outline level (or the first element level); the font (i.e., the list TO DO LIST and the date _____) and the rounded rectangle inside the rectangle belong to the second outline level (or the second element level); the innermost black circle and straight line belong to the third outline level (or the third element level). When the stretching direction of the first image is horizontal, the rectangle belongs to the deformable element, the list TO DO LIST and the date _____ belong to the non-deformable element, the rounded rectangle belongs to the deformable element, the black circle belongs to the repeatable element, and the straight line belongs to the deformable element. When the stretching direction of the first image is vertical, the rectangle belongs to the deformable element, the list TO DO LIST and the date _____ belong to the non-deformable element, the black circle and the straight line belong to the repeatable element.
[0271] For another example, as shown in FIG. 9, the outermost rectangle of the first image belongs to the first outline level (or the first element level); the key pattern, the text password manager, the character …, the same side rounded rectangle, and the dashed line segment belong to the second outline level (or the second element level); the innermost account, password, horizontal line segment, and vertical line segment belong to the third outline level (or the third element level). When the stretching direction of the first image is horizontal, the key pattern, the text password manager, the character …, the account, and the password are non-deformable elements, and the same side rounded rectangle, the dashed line segment, and the horizontal line segment belong to the deformable element. When the stretching direction of the first image is vertical, the rectangle belongs to the deformable element, the key pattern, the text password manager, and the character … belong to the non-deformable element, and the same side rounded rectangle, the dashed line segment, and the horizontal line segment belong to the repeatable element.
[0272] In some examples, the image classification method 600 provided by the present application can be employed to determine the element type included in the first image, which can include S610-S640, the specific content of which will be described in detail in conjunction with FIG. 23 and FIG. 24.
[0273] S530, determining the stretching split line according to the element type of the first image and the stretching direction.
[0274] In this step, the stretching split line can be determined according to the element type of the first image and the stretching direction obtained in S520.
[0275] It should be understood that the stretching split line can be generated by the electronic device based on a preset rule, pre-configured by the background, or specified in real time by the user through a gesture.
[0276] For example, starting from the middle position of the first image, ignoring the repeatable elements, bypassing the non-deformable elements on the first image; when passing through the deformable elements, the middle line of the deformable elements is generally adjusted; if there are multiple non-deformable elements in the first image, multiple stretching split lines can be set, and the stretching split line is set within the preset range of the non-deformable element. And the pixels on the stretching split line include the pixels of the deformable elements repeated along the stretching direction.
[0277] The content of this step can be referred to the related description of the stretching split line in S330, which will not be repeated here.
[0278] S540, determining the target region according to the first image, the stretching direction and the stretching size.
[0279] Wherein, the target region can be located on the second image, and the size of the target region along the stretching direction is equal to the stretching size of the first image. It should be understood that the specific content of the target region can be referred to the related description of the target region in S330, which will not be repeated here.
[0280] S550, filling the target region according to the pixels on the stretching split line.
[0281] In this step, the pixel value on the stretching split line can be repeatedly filled to fill the target region, so as to obtain the stretched second image.
[0282] In some examples, the method 500 can further include: if the repeatable element is located on both sides of the stretching split line, the repeatable element also needs to be filled on the target region.
[0283] It should be understood that the specific content of this step will be described in detail in conjunction with FIG. 25.
[0284] FIG. 23 is a schematic flowchart of a method of image classification according to an embodiment of the present application. The method of image classification 600 can comprise S610-S640.
[0285] S610, obtaining a first image.
[0286] The content of this step can refer to the relevant description in S310, which will not be repeated here.
[0287] S620, performing binarization processing on the first image to determine a binarized image.
[0288] In this step, the first image can be binarized to determine a binarized image, which is generally an image with only two colors (usually black and white). The specific process of binarization can refer to the prior art.
[0289] S630, performing contour detection and line segment detection on the binarized image to determine a hierarchical element of the first image.
[0290] In this step, contour detection and line segment detection can be performed on the binarized image to obtain the hierarchical elements of the first image. That is, the first image can be hierarchically classified, for example, as shown in FIG. 8, the outermost rectangle belongs to the first contour level (or the first element level, the bottommost element level); the font (i.e., the list TO DO LIST and the date ____) and the rounded rectangle inside the rectangle belong to the second contour level (or the second element level, the middle element level); the innermost black circle and straight line belong to the third contour level (or the third element level, the topmost element level).
[0291] S640, according to the stretching direction, performing element classification on each hierarchical element to determine the element type of each hierarchical element.
[0292] It should be understood that each hierarchical element of the first image can include multiple elements of different types, such as repeatable elements, deformable elements, and non-deformable elements, and therefore, the elements included in each hierarchical element of the first image need to be classified to determine the element type of each hierarchical element.
[0293] For example, as shown in FIG. 24, this step S640 can specifically comprise:
[0294] S641, inputting a first element of a first hierarchical element. The first element can be one of the elements in the first hierarchical element.
[0295] S642, calculating the shape similarity degree of the first element and other elements, calculating the area intersection ratio of the first element and other elements, and calculating the distance of the average color vector in the first element and the average color vector of other elements.
[0296] The specific calculation of the shape similarity degree, the area intersection ratio and the distance of the average color vector can refer to the prior art, and will not be described in detail here.
[0297] S643, if the shape similarity degree, the area intersection ratio and the distance of the average color vector of the first element and other elements all satisfy the preset threshold, it is determined that the first element is a repeatable element. Otherwise, it is determined that the first element is a non-repeatable element.
[0298] It should be understood that the shape similarity degree can be used to represent the shape similarity relationship between the first element and other elements (such as the second element), the area intersection ratio can be used to represent the area size relationship between the first element and other elements (such as the second element), and the distance of the average color vector can be used to represent the color similarity relationship between the first element and other elements (such as the second element).
[0299] If the shape similarity degree of the first element and other elements (such as the second element) is greater than the first threshold, it can be considered that the shape of the first element and other elements is approximately the same; if the area intersection ratio of the first element and other elements (such as the second element) is greater than the second threshold, it can be considered that the area of the first element and other elements is approximately equal; if the distance of the average color vector of the first element and other elements (such as the second element) is less than the third threshold, it can be considered that the color of the first element and other elements is approximately the same.
[0300] Generally, if the shape of the first element and the second element is approximately the same, the area is approximately equal, and the color is approximately the same, it can be considered that the first element and the second element are the same repeatable element. Otherwise, it is determined that the first element is a non-repeatable element, that is, the shape of the first element and other elements is different, or the area is different, or the color is different.
[0301] It should be understood that in the embodiments of the present application, the shape similarity degree, the area intersection ratio and the distance of the average color vector are mainly used as parameters to determine the shape, area and color relationship between the first element and the second element, but the present application is not limited thereto, that is, in other embodiments, other parameters representing shape, area and color similarity can be used to determine whether two elements are the same.
[0302] Further, after determining the repeatable elements on the first image, the repeatable elements can be further grouped according to equal rows and equal intervals or equal columns and equal intervals.
[0303] S644, if it is determined that the first element is a non-repeatable element, it is further determined whether the first element is located in the deformable image library, if the first element is located in the deformable image library, it is determined that the first element is a deformable element; otherwise, it is determined that the first element is a non-deformable element.
[0304] It should be understood that the repeatable elements and non-repeatable elements on the first image can be determined by S643, and further, whether the first element belongs to a deformable element can be determined based on the deformable image library. If the first element is located in the deformable image library, it means that the first element belongs to a deformable element, otherwise, it is determined that the first element is a non-deformable element.
[0305] For example, the deformable image library can include a plurality of deformable image templates, that is, the first element can be matched with the deformable image templates in the deformable image library. If a match is found, it means that the first element is a deformable element, otherwise, it means that the first element is a non-deformable element.
[0306] FIG. 25 is a schematic flowchart of another image stretching method provided by the embodiments of the present application. The image stretching method 700 can include S701 to S714.
[0307] S701, obtaining a first image, an element type included in the first image, a stretching size of the first image, and a stretching direction.
[0308] S702, determining n stretching division lines (n≥1) according to the first image, the element type included in the first image, and the stretching direction of the first image.
[0309] S703, judging whether the stretching direction has a stretching division line. If yes, continue to execute S704; if no, exit the flow.
[0310] S704, judging whether a repeatable element is located on both sides of the stretching division line.
[0311] If the repeatable element is not located on both sides of the stretching division line, S705 to S707 are executed, and if the repeatable element is located on both sides of the stretching division line, S706 to S710 are executed.
[0312] When the repeatable element is not located on both sides of the stretching division line, the following steps can be executed:
[0313] S705, determining a target region according to the first image and the stretching size.
[0314] S706, copying pixels on the stretching division line to fill the target region.
[0315] In this step, the target width of each split line to be filled can be calculated by dividing the total filling width by the number of split lines, and the target width is filled by copying the pixels on the split line.
[0316] S707, display a second image, the second image comprising the target region.
[0317] It should be understood that when the repeatable element is not located on both sides of the stretch split line, the pixel filling of the target region of the second image can be achieved by repeatedly copying the pixels on the stretch split line.
[0318] When the repeatable element is located on both sides of the stretch split line, the following steps can be performed:
[0319] S708, remove the repeatable element from the first image.
[0320] It should be understood that this step is mainly to extract the repeatable element from the first image. The repeatable element is the bottommost repeatable element distributed on both sides of the split line. For example, as shown in FIG. 8, the bottommost repeatable element is the innermost black circle and the straight line segment, that is, the black circle and the straight line segment are repeated; for example, as shown in FIG. 9, the bottommost repeatable element is the second element level, that is, the same side of the rounded rectangular frame and the content in the frame, that is, the same side of the rounded rectangular frame and the content in the frame are repeated.
[0321] S709, fill the pixel value at the position corresponding to the repeatable element on the first image using the average value of the pixels within the preset range of the periphery of the repeatable element.
[0322] It should be understood that after the repeatable element is removed from the first image, there will be a hole in the first image, which needs to be filled. In some examples, the average value of the pixels within the preset range of the periphery of the repeatable element can be used to fill the hole and repair the background of the first image.
[0323] S710, determine the target region according to the first image and the stretch size.
[0324] S711, copy the pixels on the stretch split line to fill the target region.
[0325] S712, determine the number and position of all repeatable elements according to the stretch size, the maximum distance of the repeatable element, the distance between adjacent repeatable elements, and the position of the first repeatable element.
[0326] In this step, first, the total number of repeatable elements that need to be filled in the stretched image can be determined according to the stretching size, the maximum distance between repeatable elements (i.e., the distance between the first repeatable element and the last repeatable element), and the spacing of adjacent repeatable elements; then, starting from the position of the first repeatable element, the repeatable elements are filled in turn according to the spacing between the repeatable elements, to determine the positions of all the repeatable elements.
[0327] That is, the repeatable elements can be increased at equal intervals in the stretching direction, and the target region and the corresponding positions of other regions of the second image can be filled with repeatable elements.
[0328] S713, filling the repeatable elements in the target region and other regions of the second image.
[0329] S714, displaying the second image, which includes the target region.
[0330] It should be understood that when the repeatable elements are located on both sides of the stretching split line, first, all the repeatable elements need to be removed from the first image, and the background holes of the first image are repaired; then, the pixel filling of the target region of the second image is realized by repeating and copying the pixels on the stretching split line; finally, according to the total number of repeatable elements on the second image and the spacing between the repeatable elements, starting from the first repeatable element, the repeatable elements are filled in turn, and the target region of the second image will also be filled with corresponding repeatable elements.
[0331] It should be noted that the details not mentioned in the above steps can refer to the contents in FIG. 3, FIG. 22 to FIG. 24, and will not be repeated here.
[0332] By using the image stretching method provided in the embodiments of the present application, the stretched image can be displayed in real time on the electronic device without high complexity calculation, and the image processing speed is fast and efficient. In addition, the image can be scaled up, stretched horizontally, and stretched vertically, so that the stretched image can maintain the original layout and alignment manner, and the elements will not be distorted, ensuring that the element layout is consistent with the original image. In addition, for the repeatable elements in the image, the repeatable elements can be increased adaptively according to the arrangement rule of the repeatable elements, so that the image layout can adaptively change with the aspect ratio of the image.
[0333] FIG. 26 is a schematic flowchart of an image shrinking method according to an embodiment of the present application. As shown in FIG. 26, the image shrinking method 400 can include S410 to S430, and the image shrinking method 400 can be applied to an electronic device.
[0334] S410, obtaining a first image, which can include deformable elements and non-deformable elements.
[0335] wherein the first image can include a target region and a non-target region, the target region can be a contracted region on the first image, the target region includes target pixels, the target pixels are pixels repeated by the deformable elements along a first direction, the first direction is a direction of the image contraction; the non-deformable elements are located outside the target region.
[0336] In some examples, as shown in (a) of FIG. 27, the target region can be located in a partial region at the bottom end of the first image, and the non-target region is a region of the first image other than the target region. The first image is compressed upward along the first direction to form a second image, the target region of the first image can be a shortened part of the first image relative to the second image, the target region includes pixels repeated by the deformable elements (two rectangles) along the first direction, and the non-deformable elements (characters REMINDER) are located outside the target region.
[0337] In other examples, as shown in (b) of FIG. 27, the target region can be located in a region at the middle part of the first image, and the non-target region is a region of the first image other than the target region, that is, the non-target region includes a first part and a second part. For example, when the first image is contracted along the first direction, a first segmentation line corresponding to the first image is confirmed, and the contraction of the first image is performed based on the first segmentation line, that is, the pixels on the first segmentation line are repeatedly deleted, so that the target region of the first image is deleted, and the second image obtained does not include the target region, that is, the second image includes the non-target region.
[0338] It should be understood that other contents about the first image can be referred to the related description in S310, which will not be repeated here.
[0339] S420, performing a contraction operation on the first image along the first direction to determine a contraction size of the first image.
[0340] wherein the contraction size of the first image can be equal to a size of the target region of the first image shortened along the first direction, that is, by deleting the target region of the first image, a second image can be obtained.
[0341] It should be understood that the contraction operation in this step is an opposite operation process to the stretching operation in S320. The contents of this step can be similarly referred to the description of S320, which will not be repeated here.
[0342] S430, displaying the second image. The second image includes a non-target region on the first image.
[0343] It should be understood that the second image is an image obtained after the first image is subjected to the shrinking operation, the size of the second image is smaller than the size of the first image, and the second image is an image obtained after the target region of the first image is deleted, that is, the second image includes the non-target region on the first image. That is, along the first direction (the shrinking direction), by repeatedly deleting the deformable elements on the first image, the length of the first image can be shortened.
[0344] In some examples, the first image further includes a plurality of repeatable elements, and the method 400 can further include: in a case where the first direction is the same as the arrangement direction of the repeatable elements, the target region includes at least one repeatable element. That is, the first image can delete at least one repeatable element along the first direction, that is, delete at least one repeatable element included in the target region, so that the number of repeatable elements on the second image is reduced.
[0345] It can be understood that, when the first image is subjected to the shrinking operation, the number of repeatable elements on the first image can be reduced, the number of deformable elements and non-deformable elements does not change, and the shape of the non-deformable element does not change, and the occupied space of the deformable element can be reduced. During the shrinking of the image, the overlap of elements cannot occur, that is, when the distance between two elements is less than a preset range, the continuous shrinking of the image is not supported.
[0346] For example, in response to a user operation of clicking the first image, a drag box is displayed at the position of the border of the first image, and the horizontal shortening, vertical shortening, and equal proportion reduction of the first image can be achieved by dragging the drag box. As shown in FIG. 28, in response to a user operation of clicking the first image, a drag box is displayed in a preset range of the outer border (outer contour) of the first image, and the vertical shortening of the first image can be achieved by dragging the drag box. In response to a user dragging any one of the two middle points (black dots shown in FIG. 28) of the upper and lower edges of the drag box along the first direction (vertically), a second image is displayed, and the second image is an image obtained by vertically shortening the first image. Further, when the minimum shrinking size is reached, the display interface of the electronic device can pop up a prompt box, and a prompt such as “Please note that the image shrinking has reached the minimum shrinking size” can appear in the prompt box, prompting the user that the second image currently displayed is the image with the minimum shrinking size corresponding to the first image, and the image cannot be further shrunk.
[0347] It should be understood that the minimum shrinking size can be determined based on the following: the number of repeatable elements in the second image reaches a minimum value, the distance between elements in the second image is less than a preset distance, the minimum shrinking size cannot be greater than the size of the deformable element, and the like.
[0348] It should also be understood that when the user changes the size and aspect ratio of the first image by touch or mouse dragging, the electronic device can identify the direction and size of the user's dragging, adaptively change the image in real time to the target size, avoid the deformation and distortion of the elements, and ensure the visual aesthetic perception.
[0349] It should be noted that the image shrinking method provided by the embodiments of the present application can realize equal proportion shrinking, horizontal shrinking and vertical shrinking of the image, so that the shrunk image can maintain the original layout and alignment manner, without causing the distortion of the elements, and ensuring that the element layout is consistent with the original image. In addition, for the repeatable elements in the image, the repeatable elements can be adaptively reduced according to the arrangement rule of the repeatable elements, so that the image layout can adaptively change with the aspect ratio of the image.
[0350] FIG. 29 is a schematic flowchart of another image shrinking method provided by the embodiments of the present application. The image shrinking method 800 can include S810 to S850.
[0351] S810, determining the shrinking direction and shrinking size of the first image.
[0352] The content of this step can be referred to the description of the shrinking direction and shrinking size in FIG. 28, which will not be repeated here.
[0353] S820, determining the element type of the first image according to the shrinking direction.
[0354] The content of this step can be referred to the related description in S520, which will not be repeated here.
[0355] S830, determining the shrinking division line according to the element type of the first image and the shrinking direction.
[0356] In this step, the shrinking division line can be determined according to the element type of the first image and the shrinking direction obtained in S810.
[0357] It should be understood that the shrinking division line can be generated by the electronic device based on the preset rule, can be pre-configured by the background, or can be specified in real time by the user through the gesture.
[0358] For example, starting from the middle position of the first image, ignoring the repeatable elements, bypassing the non-deformable elements on the first image; when passing through the deformable elements, the middle line of the deformable elements is generally adjusted; if there are multiple non-deformable elements in the first image, multiple shrinking division lines can be set, and the shrinking division line is set in the preset range of the non-deformable element. In addition, the pixels on the shrinking division line include the repeatable pixels of the deformable elements along the shrinking direction.
[0359] The content of this step can refer to the description of the split line in S330, which will not be repeated here.
[0360] S840, determining the target region according to the first image, the shrink direction and the shrink size.
[0361] The target region can be located on the first image (i.e. the original image), and the size of the target region along the shrink direction is equal to the shrink size of the first image. It should be understood that the specific content of the target region can refer to the description of the target region in S410, which will not be repeated here.
[0362] S880, deleting the target region according to the pixels on the shrink split line.
[0363] In this step, by repeatedly deleting the pixel values on the shrink split line, the target region is deleted to obtain the second image after shrinkage.
[0364] In some examples, the method 800 can further include: if the repeatable element is located on both sides of the shrink split line, deleting the repeatable element on the target region.
[0365] It should be understood that the specific content of this step will be described in detail in conjunction with FIG. 29.
[0366] FIG. 30 is a schematic flowchart of another image shrinkage method according to an embodiment of the present application.
[0367] It should be noted that the image shrinkage method 900 is mainly changed from the stretching process to the shrinkage process, and S706 and S713 in FIG. 25 are modified, relative to the above-mentioned image stretching method 700. In the stretching image process shown in FIG. 24, the pixel values on the split line are mainly copied, and the repeatable pixels are added to the target region, while in the shrinking image process in FIG. 30, the pixel values on the split line are mainly deleted, and the repeatable pixels of the target region are deleted. The following mainly describes the differences between the two, and the descriptions not described in detail can refer to the above-mentioned descriptions of FIG. 25 and FIG. 26.
[0368] The image shrinkage method 900 can include S901 to S914.
[0369] S901, obtaining a first image, an element type included in the first image, a shrink size of the first image and a shrink direction.
[0370] It should be noted that the shrink size should be greater than or equal to the minimum shrink size described above.
[0371] It should be understood that when shrinking the first image, the number of repeatable elements on the first image can be reduced, the number of deformable and non-deformable elements remains unchanged, the shape of the non-deformable elements remains unchanged, and the space occupied by the deformable elements can be reduced. During the image shrinking process, element overlap is not allowed; that is, when the distance between two elements is less than a preset range, further image shrinking is not supported.
[0372] S902, determine n contraction dividing lines (n≥1) based on the first image, the element types included in the first image, and the contraction direction of the first image.
[0373] S903, determine if a contraction dividing line exists in the contraction direction. If it exists, continue to execute S904.
[0374] S904 determines whether repeatable elements are located on both sides of the contraction dividing line.
[0375] If the repeatable element is not located on either side of the contraction dividing line, then execute S905 to S909; if the repeatable element is located on either side of the contraction dividing line, then execute S906 to S910.
[0376] When the repeatable element is not located on either side of the contraction line, the following steps can be performed:
[0377] S905, the target region is determined based on the first image and the shrinkage size. This target region can be referred to in the relevant description in Figure 26.
[0378] S906, Repeatedly delete pixels on the shrinking dividing line to delete the target region of the first image.
[0379] S907, Display the second image. The size of the second image is smaller than the size of the first image.
[0380] In other words, when repeatable elements are not located on both sides of the stretching dividing line, the target region can be deleted by repeatedly deleting pixels on the stretching dividing line, so that the second image obtained does not include the target region.
[0381] When repeatable elements are located on both sides of the contraction line, the following steps can be performed:
[0382] S908, Remove repeatable elements from the first image.
[0383] S909, use the average pixel value within a preset range around the repeating element to fill the pixel value at the position corresponding to the repeating element on the first image.
[0384] S910, determine the target area based on the first image and the shrinkage size.
[0385] S911, repeat deleting pixels on the contraction split line to delete the target region of the first image.
[0386] S912, according to the contraction size, the maximum distance between repeatable elements, the interval between adjacent repeatable elements and the position of the first repeatable element, determine the number and position of all repeatable elements.
[0387] In this step, first, the total number of repeatable elements that need to be filled in the contracted image can be determined according to the contraction size, the maximum distance between repeatable elements (i.e. the distance between the first repeatable element and the last repeatable element) and the interval between adjacent repeatable elements; then, starting from the position of the first repeatable element, the repeatable elements are filled in turn according to the interval between the repeatable elements to determine the position of all repeatable elements. It should be understood that the number of repeatable elements on the second image is the number of repeatable elements on the first image minus the number of reduced repeatable elements.
[0388] S913, fill the repeatable elements on the second image.
[0389] It should be understood that the total number of repeatable elements that need to be filled in the contracted image (i.e. the second image) is less than the total number of repeatable elements on the image before contraction (i.e. the first image). That is, the reduced repeatable elements are the repeatable elements of the target region of the first image.
[0390] S914, display the second image. The size of the second image is smaller than the size of the first image.
[0391] That is, when the repeatable elements are located on both sides of the contraction split line, first, all the repeatable elements are removed from the first image, and the background holes of the first image are repaired; then, by repeating deleting pixels on the contraction split line, the deletion of the target region of the first image is realized; finally, according to the total number of repeatable elements on the second image and the interval between the repeatable elements, the repeatable elements are filled in turn starting from the first repeatable element, that is, the repeatable elements of the target region of the first image have been deleted.
[0392] By the image contraction method provided in the embodiments of the present application, the contracted image can be displayed in real time on the electronic device without high complexity calculation, the speed of processing the image is fast and the efficiency is high. In addition, the image can be scaled up, horizontally contracted and vertically contracted at the same ratio, so that the contracted image can maintain the original layout and alignment manner, without causing distortion of the elements, and ensuring that the element layout is consistent with the original image. In addition, for the repeatable elements in the image, the repeatable elements can be increased adaptively according to the arrangement rule of the repeatable elements, so that the image layout can adaptively change with the aspect ratio of the image.
[0393] The image display method provided by the present application is described in detail above in combination with FIG. 3 to FIG. 30. The image display method can include the image stretching method and the image shrinking method described above.
[0394] FIG. 31 is another picture display device 1000 provided by an embodiment of the present application. The device 1000 can have the functions of the electronic device in the method embodiments described above, and can be used to execute the steps performed by the functions of the electronic device in the method embodiments described above. The functions can be implemented by hardware, or by software or hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the functions described above.
[0395] In a possible implementation, the picture display device 1000 can include an acquisition module 1010 and a processing module 1020, which are coupled to each other.
[0396] The acquisition module 1010 can be configured to support the electronic device to acquire the input of the user, such as the aforementioned touch operation of the user on the display screen of the electronic device.
[0397] The processing module 1020 is configured to support the electronic device to perform the processing actions in the method embodiments described above, such as determining the stretching split line according to the element type and the stretching direction of the first image.
[0398] Optionally, the picture processing device 1000 can further include a storage module 1030 configured to store the program code and data of the display processing device 1000.
[0399] Optionally, the picture processing device 1000 can further include a display module configured to display the image before and after stretching, or configured to display the image before and after shrinking.
[0400] FIG. 32 is an electronic device 2000 provided by an embodiment of the present application. As shown in FIG. 32, the electronic device 2000 includes at least one processor 2010 and a transceiver 2020. The processor 2010 is coupled to a memory and is configured to execute instructions stored in the memory to control the transceiver 2020 to transmit and / or receive signals.
[0401] Optionally, the electronic device 2000 further includes a memory 2030 configured to store instructions.
[0402] In some embodiments, the processor 2010 and the memory 2030 can be combined into one processing device, and the processor 2010 is configured to execute the program code stored in the memory 2030 to implement the functions described above. In specific implementation, the memory 2030 can be integrated in the processor 2010 or independent of the processor 2010.
[0403] In some embodiments, the transceiver 2020 can include a receiver (or referred to as a receiver) and a transmitter (or referred to as a transmitter).
[0404] The transceiver 2020 can further include an antenna, and the number of antennas can be one or more. The transceiver 2020 can be a communication interface or interface circuit.
[0405] When the electronic device 2000 is a chip, the chip includes a transceiver module and a processing module. The transceiver module can be an input / output circuit or a communication interface, and the processing module can be a processor or a microprocessor integrated on the chip or an integrated circuit.
[0406] The embodiment also provides a computer readable storage medium, which stores computer instructions. When the computer instructions run on an electronic device, the electronic device executes the related method steps to implement the image stretching / shrinking method in the above embodiment.
[0407] The embodiment also provides a computer program product. When the computer program product runs on a computer, the computer executes the related steps to implement the image stretching / shrinking method in the above embodiment.
[0408] In addition, the embodiment of the present application also provides a device, which can be a chip, a component or a module. The device can include a processor and a memory connected to each other. The memory is used to store computer execution instructions. When the device runs, the processor can execute the computer execution instructions stored in the memory to make the chip execute the image stretching / shrinking method in the above method embodiments.
[0409] The electronic device, the computer readable storage medium, the computer program product or the chip provided by the embodiment are used to execute the corresponding method provided above, and thus the beneficial effects achieved by the electronic device, the computer readable storage medium, the computer program product or the chip can refer to the beneficial effects of the corresponding method provided above, which will not be described here.
[0410] Those skilled in the art can realize that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be realized by electronic hardware or a combination of computer software and electronic hardware. Whether the functions are realized in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0411] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system, device and unit described above can refer to the corresponding process in the foregoing method embodiments, which will not be repeated here.
[0412] In several embodiments provided in the present application, it should be understood that the disclosed system, device and method can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the units is only a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some interface, device or unit, and can be electrical, mechanical or other forms.
[0413] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, that is, they can be located in one place, or can be distributed on a plurality of network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment scheme.
[0414] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit.
[0415] If the functions are realized in the form of software function units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application or the essential part or part of the technical solutions that make contributions to the prior art can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various program code storage media.
[0416] The above merely provides the specific implementation of the present application, but the protection scope of the present application is not limited to this. Any person skilled in the art can easily think of the changes or replacements within the technical range disclosed by the present application, which should be covered in the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A method of image display, characterized by, The method comprises: in response to a user operation of stretching the first image in a first direction, determining a stretching size of the first image, the first image comprising a deformable element and a non-deformable element, the deformable element and the non-deformable element being determined based on the first direction; displaying a second image according to the stretching size, a target region of the second image comprising a target pixel, the target pixel being a pixel of the deformable element repeated in the first direction, the non-deformable element being located outside the target region.
2. The method of claim 1, wherein, The first image further comprises a repeatable element, and the method further comprises: in a case where the first direction is the same as an arrangement direction of the repeatable element, displaying the repeatable element in the target region.
3. The method of claim 2, wherein, Before the second image is displayed, the method further comprises: in response to a first operation of the user, determining a first split line, pixels on the first split line comprising the target pixel.
4. The method of claim 3, wherein, The pixels on the first split line do not comprise pixels of the non-deformable element.
5. The method according to claim 3 or 4, characterized in that, The pixels on the first split line do not comprise pixels of the repeatable element.
6. The method according to any one of claims 3 to 5, characterized in that, The non-deformable element comprises a first element, and the first split line is arranged within a preset range of the first element.
7. The method of claim 6, wherein, The method further comprises: in response to a second operation of the user, determining a second split line, the second split line and the first split line being located on two sides of the first element, or the second split line and the first split line forming split lines in different directions.
8. The method of claim 6, wherein, The non-deformable element further comprises a second element, the second element being arranged at intervals with the first element in the first direction, the first element and the second element being located inside the deformable element, The method further comprises: in response to a second operation of the user, determining a second split line, the second split line being arranged within a preset range of the second element.
9. The method according to any one of claims 3 to 8, characterized in that, The target region further comprises a background pixel, and a pixel value on the background pixel is filled according to a pixel value on the first split line.
10. The method according to any one of claims 1 to 9, characterized in that, The non-deformable element comprises a third element, and a relative position of the third element on the first image is different from a relative position of the third element on the second image.
11. The method according to any one of claims 1 to 10, characterized in that, Before the second image is displayed, the method further comprises: displaying an intermediate image, the intermediate image comprising the first image and a first region, the first region being a region between a boundary of the first image and a boundary of the second image, a display color of the first region and a background color of the first image belonging to a same color system.
12. A method of image display, characterized by, The method comprises: determining a stretching direction and a stretching size of a first image; determining an element type included in the first image according to the stretching direction, the element type comprising a deformable element and a non-deformable element; determining a stretching split line according to the element type and the stretching direction; determining a target region of a second image according to the first image, the stretching direction and the stretching size, the second image being a stretched image; filling the target region according to pixels on the stretching split line.
13. The method of claim 12, wherein, The element type further comprises a repeatable element, and the method further comprises: If the repeatable element is located on both sides of the stretch split line, the repeatable element is filled on the target region.
14. The method of claim 13, wherein, Before filling the repeatable element on the target region, the method further comprises: removing the repeatable element from the first image; filling pixel values on a position corresponding to the repeatable element on the first image using a mean value of pixels within a preset range outside the repeatable element.
15. The method according to claim 13 or 14, characterized in that, The filling of the repeatable element on the target region comprises: determining a total number of repeatable elements to be filled on the second image according to the stretch size, a maximum distance of repeatable elements on the first image, and a distance between adjacent repeatable elements; determining a filling position of a repeatable element on the second image according to the total number of repeatable elements, a position of a first repeatable element, and the distance between adjacent repeatable elements.
16. The method according to any one of claims 12 to 15, characterized in that, The determining of the element type of each level element according to the stretch direction comprises: performing a binaryzation process on the first image to determine a binaryzation image corresponding to the first image; performing contour detection and line segment detection on the binaryzation image to determine the level elements of the first image; performing element classification on each level element according to the stretch direction to determine the element type of each level element.
17. The method of claim 16, wherein, The level elements comprise first level elements, and the determining of the element type of each level element comprises: if a shape similarity degree, an area intersection ratio, and a distance of average color vectors of a first element of the first level element and a second element of the first level element all satisfy a preset condition, determining that the first element is a repeatable element; if any one of the shape similarity degree, the area intersection ratio, and the distance of average color vectors of the first element of the first level element and the second element of the first level element does not satisfy the preset condition, determining that the first element is a non-repeatable element.
18. The method of claim 17, wherein, In a case where it is determined that the first element is a non-repeatable element, the determining of the element type of each level element comprises: if it is determined that the first element is located in a deformable image library, determining that the first element is a deformable element; if it is determined that the first element is not located in the deformable image library, determining that the first element is a non-deformable element.
19. The method according to any one of claims 12 to 18, characterized in that, The stretch split line does not overlap the non-deformable element.
20. The method of any one of claims 1 to 19, wherein, The displaying of the second image according to the stretch size comprises: displaying the second image, a size of a target region of the second image along the first direction being equal to the stretch size.
21. An apparatus for displaying a picture, characterized by A module for implementing the method of any one of claims 1 to 20.
22. An electronic device, comprising: A processor and a memory, the memory being used to store program instructions, the processor being used to invoke the program instructions to execute the method of any one of claims 1 to 20.
23. A computer-readable storage medium, characterized in that, A computer program stored thereon, the computer program being executed by a computer to implement the method of any one of claims 1 to 20.
24. A computer program product, characterised in that, comprising computer program code which, when run on a computer, causes the method of any one of claims 1 to 20 to be performed.
Citation Information
Patent Citations
Self-adaptive background picture stretching method and device, medium and equipment
CN114972012A
Image processing method and device, medium and equipment
CN115564976A
Image processing method and device, equipment and storage medium
CN116188290A