An image magnification method, device, electronic equipment and readable storage medium

By determining the boundary coordinates of the area to be magnified during image magnification and directly performing interpolation, the problem of large memory and bandwidth consumption in existing technologies is solved, and the real-time performance and speed of image magnification are improved.

CN116263936BActive Publication Date: 2026-04-28SONOSCAPE MEDICAL CORP
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SONOSCAPE MEDICAL CORP
Filing Date
2021-12-14
Publication Date
2026-04-28

AI Technical Summary

Technical Problem

Existing technologies consume a large amount of memory and bandwidth required to store intermediate images during image magnification, resulting in slow processing speeds and difficulty in meeting the real-time requirements of video application scenarios.

Method used

By obtaining the magnification factor and position of the original image, the boundary coordinates of the area to be magnified are determined, and interpolation is performed directly on the original image to avoid generating intermediate images and directly obtain the target image.

Benefits of technology

It reduces the memory and bandwidth required to store intermediate images, improves processing speed, and enables real-time performance in video application scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116263936B_ABST
    Figure CN116263936B_ABST
Patent Text Reader

Abstract

The application discloses an image magnification method and device, electronic equipment and a computer readable storage medium. The method comprises the following steps: obtaining an original image; obtaining the original image; determining a magnification multiple and a magnification position; obtaining boundary coordinates of a region to be magnified by using the magnification multiple and the magnification position and the length and width of the original image; determining the region to be magnified in the original image based on the boundary coordinates, and performing interpolation processing on target pixels in the region to be magnified to obtain a target image; and the selected part in the original image can be directly magnified without magnifying the entire original image and then performing interception, so that the memory and bandwidth required for storing intermediate images are not occupied, the processing speed is relatively high, and the real-time performance is relatively good in a video application scenario.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing technology, and in particular to an image magnification method, an image magnification device, an electronic device, and a computer-readable storage medium. Background Technology

[0002] Magnifying video images is a common application in daily life, with optical magnification and electronic magnification being the most frequently used methods. Optical magnification is mainly achieved through zooming, using lens movement to magnify or reduce the size of the object being photographed. The advantage of optical magnification is that it does not lose pixels or image clarity after magnification, but its magnification factor is limited, generally between 1-3x, and the hardware is expensive. Currently, terminal devices mainly use electronic magnification schemes, which achieve image magnification through interpolation algorithms. This approach consumes relatively fewer hardware resources and is less costly. A schematic diagram of the relevant technical implementation scheme is shown below. Figure 1 As shown, the original image A is first interpolated horizontally using the horizontal scaling parameter Resize_factor to obtain image B. Then, the horizontally interpolated image B is interpolated vertically using the vertical scaling parameter Resize_factor to obtain image C. Finally, image C is cropped to obtain the final enlarged electronic image D. The intermediate images (such as images B and C) in the entire processing process need to be cached in memory, resulting in significant bandwidth and memory consumption and slow processing speed. This makes it impractical for video magnification applications. Summary of the Invention

[0003] In view of this, the purpose of this application is to provide an image magnification method, image magnification device, electronic device and computer-readable storage medium that will not occupy the memory and bandwidth required to store intermediate images, has a fast processing speed and good real-time performance in video application scenarios.

[0004] To address the aforementioned technical problems, this application provides an image magnification method, comprising:

[0005] Obtain the original image;

[0006] Determine the magnification factor and magnification position;

[0007] Using the magnification factor, the magnification position, and the length and width of the original image, the boundary coordinates of the area to be magnified are obtained;

[0008] Based on the boundary coordinates, the region to be magnified is determined in the original image, and the target pixels in the region to be magnified are interpolated to obtain the target image.

[0009] Optionally, the magnification is determined, including:

[0010] Obtain user operation information, and use the user operation information to determine the horizontal and vertical magnification of the original image.

[0011] Optionally, the zoom-in position can be determined, including:

[0012] The horizontal and vertical proportional positions of a reference pixel in the original image are obtained and determined as the magnification position; wherein the reference pixel is a pixel at any corner or center point of the area to be magnified.

[0013] Optionally, obtaining the boundary coordinates of the area to be magnified using the magnification factor, the magnification position, and the length and width of the original image includes:

[0014] The full-image magnification width and full-image magnification length are determined using the magnification factor, the width, and the length.

[0015] The reference position for full-image magnification is determined using the full-image magnification width, the full-image magnification length, and the magnification position.

[0016] Based on the full-image magnification reference position, the boundary coordinates of the area to be magnified are obtained using the width and the length.

[0017] Optionally, the magnified position includes a horizontal scale position and a vertical scale position, and determining the full-image magnification reference position using the full-image magnification width, the full-image magnification length, and the magnification position includes:

[0018] The horizontal reference position is obtained by multiplying the horizontal proportional position by the full-image magnification width;

[0019] The vertical reference position is obtained by multiplying the vertical proportional position by the magnified length of the entire image;

[0020] The horizontal reference position and the vertical reference position are used to construct the full-view magnification reference position.

[0021] Optionally, obtaining the boundary coordinates of the area to be magnified based on the full-image magnification reference position, using the width and the length, includes:

[0022] Using the full-image magnification reference position, the width, and the length, the coordinate range of the area to be magnified is obtained in the full-image magnification image; the full-image magnification image is an image obtained by fully magnifying the original image according to the magnification factor;

[0023] Based on the reduction factor, the endpoints of the coordinate interval are subjected to reduction and rounding processing to obtain the boundary coordinates; the reduction factor is the reciprocal of the magnification factor, and the first coordinate is any coordinate within the coordinate interval.

[0024] This application also provides an image magnification device, including:

[0025] The image acquisition module is used to acquire the original image;

[0026] The parameter determination module is used to determine the magnification and magnification position;

[0027] A boundary calculation module is used to obtain the boundary coordinates of the area to be magnified using the magnification factor, the magnification position, and the length and width of the original image;

[0028] The pixel interpolation module is used to determine the region to be magnified in the original image based on the boundary coordinates, and to perform interpolation processing on the target pixels in the region to be magnified to obtain the target image.

[0029] This application also provides an electronic device, including a memory and a processor, wherein:

[0030] The memory is used to store computer programs;

[0031] The processor is used to execute the computer program to implement the image magnification method described above.

[0032] Optionally, when acquiring the original image, the processor acquires the original image data in pixel rows and stores the original image data in a cache.

[0033] Optionally, the processor reads the target pixel row from the target cache and stores the target pixel row into a designated target memory group; the target memory group includes at least two storage units, which are used to store adjacent target pixel rows respectively;

[0034] The processor reads the pixels in the current target pixel row from each of the storage units of the target memory group;

[0035] The processor uses the pixels of the current target pixel row to perform interpolation processing to obtain the interpolated pixels of the current target pixel row;

[0036] After obtaining all the interpolated pixels of the row, the processor updates the current target pixel row in the target memory group by reading the new target pixel row from the cache.

[0037] This application also provides a computer-readable storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements the above-described image magnification method.

[0038] The image magnification method provided in this application does not obtain the target image by first magnifying and then cropping the original image. Instead, it determines the coordinate boundaries of the area to be magnified in the original image based on the magnification factor, the magnification position, and the size of the original image. Specifically, based on the magnification factor and the length and width of the original image, the size of the fully magnified image obtained after magnifying the entire original image can be determined. Based on the magnification position, the coordinate boundaries of the portion of the original image required to generate the target image can be determined, assuming the target image and the original image are the same size. Based on the boundary coordinates, the target pixels in the original image used to generate the target image can be determined, and interpolation processing is performed using the target pixels to obtain the target image. Since there is no intermediate image, and the original image is magnified directly, it does not occupy the memory and bandwidth required to store intermediate images, resulting in faster processing speed and better real-time performance in video application scenarios.

[0039] In addition, this application also provides an image magnification device, an electronic device, and a computer-readable storage medium, which also have the above-mentioned beneficial effects. Attached Figure Description

[0040] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0041] Figure 1 A flowchart illustrating a related technology image magnification process provided in this application embodiment;

[0042] Figure 2 A flowchart of an image magnification method provided in an embodiment of this application;

[0043] Figure 3 A flowchart illustrating a specific image magnification method provided in this application embodiment;

[0044] Figure 4 A magnified image diagram provided for an embodiment of this application;

[0045] Figure 5 A schematic diagram of the hardware structure of a specific electronic device provided in this application embodiment;

[0046] Figure 6 This application provides a schematic diagram of the system structure of an electronic device.

[0047] Figure 7 This is a schematic diagram of the structure of an image magnification device provided in an embodiment of this application. Detailed Implementation

[0048] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.

[0049] Enlarging video images is a common application in daily life, with optical and electronic magnification being the most common methods. Optical magnification is mainly achieved through zooming, using lens movement to magnify or reduce the size of the object being photographed. The advantage of optical magnification is that it does not lose pixels or image clarity after magnification, but its magnification factor is limited, generally between 1 and 3 times, and the hardware is expensive. Currently, terminal devices mainly use electronic magnification solutions, which achieve image magnification through interpolation algorithms. This approach consumes relatively fewer hardware resources, is low-cost, and with continuous optimization of interpolation algorithms, the blurriness of electronically magnified images is decreasing, theoretically allowing for unlimited magnification.

[0050] Current methods for achieving electronic amplification include: Figure 1 As shown, the original image A is first horizontally scaled using the Resize_factor to interpolate and obtain image B, increasing the number of pixels. Then, the horizontally interpolated image B is vertically scaled using the Resize_factor to interpolate and obtain image C, further increasing the number of pixels. Finally, image C is cropped to reduce the number of pixels, resulting in the desired electronically magnified image D. However, the above electronic magnification method has several drawbacks. First, the intermediate images B and C generated during the magnification process need to be cached in memory, which consumes a significant amount of communication bandwidth and memory storage space. Furthermore, video magnification is a crucial application scenario for electronic magnification, placing higher demands on processing speed. Due to the need for intermediate image caching in related technologies, the processing speed is slow, resulting in poor real-time performance. Meanwhile, since the video frame interval in a video is fixed, while the data corresponding to each pixel in an image needs to be read once, when reading an intermediate image, because it has more pixels than a video frame, a very high pixel clock is required to complete the image transmission per unit time. The higher the magnification, the higher the pixel clock required, which places higher demands on hardware components and limits the upper limit of magnification, making infinite magnification impossible.

[0051] To address the aforementioned problems, this application proposes an image magnification method. Please refer to... Figure 2 , Figure 2 A flowchart illustrating an image magnification method provided in this application embodiment. The method includes:

[0052] S101: Obtain the original image.

[0053] The raw image refers to the image that needs to be enlarged, and the specific method of acquisition is not limited. For example, the raw image can be obtained by reading an image from a specified location, or it can be obtained by communicating with an image acquisition device and using images sent by the device in real time as the raw image. The number of raw images is not limited. It should be noted that when multiple raw images are available, they can be unrelated images or images that are temporally related, i.e., images from various video frames in a video stream. Raw images are typically cached in memory for later retrieval.

[0054] S102: Determine the magnification factor and magnification position corresponding to the original image.

[0055] Magnification refers to the factor used to enlarge the horizontal width and vertical length of the original image. In one real-time mode, there can be one magnification factor, which specifies the magnification magnitude in both the horizontal and vertical directions. In another implementation, there are two magnification factors: a horizontal magnification factor and a vertical magnification factor, specifying the horizontal and vertical magnification magnitudes respectively. The specific value of the magnification factor is not limited; users can set it as needed.

[0056] The magnification position refers to the location in the original image that needs to be magnified. The magnification position can be a fixed position, such as the center or top-left corner of the original image. It can also be determined by user settings. For example, a reference pixel can be defined to locate the area to be magnified in the original image, and the magnification position can be determined based on the coordinates of the reference pixel and its position within the area to be magnified (e.g., the developer can define the reference pixel as the center pixel or the top-left pixel of the area to be magnified). It should be noted that the specific form of the magnification position is not limited. It is understood that since the size of the image display area is fixed, the size of the magnified target image is the same as the size of the original image. Furthermore, the size of the target image mapped onto the original image is affected by the magnification factor; the larger the magnification factor, the smaller the mapped area of ​​the target image in the original image, and vice versa. Therefore, in one implementation, to accurately select the location in the original image that needs to be magnified, the magnification position can specifically be the mapped position of the reference pixel in the original image, which can be characterized by its horizontal and vertical proportional positions within the original image. In another implementation, the magnification location can be a specific pixel coordinate range, including a horizontal coordinate range and a vertical coordinate range. It is understood that the length of the pixel coordinate range needs to match the magnification factor. When the magnification factor is large, the length of the pixel coordinate range is small, and when the magnification factor is small, the length of the pixel coordinate range is large. If the two do not match, it will lead to inaccurate selection of subsequent boundary coordinates, resulting in the selection of pixels other than the target pixel.

[0057] Specifically, in one implementation, the process of determining the magnification factor may include the following steps:

[0058] Step 11: Obtain user operation information and use the user operation information to determine the horizontal and vertical magnification of the original image.

[0059] User operation information refers to the operation information entered by the user to set the magnification factor, and its specific form is not limited. The magnification factor can be determined in several optional ways. In one embodiment, the user can input a specific magnification factor value, including a horizontal magnification factor value and a vertical magnification factor value. By setting two magnification factors separately, the original image can be magnified to different degrees in both the horizontal and vertical directions. Electronic devices such as ultrasound equipment can obtain the horizontal and vertical magnification factors by parsing the user operation information according to a preset data format. In another embodiment, a magnification base can be preset, such as 2x, 5x, or 10x. The user can perform the setting operation by adjusting the magnification base, that is, setting the magnification base multiple, and thus setting the total magnification factor. For example, if the user operation information records an operation to magnify three times based on the magnification base, and the magnification base is 2x, then the horizontal or vertical magnification factor is 6x. The horizontal and vertical magnification factors can also be fixed to be equal (changing synchronously). In this case, the user only needs to input / select an overall magnification factor to achieve proportional horizontal and vertical magnification.

[0060] Specifically, in one implementation, the process of determining the magnification position may include the following steps:

[0061] Step 21: Obtain the horizontal and vertical proportional positions of the reference pixel in the original image and determine them as the magnification positions.

[0062] A reference pixel is the mapped pixel in the original image to a specified pixel in the target image. The coordinate ratio of this specified pixel in the target image is the same as the coordinate ratio of the reference pixel in the area to be magnified. The area to be magnified is the region in the original image that will be magnified to obtain the target image.

[0063] The reference pixel can be any pixel in the target image, such as the center pixel or the top-left corner pixel. Users can adjust the area to be magnified in the original image by setting the position of the reference pixel; alternatively, the reference pixel can be a preset, default position in the original image, such as the center point or the top-left corner. The area to be magnified can be any position in the original image. Since the position mapped to the original image is not necessarily an integer coordinate, a proportional position can be used to accurately represent this position. The proportional position includes horizontal and vertical proportional positions, representing the proportional position of the reference pixel in a pixel row sequence and the proportional position of the reference pixel in a pixel column sequence, respectively. For example, the horizontal proportional position of the leftmost pixel in a pixel row is 0%, the horizontal proportional position of the middle pixel is 50%, and the horizontal proportional position of the rightmost pixel is 100%. Generating the magnification position using proportional positions allows for accurate determination of the area to be magnified when the magnification factor is arbitrary.

[0064] S103: Using the magnification factor and magnification position, as well as the length and width of the original image, obtain the boundary coordinates of the area to be magnified.

[0065] The target image refers to the image obtained by magnifying the original image based on the magnification factor and magnification position. It should be noted that the length and width of the target image are the same as those of the original image, and the number of pixels in the target image and the original image are the same. The area mapped in the original image before magnification is the area to be magnified.

[0066] After determining the magnification factor, its length and width can be used in conjunction with the length and width of the original image to determine the length and width of the magnified image obtained by performing full-image magnification on the original image. Based on the magnification position, the specific location of the target image within the magnified image can be determined. Furthermore, this specific location can be mapped using the magnification factor to obtain the boundary coordinates of the area to be magnified. Boundary coordinates refer to the coordinates of the boundary of the area to be magnified within the original image; their specific representation is not limited. For example, if the target image has four sides, in a Cartesian coordinate system, these four sides can be represented as X1 = a, X2 = b, Y1 = c, and Y2 = d. Therefore, the four parameters a, b, c, and d can be used as parameters for the boundary coordinates (or, the coordinate values ​​(a, c), (a, d), (b, c), and (b, d) can be used as boundary coordinates).

[0067] Specifically, the process of obtaining boundary coordinates may include:

[0068] Step 31: Determine the full-image magnification width and full-image magnification length using the magnification factor, width, and length.

[0069] Step 32: Determine the reference position for full-image magnification using the full-image magnification width, full-image magnification length, and magnification position.

[0070] Step 33: Based on the full-map magnification reference position, use the width and length to obtain the boundary coordinates of the area to be magnified.

[0071] Specifically, if the magnification is divided into horizontal and vertical magnification, the horizontal magnification is multiplied by the width to obtain the full-image magnification width, and the vertical magnification is multiplied by the length to obtain the full-image magnification length. Based on the magnified position, a reference position for full-image magnification can be determined within the full-image magnification image, which has the width and length of the full-image magnification. After determining the reference position, the coordinate range of the target image within the full-image magnification image can be defined using the width and length, and then this coordinate range can be mapped onto the original image to obtain the area to be magnified.

[0072] When the magnification position includes both horizontal and vertical scale positions, the process of determining the reference position for full-image magnification using the full-image magnification width, full-image magnification length, and magnification position may include:

[0073] Step 41: Multiply the horizontal scale position by the full-image magnification width to obtain the horizontal reference position; multiply the vertical scale position by the full-image magnification length to obtain the vertical reference position.

[0074] Step 42: Use the horizontal and vertical reference positions to construct the full-map magnification reference position.

[0075] By multiplying the proportional position by the full-image magnification width or length, the corresponding position of the reference pixel in the magnified full-image can be found according to its proportion in the original image. This position is the full-image magnification reference position, composed of the horizontal and vertical reference positions. It is understandable that the specific method for generating boundary coordinates from the full-image magnification reference position varies depending on the actual meaning of the reference pixel position. For example, if the full-image magnification reference position represents the top-left corner pixel coordinates of the target image, then the horizontal and vertical reference positions are mapped back to the original image to determine two boundary coordinates. Simultaneously, the horizontal reference position is added to the width, and the vertical reference position is added to the length to determine two other boundary coordinates. Alternatively, if the full-image magnification reference position represents the center pixel coordinates of the target image, then the horizontal reference position is increased or decreased by half the width, mapped back to the original image to obtain two horizontal boundary coordinates, and the vertical reference position is increased or decreased by half the length, mapped back to the original image to obtain two vertical boundary coordinates.

[0076] Specifically, based on the above embodiments, this embodiment will describe a specific image magnification process. Please refer to [link / reference]. Figure 3 , Figure 3 This is a flowchart illustrating a specific image magnification method provided in this application embodiment. In this embodiment, a centrally symmetrical magnification method is used to magnify the original image. For details, please refer to... Figure 4 , Figure 4 This application provides an image magnification illustration. Centrally symmetrical magnification refers to the magnified area corresponding to the center position of the original image. The starting coordinate (horizontal coordinate) of each pixel row in the original image is i = 1, the ending coordinate is i = M, and the electronic magnification factor (horizontal magnification factor) is Z1. Therefore, the entire magnified image has M * Z1 pixels per pixel row. Based on the principle that electronic magnification does not change image resolution, the number of pixels in the interval from the starting position XS to the ending position XE of the target electronically magnified image is equal to M. When using centrally symmetrical magnification, both the horizontal and vertical scaling factors are 50%, i.e., 1 / 2. If each pixel column in the original image has N pixels, and the vertical magnification factor is Z2, and if the reference pixel is defined as the center pixel of the magnified area / target image, then the reference position for the entire magnified image, determined by the magnification position, is (M * Z1 / 2, N * Z2 / 2).

[0077] After determining the reference position for full-map magnification, the process of generating boundary coordinates may include:

[0078] Step 51: Using the full-image magnification reference position, width, and length, obtain the coordinate range of the area to be magnified in the full-image magnification.

[0079] Step 52: Based on the scaling factor, perform scaling and rounding on the endpoints of the coordinate interval to obtain the boundary coordinates of the region to be magnified.

[0080] Specifically, the reduction factor is the reciprocal of the magnification factor, multiplied by the endpoints of the coordinate interval to complete the reduction process. It can be understood that if there are two magnification factors (horizontal and vertical), then there are also two reduction factors, multiplied by the endpoints of the horizontal and vertical coordinates respectively. Furthermore, the result of the reduction process may be a fraction. In this case, rounding can be performed to ensure that the processed coordinates accurately specify a particular pixel in the original image. Rounding can be done by rounding down or rounding up. During the calculation, the rounded value can be incremented or decremented by one to ensure that the defined number of pixels meets the requirements of subsequent calculations.

[0081] Continuing with the examples from steps 41 to 42, due to the use of centrally symmetrical magnification, the horizontal position of the reference pixel in the magnified full-image (i.e., the horizontal reference position) is 50% (i.e., 1 / 2) of the total number of magnified pixels M*Z1. Since the reference pixel is set at the center of the area to be magnified, the horizontal position of the top-left corner pixel of the image to be magnified in the magnified full-image can be obtained by subtracting half of the original width, M / 2, from the horizontal reference position and then rounding to get the left-end coordinate of the area to be magnified in the magnified full-image (the horizontal coordinate of the starting pixel of the pixel row in the magnified full-image). The coordinates of the pixels at the other corners can be calculated similarly. Intuitively, the horizontal coordinate XS (i.e., the minimum horizontal coordinate in the first coordinate system) of the starting pixel in each pixel row of the target image in the magnified full-image can be obtained using Formula 3-1, and the horizontal coordinate XE (i.e., the maximum horizontal coordinate in the first coordinate system) of the ending pixel can be obtained using Formula 3-2. The column pixel direction can be calculated using the same method to obtain the starting row coordinates YS (i.e., the smallest y-coordinate in the first coordinate system) and the ending row coordinates YE (i.e., the largest y-coordinate in the first coordinate system). Where:

[0082]

[0083] XE=XS+M-1 3-2

[0084] As can be seen, the number of pixels in the width defined by the start and end points in the fully enlarged image is still M, which satisfies the requirement that electronic magnification does not change the image resolution.

[0085] Assuming the original image size is X*Y (X represents width, Y represents length), if the size of the enlarged image is M*N, then the reduction factors along the x-axis and y-axis are X / M and Y / N, respectively. The reduction factors are calculated using electronic magnification. Assuming the horizontal magnification is Z1 and the vertical magnification is Z2, then the horizontal reduction factor is 1 / Z1 and the vertical reduction factor is 1 / Z2.

[0086] The coordinates (i,j) of any pixel within the coordinate range, mapped back to the original image by the scaling factor, are (i',j'), where i' = 1 / Z1*i and j' = 1 / Z2*j. The rounded coordinates are then (i'_int,j'_int). Here, i ranges from (XS,XE), and j ranges from (YS,YE). Using this principle, by mapping (XS,YS), (XE,YS), (XS,YE), and (XE,YE) back to the original image by the scaling factor, the boundary coordinates of the area to be magnified in the original image can be calculated.

[0087] S104: Based on the boundary coordinates, determine the region to be magnified in the original image, and perform interpolation processing on the target pixels in the region to be magnified to obtain the target image.

[0088] Boundary coordinates can define the location of the area to be magnified in the original image, thereby enabling the acquisition of target pixels. After interpolation, the target pixels can be used to obtain interpolated pixels in the target image. The correspondence between target pixels and interpolated pixels is not limited. For example, the relationship between target pixels and interpolated pixels can be determined according to the interpolation algorithm used. For instance, if the interpolation algorithm used is bilinear interpolation, for the interpolated pixel with the second coordinate (i,j), its corresponding target pixels are four target pixel values ​​with coordinates (i'_int,j'_int), (i'_int+1,j'_int), (i'_int,j'_int+1), and (i'_int+1,j'_int+1).

[0089] It should be noted that the above four steps can be executed sequentially, meaning that one step is executed before the next step is initiated. In applications involving video magnification or batch magnification of a large number of independent images, to improve processing speed, the above four steps can be executed in parallel, meaning that all four steps are executed simultaneously, with each step corresponding to a different object when executed independently. For example, the process is as follows: acquire original image A; determine the magnification factor and magnification position corresponding to original image B; use the magnification factor and magnification position corresponding to original image C, as well as the length and width of original image C, to determine the boundary coordinates of the area to be magnified in original image C; based on the boundary coordinates of original image D, determine the target pixel in original image D, and use it for interpolation to obtain the target image corresponding to original image D.

[0090] This application does not perform multiple interpolations and cropping on the original image. By calculating the boundary coordinates of the target image, a portion of the pixels in the original image, i.e., the target pixels within the area to be magnified, can be directly used for interpolation processing to obtain the target image. The entire processing does not generate an intermediate image (i.e., a fully magnified image), and the magnification process does not cause any change in the number of image pixels; that is, the original image and the target image have the same number of pixels.

[0091] The image magnification method provided in this application does not use a method of first magnifying and then cropping to obtain the target image after acquiring the original image. Instead, it determines the coordinate boundaries of the area to be magnified in the original image based on the magnification factor, the magnification position, and the size of the original image. Specifically, based on the magnification factor and the length and width of the original image, the size of the fully magnified image obtained after magnifying the entire original image can be determined. Based on the magnification position, the coordinate boundaries of the part of the original image required to generate the target image can be determined, assuming the target image and the original image are the same size. Based on the boundary coordinates, the target pixels in the original image used to generate the target image can be determined, and interpolation processing is performed using the target pixels to obtain the target image. Since there is no intermediate image, and the original image is directly magnified, it does not occupy the memory and bandwidth required to store intermediate images, resulting in faster processing speed and better real-time performance in video application scenarios.

[0092] Furthermore, in one implementation, in video magnification applications, the length and width, magnification factor, and magnification position of the original image typically remain unchanged. Therefore, steps S102 and S103 can be executed once during initialization to obtain the boundary coordinates, and then not executed again. In subsequent operations, steps S101 and S104 can be executed sequentially or in parallel. While acquiring new video frames as the original image, the target pixels are determined and interpolated within the acquired original image using the boundary coordinates determined during initialization.

[0093] Specifically, in video magnification applications, electronic devices such as ultrasound equipment initialize upon detecting a user command, executing steps S102 and S103 as described above. Specifically, the magnification factor, magnification position, and the length and width of the original image can be pre-stored in the electronic device and directly read and used during initialization, or obtained through interaction with the user or other electronic devices during initialization. After obtaining the above data, the boundary coordinates of the area to be magnified are calculated. After initialization, steps S101 and S104 are executed, i.e., the original image is acquired, and interpolation processing is performed using the existing boundary coordinates to obtain the corresponding target image.

[0094] Please refer to Figure 5 , Figure 5 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application. The electronic device 100 may include a processor 101 and a memory 102, and may further include one or more of the following: a multimedia component 103, an information input / output (I / O) interface 104, and a communication component 105.

[0095] The processor 101 controls the overall operation of the electronic device 100 to complete all or part of the steps in the image magnification method described above. The memory 102 stores various types of data to support the operation of the electronic device 100. This data may include, for example, instructions for any application or method operating on the electronic device 100, as well as application-related data. The memory 102 may be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as one or more of Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.

[0096] Multimedia component 103 may include a screen and an audio component. The screen may be, for example, a touchscreen, and the audio component is used to output and / or input audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signals may be further stored in memory 102 or transmitted via communication component 105. The audio component also includes at least one speaker for outputting audio signals. I / O interface 104 provides an interface between processor 101 and other interface modules, such as a keyboard, mouse, buttons, etc. These buttons may be virtual or physical buttons. Communication component 105 is used for wired or wireless communication between electronic device 100 and other devices. Wireless communication may include Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G, or 4G, or a combination of these. Therefore, the corresponding communication component 105 may include a Wi-Fi component, a Bluetooth component, or an NFC component.

[0097] The electronic device 100 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the image magnification method given in the above embodiments.

[0098] The image magnification process is described below from the perspective of data flow in the hardware components of the electronic device. Based on the aforementioned hardware structure of the electronic device, to reduce the storage space occupied by the original image while improving processing speed, the processor acquires the original image data pixel by pixel and stores it in the target memory. Since the boundary coordinates are predetermined, only the original image data related to the area to be magnified can be acquired. Once all the original image data for the area to be magnified has been acquired and stored, the acquisition of the original image can be considered complete.

[0099] In video magnification applications, the magnification factor, magnification position, and the length and width of the original image remain unchanged. In one implementation, if the length and width of the original image have been pre-set, the original image corresponding to the pixel-by-pixel data can be any image in the video stream. In this case, since the length and width information of the original image are fixed, when acquiring each video frame in the video stream as the original image, it is not necessary to acquire and store the entire video frame; only the portion required to generate the target image needs to be acquired.

[0100] In another implementation, the length and width of the original image cannot be determined before processing the video stream. In this case, except for the first video frame used as the original image, whose boundary coordinates need to be determined, the boundary coordinates of all other video frames used as original images are already determined. Furthermore, the fixed zoom position means the positions of the target pixels required to generate the target image are also already determined. In this situation, when acquiring non-first video frames from the video stream as original images, it is not necessary to acquire and store the entire video frame; only the portion required to generate the target image needs to be acquired. This reduces both the storage space required to store the original image and the time spent acquiring it, thus improving processing speed.

[0101] It is understandable that the execution order of the steps in the image magnification methods corresponding to the two implementation methods described above is also different. For the first implementation method, the electronic device can first execute steps S102 and S103 during initialization, and then execute steps S101 and S104 during application. For the second implementation method, the electronic device first executes step S102 during initialization, executes step S101 during application, and then executes step S103 once based on the length and width of the original image. After this execution of step S103, it is not executed again; only steps S101 and S104 are executed.

[0102] Specifically, the original image data constituting the original image is obtained sequentially, pixel by pixel. Each row of original image data includes data corresponding to a row of pixels, such as pixel values. For example, the original image data can be obtained row by row, starting from the top or bottom row. After obtaining the original image data, it is stored in a cache for later retrieval. Since the position of the target pixel corresponding to the boundary coordinates in the original image is fixed (i.e., the row and column numbers of the target pixel are fixed), when obtaining the original image data, it can be determined whether all pixels corresponding to the target pixel have been stored, i.e., whether all the original image data corresponding to the boundary coordinates have been obtained and stored. If so, it means that all the data corresponding to the target pixel required to generate the target image has been obtained, and obtaining the remaining data is no longer meaningful. In this case, it can be directly determined that the original image has been obtained, and the acquisition of useless data can be stopped. For example, the determined boundary coordinates can be X1 = a, X2 = b, Y1 = c, Y2 = d, where a < b, c < d. The row numbers of the original image increase from top to bottom, with a minimum value of 1. A row number identifier is set to record the row number of the latest acquired data row. Starting from the top row of raw image data, raw image data is acquired. The row number identifier is updated after each acquisition, starting from 1 and incrementing sequentially. When row number identifier 'c' is detected, it indicates that the acquired raw image data contains data for areas to be magnified. Raw image data is acquired pixel by pixel, and the row number identifier is continuously updated. When row number identifier 'd' is detected, it indicates that all data for areas to be magnified has been acquired, and the raw image acquisition is complete. The principle for acquiring raw images pixel by column is the same.

[0103] In one implementation, to reduce the bandwidth occupied by reading the image from the cache during interpolation processing and to improve the speed of reading target pixel-related data during interpolation processing, at least two memory groups can be preset, each including several storage units. If the processor detects an update to the row flag, it reads the target pixel row from the cache and stores it into the target memory group specified by the storage location flag. Subsequently, the processor updates the storage location flag. Furthermore, the processor updates the row flag when it detects a mismatch between the current target pixel and the row flag.

[0104] Correspondingly, when the processor performs interpolation processing on the target pixels in the area to be magnified to obtain the target image, it reads the current target pixel from each memory in the target memory group after the target memory group has been updated.

[0105] The processor uses the current target pixel to perform interpolation processing to obtain the target interpolated pixel of the target image;

[0106] The processor updates the current target pixel.

[0107] The row flag indicates the row number of one or more original images to be read. If the row flag is updated, it means the data in all memory groups is insufficient for interpolation. Therefore, a new target pixel row needs to be read from the cache and stored in the target memory group specified by the storage location flag, so that the new target pixel row can be read from the target memory group for interpolation. The target pixel row refers to several pixel rows associated with the updated row flag; the specific number of pixel rows depends on the interpolation algorithm used. The storage location flag specifies the memory group where the earliest stored pixel row is located; this memory group is the target memory group. After storage is complete, because the data storage time in each memory group has been updated, the storage location flag is updated to point back to the memory group where the earliest stored pixel row was located.

[0108] The current target pixel refers to the pixel in the area to be magnified for the current interpolation process. There are multiple interpolation pixels in the target image, each with different coordinates, and the coordinates of the target pixel required for their generation also differ. The target pixel required when generating the target interpolation pixel is the current target pixel. Since the generation process of each interpolation pixel in the target image needs to be based on target pixels with different positions, and memory groups are used to provide data support for the interpolation process of target pixels at different coordinate positions, the data in each memory group needs to change as the current target pixel corresponding to the interpolation pixel changes. Typically, the interpolation pixels in the target image are generated one by one in a certain order, which matches the data update order in each memory group, and also matches the row flag update order. Therefore, if the current target pixel does not match the row flag, it means that a new row of target pixels needs to be introduced in one of all memory groups, and thus the row flag is updated. After the target memory group is updated, the current target pixel is read from each memory group. Since multiple pixels within the same pixel row may be the current target pixel, a pixel group can include multiple storage units. Although the same pixel group stores the same data, different current target pixels can be read from different storage units during retrieval, allowing all current target pixels to be read in a single process, reducing the retrieval time. After obtaining the current target pixel, interpolation is performed to obtain the target interpolated pixel. A new round of interpolation is then performed by updating the current target pixel.

[0109] For example, if there are two memory groups, each with four storage units, the first memory group stores the data of row i and row i+1, and the second memory group stores the data of row i-1 and row i. The row flag is i+1, and the storage location flag points to the second memory group. The coordinates of the current target pixel required for generating the target interpolation pixel are (i,j), (i+1,j), (i,j+1), and (i+1,j+1). When the processor detects that the current target pixel matches the row flag, it reads the corresponding current target pixel with coordinates (i,j), (i+1,j), (i,j+1), and (i+1,j+1) from the first memory group, performs interpolation processing, and then selects a new target interpolation pixel to update the current target pixel. If the current target pixel is updated to a target pixel with coordinates (i+1,j), (i+2,j), (i+1,j+1), and (i+2,j+1), the row flag does not match the current difference pixel. Therefore, the row flag is updated to i+2. After the row flag is updated, the target pixel rows specified by the row flag (i.e., the (i+2)th and (i+1)th pixel rows) are retrieved from the cache, and the data of the (i+2)th and (i+1)th rows are stored in four memory locations in the second memory group. Memory locations 1 and 2 are used to store the (i+1)th row data, and memory locations 3 and 4 are used to store the (i+2)th row data. After storage, the storage location flag is set to point to the first memory group for the next update.

[0110] Please refer to Figure 6 , Figure 6 This is a schematic diagram of a specific electronic device system structure provided in an embodiment of this application, including a parameter configuration and calculation unit, an amplification main control unit, a video image write / read control unit, a RAM control unit, an interpolation calculation unit, etc. Figure 6As shown, when a source video image is detected, the video image write-read control unit starts working. On one hand, it activates the DDR controller to cache the source video image in the DDR. On the other hand, it informs the amplification main control unit in real time about the cached information, such as how many rows of pixels have been cached. After the amplification main control unit detects that the source video has started to be cached, it begins to latch the coordinates XS, XE, YS, YE, horizontal scaling factor 1 / Z1, and vertical scaling factor 1 / Z2 values ​​calculated by the parameter configuration and calculation unit. When the number of cached image rows reaches a set value, the amplification main control unit provides the information of the valid rows of pixels to be read to the video image write-read control unit. The video image write-read control unit then enables the DDR controller and reads the valid rows of pixels from the DDR. The amplification main control unit simultaneously enables the RAM control unit, preparing it to receive data transmitted from the video image write-read control unit. The read data is written row by row by the RAM control unit into the RAM group. Since the quadratic linear interpolation calculation unit requires four adjacent pixels for one interpolation operation, four RAMs are used in this embodiment to store the read DDR data. Storage is performed as follows: four RAMs are numbered RAM0, RAM1, RAM2, and RAM3 respectively. During storage, the pixels of the current row are written to RAM0 and RAM2, assuming they are in the Kth row, and the pixels of the (K+1)th row are written to RAM1 and RAM3. When the interpolation calculation unit retrieves data from the RAM, its base address for retrieving RAM data comes from the main control amplification unit. The main control amplification unit provides the address of each column pixel to be retrieved, such as j'_int, to the interpolation calculation unit. The interpolation calculation unit then reads pixels from address j'_int in RAM0 and RAM1 respectively, and then reads two more pixels from address j'_int+1 in RAM2 and RAM3, completing the acquisition of four pixels.

[0111] In this embodiment, the main control unit uses the value (YS+y) / Z2 as the offset address for retrieving pixels from DDR (the value of y is between 0 and YE minus YS). It reads the source image row pixels from DDR and stores them temporarily in RAM for use by the interpolation calculation unit, which greatly improves the output efficiency. In addition, when it is detected that there are already row pixels to be calculated stored in RAM, the image is not read from DDR, saving system bandwidth.

[0112] The image magnification apparatus provided in the embodiments of this application is described below. The image magnification apparatus described below can be referred to in correspondence with the image magnification method described above.

[0113] Please refer to Figure 7 , Figure 7 A schematic diagram of an image magnification device provided in this application embodiment includes:

[0114] Image acquisition module 110 is used to acquire the original image;

[0115] The parameter determination module 120 is used to determine the magnification and magnification position;

[0116] Boundary calculation module 130 is used to obtain the boundary coordinates of the area to be magnified by using the magnification factor, the magnification position, and the length and width of the original image;

[0117] The pixel interpolation module 140 is used to determine the target pixel in the region to be magnified in the original image based on the boundary coordinates, and to perform interpolation processing on the target pixel in the region to be magnified to obtain the target image.

[0118] Optionally, module 120 is defined, including:

[0119] The magnification determination unit is used to acquire user operation information and use the user operation information to determine the horizontal magnification and vertical magnification of the original image.

[0120] Optionally, module 120 is defined, including:

[0121] A position determination unit is used to obtain the horizontal and vertical proportional positions of a reference pixel in the original image and determine it as the magnified position; wherein the reference pixel is a pixel at any corner or center point of the area to be magnified.

[0122] Optionally, the boundary determination module 130 includes:

[0123] The full-image parameter determination unit is used to determine the full-image magnification width and full-image magnification length using the magnification factor, the width, and the length;

[0124] The reference coordinate determination unit is used to determine the reference position of the full-image magnification using the full-image magnification width, the full-image magnification length, and the magnification position;

[0125] The boundary determination unit is used to obtain the boundary coordinates of the area to be magnified based on the full-image magnification reference position, using the width and the length.

[0126] Optionally, the magnified position includes a horizontal scaling position and a vertical scaling position, and the reference coordinate determining unit includes:

[0127] The first sub-unit is used to obtain the horizontal reference position by multiplying the horizontal proportional position by the full-image magnification width;

[0128] The second sub-unit is used to obtain the longitudinal reference position by multiplying the longitudinal proportional position by the full-image magnification length;

[0129] The third sub-unit is used to construct the full-view magnification reference position using the horizontal reference position and the vertical reference position.

[0130] Optionally, the boundary determination unit includes:

[0131] An interval determination subunit is used to obtain the coordinate interval of the target image in the full-image magnification image by using the full-image magnification reference position, the width, and the length; the full-image magnification image is an image obtained by fully magnifying the original image according to the magnification factor.

[0132] The reduction subunit is used to reduce the magnification factor by performing reduction and rounding operations on the endpoints of the coordinate interval to obtain the boundary coordinates; the reduction factor is the reciprocal of the magnification factor, and the first coordinate is any coordinate within the coordinate interval.

[0133] The following describes the computer-readable storage medium provided in the embodiments of this application. The computer-readable storage medium described below can be referred to in correspondence with the image magnification method described above.

[0134] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the above-described image magnification method.

[0135] The computer-readable storage medium may include various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0136] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.

[0137] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented 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 this application.

[0138] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.

[0139] Finally, it should be noted that in this document, relationships such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "include," "contain," or any other variations are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus.

[0140] This document uses specific examples to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. An image magnification method, characterized in that, include: Obtain the original image; Determine the magnification factor, obtain the horizontal and vertical proportional positions of the reference pixel in the original image, and determine it as the magnification position; Using the magnification factor, the magnification position, and the length and width of the original image, the boundary coordinates of the area to be magnified are obtained; Based on the boundary coordinates, the region to be magnified is determined in the original image, and the target pixels in the region to be magnified are interpolated to obtain the target image. Wherein, the length and width of the target image are the same as the length and width of the original image, and the number of pixels in the target image and the original image are the same; the reference pixel refers to the mapping pixel of a specified pixel in the target image in the original image, and the coordinate ratio position of the specified pixel in the target image is the same as the coordinate ratio position of the reference pixel in the area to be magnified.

2. The image magnification method according to claim 1, characterized in that, Determining the magnification includes: Obtain user operation information, and use the user operation information to determine the horizontal and vertical magnification of the original image.

3. The image magnification method according to claim 1, characterized in that, The reference pixel is a pixel at any corner or center point of the area to be magnified.

4. The image magnification method according to claim 3, characterized in that, The step of obtaining the boundary coordinates of the area to be magnified using the magnification factor, the magnification position, and the length and width of the original image includes: The full-image magnification width and full-image magnification length are determined using the magnification factor, the width, and the length. The reference position for full-image magnification is determined using the full-image magnification width, the full-image magnification length, and the magnification position. Based on the full-image magnification reference position, the boundary coordinates of the area to be magnified are obtained using the width and the length.

5. The image magnification method according to claim 4, characterized in that, The magnified position includes a horizontal scale position and a vertical scale position. Determining the full-image magnification reference position using the full-image magnification width, the full-image magnification length, and the magnified position includes: The horizontal reference position is obtained by multiplying the horizontal proportional position by the full-image magnification width; The vertical reference position is obtained by multiplying the vertical proportional position by the magnified length of the entire image; The horizontal reference position and the vertical reference position are used to construct the full-view magnification reference position.

6. The image magnification method according to claim 4, characterized in that, The step of obtaining the boundary coordinates of the area to be magnified based on the full-image magnification reference position, using the width and the length, includes: Using the full-image magnification reference position, the width, and the length, the coordinate range of the area to be magnified is obtained in the full-image magnification image; the full-image magnification image is an image obtained by fully magnifying the original image according to the magnification factor; Based on the reduction factor, the endpoints of the coordinate interval are subjected to reduction and rounding processing to obtain the boundary coordinates; the reduction factor is the reciprocal of the magnification factor, and the first coordinate is any coordinate within the coordinate interval.

7. An image magnification device, characterized in that, include: The image acquisition module is used to acquire the original image; The parameter determination module is used to determine the magnification factor, obtain the horizontal and vertical proportional positions of the reference pixel in the original image, and determine it as the magnification position; A boundary calculation module is used to obtain the boundary coordinates of the area to be magnified using the magnification factor, the magnification position, and the length and width of the original image; A pixel interpolation module is used to determine the region to be magnified in the original image based on the boundary coordinates, and to perform interpolation processing on the target pixels in the region to be magnified to obtain the target image. Wherein, the length and width of the target image are the same as the length and width of the original image, and the number of pixels in the target image and the original image are the same; the reference pixel refers to the mapping pixel of a specified pixel in the target image in the original image, and the coordinate ratio position of the specified pixel in the target image is the same as the coordinate ratio position of the reference pixel in the area to be magnified.

8. An electronic device, characterized in that, Includes memory and processor, wherein: The memory is used to store computer programs; The processor is configured to execute the computer program to implement the image magnification method as described in any one of claims 1 to 6.

9. The electronic device according to claim 8, characterized in that, When acquiring the original image, the processor acquires the original image data in pixel rows and stores the original image data in a cache.

10. The electronic device according to claim 9, characterized in that, The processor reads the target pixel row from the cache and stores the target pixel row into a designated target memory group; the target memory group includes at least two storage units, which are used to store adjacent target pixel rows respectively. The processor reads the pixels in the current target pixel row from each of the storage units of the target memory group; The processor uses the pixels of the current target pixel row to perform interpolation processing to obtain the interpolated pixels of the current target pixel row; After obtaining all the interpolated pixels of the row, the processor updates the current target pixel row in the target memory group by reading the new target pixel row from the cache.

11. A computer-readable storage medium, characterized in that, Used to store a computer program, wherein the computer program, when executed by a processor, implements the image magnification method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Image zooming method and device, electronic equipment and storage medium

    CN112508793A