Focusing position determination method and device, storage medium and electronic device
By determining the target screen partition among multiple screen partitions of the image acquisition device in the infrared thermal imaging system and calculating the real-time gradient sum, the problem of insufficient focusing accuracy and only focusing on the central area in infrared thermal imaging autofocus technology is solved. Achieving high-precision focusing on any area.
Patent Information
- Application Number
- CN202411044416.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-31
- Publication Date
- 2024-10-01
AI Technical Summary
The existing infrared thermal imaging autofocus technology has insufficient focusing accuracy and can only focus on the central area and cannot focus on other areas, resulting in reduced practicality when the target is located at the edge.
By determining the target screen partition to be focused among the multiple screen partitions of the image acquisition device, and during the movement of the image acquisition device, calculating the real-time gradient sum of multiple first pixel points of the target screen partition, and determining the maximum real-time gradient sum, to determine the focus position.
The focus accuracy is improved, allowing the image acquisition device to focus in any area, solving the problem of insufficient focus accuracy and being able to focus only on the central area.
Smart Images

Figure CN118741308A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing, and in particular, to a method and device for determining a focus position, a storage medium, and an electronic device. Background Art
[0002] In recent years, the automatic focus function of infrared thermal imaging has been used in infrared thermal imaging, which facilitates the operation of infrared focusing. However, the current automatic focus technology has the problem of insufficient accuracy, and can only focus on the center area, but not other areas, which reduces the practicality when the target is at the edge.
[0003] There is no effective solution yet for the problem that the autofocus technology in the related art has insufficient focusing accuracy and can only focus on the central area but not other areas. Summary of the invention
[0004] The embodiments of the present application relate to a method and device for determining a focus position, a storage medium, and an electronic device. Through the embodiments of the present application, the problem that the autofocus technology in the related art has insufficient focusing accuracy and can only focus on the central area but not other areas can be solved.
[0005] According to an embodiment of the embodiments of the present application, a method for determining a focus position is provided, comprising: determining a target screen partition to be focused on among multiple screen partitions of an image acquisition device; determining a real-time gradient sum of multiple first pixel points of the target screen partition during movement of the image acquisition device, and determining a maximum real-time gradient sum among the multiple real-time gradient sums; and determining a target position of the image acquisition device corresponding to the maximum real-time gradient sum as a focus position for focusing on the target screen partition.
[0006] In an exemplary embodiment, before determining a target screen partition to be focused on among multiple screen partitions of an image acquisition device, the method further includes: determining a first screen size of a screen of the image acquisition device; determining a second screen size of the multiple screen partitions to be screen partitioned according to the screen size; and partitioning the screen according to the second screen size to obtain the multiple screen partitions.
[0007] In an exemplary embodiment, a target screen partition to be focused on is determined among multiple screen partitions of an image acquisition device, including: when a target operation of a target object is received, determining a target area corresponding to the target operation; determining multiple second pixel points in the target area, and determining a ratio of the number of the multiple second pixel points in each screen partition to the total number of the second pixel points; determining a maximum ratio among multiple ratios; and determining the screen partition corresponding to the maximum ratio as the target screen partition.
[0008] In an exemplary embodiment, during the movement of the image acquisition device, determining the real-time gradient sum of multiple first pixel points of the target screen partition includes: determining multiple first pixel points of the target screen partition; determining the gradient value of each first pixel point at each moving position; and determining the sum of the multiple gradient values as the real-time gradient sum of the multiple first pixel points at each moving position.
[0009] In an exemplary embodiment, determining the gradient value of each first pixel at each moving position includes: obtaining the amplitude grayscale value received by each first pixel at each moving position; calculating the horizontal gradient corresponding to the amplitude grayscale value; and calculating the vertical gradient corresponding to the amplitude grayscale value; and calculating the diagonal gradient corresponding to the amplitude grayscale value; determining the product of the diagonal gradient and a preset weighting coefficient; and determining the gradient value of each first pixel at each moving position based on the product, the horizontal gradient and the vertical gradient.
[0010] In an exemplary embodiment, determining a maximum real-time gradient sum among multiple real-time gradient sums includes: when it is determined that the multiple real-time gradient sums include n real-time gradient sums, determining a first size relationship between a first real-time gradient sum among the n real-time gradient sums and a second real-time gradient sum among the n real-time gradient sums, wherein n is a positive integer greater than 2; when the first size relationship indicates that the first real-time gradient sum is greater than the second real-time gradient sum, determining the second real-time gradient sum as a target real-time gradient sum; when the first size relationship indicates that the first real-time gradient sum is less than or equal to the second real-time gradient sum, determining the first real-time gradient sum as the target real-time gradient sum; and determining the maximum real-time gradient sum according to the target real-time gradient sum.
[0011] In an exemplary embodiment, determining the maximum real-time gradient sum according to the target real-time gradient sum includes: determining a second size relationship between the target real-time gradient sum and an m-th real-time gradient sum among the n real-time gradient sums, where m is a positive integer greater than 2 and less than n; when the second size relationship indicates that the target real-time gradient sum is greater than the m-th real-time gradient sum, not updating the target real-time gradient sum; when the second size relationship indicates that the target real-time gradient sum is less than or equal to the m-th real-time gradient sum, updating the m-th real-time gradient sum to the target real-time gradient sum; determining a third size relationship between the target real-time gradient sum and an n-th real-time gradient sum among the n real-time gradient sums; when the third size relationship indicates that the target real-time gradient sum is greater than the n-th real-time gradient sum, determining the target real-time gradient sum as the maximum real-time gradient sum; and when the third size relationship indicates that the target real-time gradient sum is less than or equal to the n-th real-time gradient sum, determining the n-th real-time gradient sum as the maximum real-time gradient sum.
[0012] According to another embodiment of the embodiments of the present application, a device for determining a focus position is further provided, comprising: a first determination module, used to determine a target screen partition to be focused on among multiple screen partitions of an image acquisition device; a second determination module, used to determine the real-time gradient sum of multiple first pixel points of the target screen partition during the movement of the image acquisition device, and determine the maximum real-time gradient sum among the multiple real-time gradient sums; and a third determination module, used to determine the target position of the image acquisition device corresponding to the maximum real-time gradient sum as the focus position for focusing on the target screen partition.
[0013] According to another aspect of the embodiments of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the above method when running.
[0014] According to another aspect of the embodiments of the present application, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the method through the computer program.
[0015] According to another aspect of the embodiments of the present application, a computer program product is provided, including a computer program, wherein the computer program is executed by a processor to perform the method.
[0016] In an embodiment of the present application, a target screen partition to be focused on among multiple screen partitions in an image acquisition device is determined, and in the process of moving the image acquisition device, the real-time gradient sum of multiple first pixel points of the target screen partition is determined, and the maximum real-time gradient sum is determined among the multiple real-time gradient sums, and the target position in the image acquisition device corresponding to the maximum real-time gradient sum is determined as the position for focusing on the target screen partition. That is, after determining the target screen partition to be focused on, in an embodiment of the present application, the maximum real-time gradient sum of the target screen partition can be determined in the process of moving the image acquisition device, and the focus position can be determined according to the maximum real-time gradient sum. This solves the problem that the auto-focus technology in the related art has insufficient focusing accuracy and can only focus on the central area but not other areas. In turn, the focusing accuracy can be improved, and any area of the image acquisition device can be focused. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0018] Figure 1 It is a hardware structure block diagram of a computer terminal of a method for determining a focus position according to an embodiment of the present application;
[0019] Figure 2 is a flow chart of a method for determining a focus position according to an embodiment of the present application;
[0020] Figure 3 is a flow chart of a touch screen automatic focusing method based on infrared thermal imaging according to an optional embodiment of the present application;
[0021] Figure 4 It is a structural block diagram of a device for determining a focus position according to an embodiment of the present application. DETAILED DESCRIPTION
[0022] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0023] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products, or devices; "plurality" means two or more.
[0024] The method embodiments provided in the embodiments of the present application can be executed in a computer terminal or similar computing device or cloud platform or independent physical server or software platform, wherein the above software platform is run through one or more servers. Taking running on a computer terminal as an example, Figure 1 1 is a hardware structure block diagram of a computer terminal of a method for determining a focus position according to an embodiment of the present application. Figure 1 As shown, the computer terminal may include one or more ( Figure 1 Only one is shown in the figure) processor 102 and memory 104 for storing data. In an exemplary embodiment, the computer terminal may also include a transmission device 106 for communication functions and an input and output device 108, wherein the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA. A person skilled in the art can understand that Figure 1 The structure shown is only for illustration and does not limit the structure of the above-mentioned computer terminal. Figure 1 More or fewer components as shown, or with Figure 1 Equivalent functions or comparisons shown Figure 1 A different configuration with more features is shown.
[0025] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as computer programs corresponding to the methods in the embodiments of the present application. The processor 102 executes various functional applications and data processing by running the computer programs stored in the memory 104, that is, the above-mentioned methods are implemented. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the computer terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0026] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of a computer terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0027] In this embodiment, a method for determining a focus position is provided, which is applied to the above-mentioned computer terminal. Figure 2 is a flow chart of a method for determining a focus position according to an embodiment of the present application, the flow chart comprising the following steps:
[0028] Step S202, determining a target screen partition to be focused on among multiple screen partitions of the image acquisition device;
[0029] The image acquisition device may be a camera. The target screen partition to be focused may be the central area of the camera screen, or may be other partitions, such as an edge partition.
[0030] Step S204, during the movement of the image acquisition device, determining the real-time gradient sums of a plurality of first pixel points of the target screen partition, and determining the maximum real-time gradient sum among the plurality of real-time gradient sums;
[0031] It can be understood that, during the movement of the image acquisition device, the real-time gradient of the target screen partition changes with the change of the position of the image acquisition device.
[0032] Step S206: Determine the maximum real-time gradient and the corresponding target position of the image acquisition device as a focus position for focusing on the target screen partition.
[0033] In an embodiment of the present application, a target screen partition to be focused on among multiple screen partitions in an image acquisition device is determined, and in the process of moving the image acquisition device, the real-time gradient sum of multiple first pixel points of the target screen partition is determined, and the maximum real-time gradient sum is determined among the multiple real-time gradient sums, and the target position in the image acquisition device corresponding to the maximum real-time gradient sum is determined as the position for focusing on the target screen partition. That is, after determining the target screen partition to be focused on, in an embodiment of the present application, the maximum real-time gradient sum of the target screen partition can be determined in the process of moving the image acquisition device, and the focus position can be determined according to the maximum real-time gradient sum. This solves the problem that the auto-focus technology in the related art has insufficient focusing accuracy and can only focus on the central area but not other areas. In turn, the focusing accuracy can be improved, and any area of the image acquisition device can be focused.
[0034] Optionally, before determining the target screen partition to be focused on among the multiple screen partitions of the image acquisition device in the above step S202, the method also includes: determining a first screen size of the screen of the image acquisition device; determining a second screen size of the multiple screen partitions to be screen partitioned according to the screen size; and partitioning the screen according to the second screen size to obtain the multiple screen partitions.
[0035] It is understandable that before determining the target screen partition, it is also necessary to partition the screen of the image acquisition device into multiple partitions, specifically:
[0036] Determine a first screen size of the screen and a second screen size of multiple screen partitions to be partitioned, and divide the first screen partition into multiple second screen partitions according to the first length and first width of the first screen size and the second length and second width of the second screen size.
[0037] The number of multiple second screen partitions can also be determined. Specifically, a first quotient of a first length of the first screen size and a second length of the second screen size, and a second quotient of a first width of the first screen size and a second width of the second screen size are determined; the number of second screen partitions can be determined by the first quotient and the second quotient.
[0038] Optionally, the above-mentioned step S202 of determining a target screen partition to be focused on among multiple screen partitions of the image acquisition device includes: when a target operation of the target object is received, determining a target area corresponding to the target operation; determining multiple second pixel points in the target area, and determining a ratio of the number of the multiple second pixel points in each screen partition to the total number of the second pixel points; determining a maximum ratio among multiple ratios; and determining the screen partition corresponding to the maximum ratio as the target screen partition.
[0039] It can be understood that the target operation can be a touch screen operation of the target object on the image acquisition device. When the touch screen operation is received, the target area of the screen corresponding to the touch screen operation is determined, and multiple second pixel points in the target area are determined. The ratio of the number of second pixel points in each partition of the screen to the total number of second pixel points is determined. For example, when the total number is determined to be 30, the number of second pixel points contained in the first screen partition is 15, and the ratio to the total number is 1 / 2, the number of second pixel points contained in the second screen partition is 5, and the ratio to the total number is 1 / 6, and the number of second pixel points contained in the third screen partition is 10, and the ratio to the total number is 1 / 3. Then the first screen partition can be determined as the target screen partition.
[0040] Optionally, in the above step S204, determining the real-time gradient sum of multiple first pixel points of the target screen partition during the movement of the image acquisition device includes: determining multiple first pixel points of the target screen partition; determining the gradient value of each first pixel point at each moving position; and determining the sum of the multiple gradient values as the real-time gradient sum of the multiple first pixel points at each moving position.
[0041] Wherein, determining the gradient value of each first pixel point at each moving position includes: obtaining the amplitude grayscale value received by each first pixel point at each moving position; calculating the horizontal gradient corresponding to the amplitude grayscale value; and calculating the vertical gradient corresponding to the amplitude grayscale value; and calculating the diagonal gradient corresponding to the amplitude grayscale value; determining the product of the diagonal gradient and a preset weighting coefficient; and determining the gradient value of each first pixel point at each moving position based on the product, the horizontal gradient and the vertical gradient.
[0042] Through the above analysis, it can be known that when the image acquisition device moves, the real-time gradient sum of the pixel points is changing. It is necessary to determine the amplitude grayscale value of each first pixel point when the image acquisition device moves to each position, and then determine the horizontal gradient, vertical gradient and diagonal gradient through the amplitude grayscale value, wherein the diagonal gradient needs to be multiplied by the corresponding preset weight coefficient, and the weight coefficient can be 0.5. Then, the real-time gradient sum of each first pixel point is determined by multiplying the horizontal gradient, vertical gradient and diagonal gradient with the preset weight coefficient.
[0043] The real-time gradient sum of multiple pixels at each moving position can be determined by the real-time gradient sum of each first pixel point.
[0044] Optionally, determining the maximum real-time gradient sum among multiple real-time gradient sums in the above-mentioned step S204 includes: when it is determined that the multiple real-time gradient sums include n real-time gradient sums, determining a first size relationship between a first real-time gradient sum among the n real-time gradient sums and a second real-time gradient sum among the n real-time gradient sums, wherein n is a positive integer greater than 2; when the first size relationship indicates that the first real-time gradient sum is greater than the second real-time gradient sum, determining the second real-time gradient sum as a target real-time gradient sum; when the first size relationship indicates that the first real-time gradient sum is less than or equal to the second real-time gradient sum, determining the first real-time gradient sum as the target real-time gradient sum; and determining the maximum real-time gradient sum according to the target real-time gradient sum.
[0045] Wherein, a second size relationship between the target real-time gradient sum and the m-th real-time gradient sum among the n real-time gradient sums is determined, where m is a positive integer greater than 2 and less than n; when the second size relationship indicates that the target real-time gradient sum is greater than the m-th real-time gradient sum, the target real-time gradient sum is not updated; when the second size relationship indicates that the target real-time gradient sum is less than or equal to the m-th real-time gradient sum, the m-th real-time gradient sum is updated to the target real-time gradient sum; a third size relationship between the target real-time gradient sum and the n-th real-time gradient sum among the n real-time gradient sums is determined; when the third size relationship indicates that the target real-time gradient sum is greater than the n-th real-time gradient sum, the target real-time gradient sum is determined as the maximum real-time gradient sum; when the third size relationship indicates that the target real-time gradient sum is less than or equal to the n-th real-time gradient sum, the n-th real-time gradient sum is determined as the maximum real-time gradient sum.
[0046] It is understandable that, as the image acquisition device starts to move, the clarity of the image starts to change, the grayscale value received by each pixel is also changing, and the real-time gradient sum is also changing. Therefore, it is necessary to determine the position where the real-time gradient sum is the largest, and determine the position where the real-time gradient sum is the largest as the focus position.
[0047] The focus position can be determined by a pairwise comparison method, that is, comparing the real-time gradient sums of multiple first pixel points when the image acquisition device moves to the first position and moves to the second position. If the real-time gradient sum corresponding to the first position is greater than the real-time gradient sum corresponding to the second position, the real-time gradient sum corresponding to the first position is determined as the maximum real-time gradient sum; then the real-time gradient sum corresponding to the first position is compared with the real-time gradient sum corresponding to the third position. If the real-time gradient sum corresponding to the first position is less than the real-time gradient sum corresponding to the third position, the real-time gradient sum corresponding to the third position is determined as the maximum real-time gradient sum, and the real-time gradient sum corresponding to the third position is compared with the real-time gradient sum corresponding to the fourth position. And so on, until the maximum real-time gradient sum is compared with the real-time gradient sum corresponding to the last position, and the final maximum real-time gradient sum is determined.
[0048] In order to better understand the process of the above-mentioned method for determining the focus position, the above-mentioned method for determining the focus position is described below in combination with an optional embodiment, but it is not used to limit the technical solution of the embodiment of the present application.
[0049] The optional embodiment of the present application defines a touch screen automatic focusing method based on infrared thermal imaging, which divides the touch screen into multiple areas, analyzes and counts the touch points when the touch screen is operated, and then automatically focuses according to the area with the largest proportion of the statistics. The automatic focus then performs dimensional statistics on the grayscale of all points in this area to drive the electric lens to focus.
[0050] Figure 3 is a flow chart of a touch screen automatic focusing method based on infrared thermal imaging according to an optional embodiment of the present application, such as Figure 3 As shown:
[0051] Step S301, partitioning the touch screen (ie, the screen of the present application).
[0052] The touch screen may be partitioned into 4*4 or 5*5 partitions, and the boundary pixel positions of each area (ie, the second screen partition of the present application) are recorded.
[0053] Step S302, determining an automatic focusing area.
[0054] When a finger touches the screen (i.e. the target operation of this application), each pixel of the touched area (i.e. the target area of this application) is recorded. At this time, the areas in which the pixels are located on the touch screen are counted, and the area with the highest proportion is taken as the area for automatic focusing (i.e. the target screen partition of this application).
[0055] Step S303, calculating the real-time gradient sum of all pixels in the auto-focus area.
[0056] After determining the autofocus area, the radiation grayscale value currently received by each pixel point (i.e., the multiple first pixel points of the present application) in the autofocus area is calculated horizontally (i.e., the horizontal gradient of the present application), vertically (i.e., the vertical gradient of the present application), and diagonal gradient (i.e., the diagonal gradient of the present application), and the diagonal gradient is multiplied by 0.5 times the weighting coefficient (i.e., the preset weighting coefficient of the present application), and then the real-time gradient sum of all points is calculated.
[0057] Step S304, determining the maximum real-time gradient sum.
[0058] When the electric lens (i.e., the image acquisition device of the present application) starts to move, the clarity of the image starts to change, the grayscale value received by each pixel is also changing, and the real-time gradient sum is also changing. At this time, the current gradient sum is compared with the gradient sum calculated at the beginning. If it becomes larger, the current gradient sum replaces the original gradient sum; if it becomes smaller, the original gradient sum remains unchanged.
[0059] Step S305, determining the focus position.
[0060] When the electric lens moves to the position where the gradient and the maximum are located, it is considered to be in focus, and the position where the gradient and the maximum are located is the focus position.
[0061] Through the optional embodiment of the present application, the edge focusing experience is improved. At the same time, the problem in the related art that the automatic focusing cannot focus on the rear target when there is an obstacle in front of the observed target is solved.
[0062] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods of each embodiment of the present application.
[0063] The embodiment of the present application also provides a structural block diagram of a device for determining a focus position. Figure 4 is a structural block diagram of a device for determining a focus position according to an embodiment of the present application; Figure 4 As shown, including:
[0064] A first determining module 42, configured to determine a target screen partition to be focused on among a plurality of screen partitions of the image acquisition device;
[0065] A second determination module 44 is used to determine the real-time gradient sum of multiple first pixel points of the target screen partition during the movement of the image acquisition device, and determine the maximum real-time gradient sum among the multiple real-time gradient sums;
[0066] The third determining module 46 is used to determine the maximum real-time gradient and the corresponding target position of the image acquisition device as the focus position for focusing on the target screen partition.
[0067] Through the above-mentioned device, the target screen partition to be focused on among the multiple screen partitions in the image acquisition device is determined, and in the process of moving the image acquisition device, the real-time gradient sum of the multiple first pixel points of the target screen partition is determined, and the maximum real-time gradient sum is determined among the multiple real-time gradient sums, and the target position in the image acquisition device corresponding to the maximum real-time gradient sum is determined as the position for focusing on the target screen partition. That is to say, after determining the target screen partition to be focused on, the embodiment of the present application can determine the maximum real-time gradient sum of the target screen partition during the movement of the image acquisition device, and determine the focus position according to the maximum real-time gradient sum. This solves the problem that the auto-focus technology in the related art has insufficient focusing accuracy and can only focus on the central area but not other areas. In turn, the focusing accuracy can be improved, and any area of the image acquisition device can be focused.
[0068] In an exemplary embodiment, the first determining device 42 is further used to determine a first screen size of the screen of the image acquisition device; determine a second screen size of the multiple screen partitions to be screen partitioned according to the screen size; and partition the screen according to the second screen size to obtain the multiple screen partitions.
[0069] In an exemplary embodiment, the first determination device 42 is further used to determine a target area corresponding to the target operation when a target operation of a target object is received; determine multiple second pixel points in the target area, and determine a ratio of the number of the multiple second pixel points in each screen partition to the total number of the second pixel points; determine a maximum ratio among multiple ratios; and determine the screen partition corresponding to the maximum ratio as the target screen partition.
[0070] It can be understood that, in the case of receiving the target operation of the target object, the target screen partition can be determined according to the target operation. Specifically: the target operation of the target object can be an operation in which the target object touches the screen of the image acquisition device, and the target screen partition is determined according to the ratio of the number of multiple second pixel points in the target area of the touched screen in each screen partition to the total number of second pixel points. For example: the total number of second pixel points in the target area is 500, the number of second pixel points in the first screen partition is 300, the number of second pixel points in the second screen partition is 100, and the number of second pixel points in the third screen partition is 100. At this time, it can be determined that the ratio corresponding to the first screen partition is 3 / 5, the ratio corresponding to the second screen partition is 1 / 5, and the ratio corresponding to the third screen partition is 1 / 5. At this time, the maximum ratio can be determined to be 3 / 5, that is, the first screen partition can be determined as the target screen partition.
[0071] In an exemplary embodiment, the second determining device 44 is further used to determine multiple first pixel points of the target screen partition; determine the gradient value of each first pixel point at each moving position; and determine the sum of the multiple gradient values as the real-time gradient sum of the multiple first pixel points at each moving position.
[0072] In an exemplary embodiment, the second determination device 44 is also used to obtain the amplitude grayscale value received by each first pixel point at each moving position; calculate the horizontal gradient corresponding to the amplitude grayscale value; and calculate the vertical gradient corresponding to the amplitude grayscale value; and calculate the diagonal gradient corresponding to the amplitude grayscale value; determine the product of the diagonal gradient and a preset weighting coefficient; and determine the gradient value of each first pixel point at each moving position based on the product, the horizontal gradient and the vertical gradient.
[0073] In an exemplary embodiment, the second determining device 44 is further used to determine a first size relationship between a first real-time gradient sum among the n real-time gradient sums and a second real-time gradient sum among the n real-time gradient sums when it is determined that the multiple real-time gradient sums include n real-time gradient sums, wherein n is a positive integer greater than 2; determine the second real-time gradient sum as a target real-time gradient sum when the first size relationship indicates that the first real-time gradient sum is greater than the second real-time gradient sum; determine the first real-time gradient sum as the target real-time gradient sum when the first size relationship indicates that the first real-time gradient sum is less than or equal to the second real-time gradient sum; and determine the maximum real-time gradient sum according to the target real-time gradient sum.
[0074] In an exemplary embodiment, the second determining device 44 is further configured to determine a second size relationship between the target real-time gradient sum and an m-th real-time gradient sum among the n real-time gradient sums, where m is a positive integer greater than 2 and less than n; when the second size relationship indicates that the target real-time gradient sum is greater than the m-th real-time gradient sum, the target real-time gradient sum is not updated; when the second size relationship indicates that the target real-time gradient sum is less than or equal to the m-th real-time gradient sum, the m-th real-time gradient sum is updated to the target real-time gradient sum; determine a third size relationship between the target real-time gradient sum and an n-th real-time gradient sum among the n real-time gradient sums; when the third size relationship indicates that the target real-time gradient sum is greater than the n-th real-time gradient sum, the target real-time gradient sum is determined as the maximum real-time gradient sum; when the third size relationship indicates that the target real-time gradient sum is less than or equal to the n-th real-time gradient sum, the n-th real-time gradient sum is determined as the maximum real-time gradient sum.
[0075] An embodiment of the present application further provides a storage medium, which includes a stored program, wherein the program executes any of the above methods when it is run.
[0076] Optionally, in this embodiment, the storage medium may be configured to store program codes for executing the following steps:
[0077] S1, determining a target screen partition to be focused on among multiple screen partitions of an image acquisition device;
[0078] S2, during the movement of the image acquisition device, determining the real-time gradient sum of multiple first pixel points of the target screen partition, and determining the maximum real-time gradient sum among the multiple real-time gradient sums;
[0079] S3, determining the maximum real-time gradient and the corresponding target position of the image acquisition device as a focus position for focusing on the target screen partition.
[0080] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0081] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0082] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0083] S1, determining a target screen partition to be focused on among multiple screen partitions of an image acquisition device;
[0084] S2, during the movement of the image acquisition device, determining the real-time gradient sum of multiple first pixel points of the target screen partition, and determining the maximum real-time gradient sum among the multiple real-time gradient sums;
[0085] S3, determining the maximum real-time gradient and the corresponding target position of the image acquisition device as a focus position for focusing on the target screen partition.
[0086] An embodiment of the present application further provides a computer program product, including a computer program, which is used by a processor to execute the steps in any of the above method embodiments.
[0087] Optionally, in this embodiment, the computer program product may be executed by a processor to perform the following steps:
[0088] S1, determining a target screen partition to be focused on among multiple screen partitions of an image acquisition device;
[0089] S2, during the movement of the image acquisition device, determining the real-time gradient sum of multiple first pixel points of the target screen partition, and determining the maximum real-time gradient sum among the multiple real-time gradient sums;
[0090] S3, determining the maximum real-time gradient and the corresponding target position of the image acquisition device as a focus position for focusing on the target screen partition.
[0091] Optionally, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store program codes.
[0092] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.
[0093] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.
[0094] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application shall be included in the protection scope of the present application.
Claims
1. A method for determining a focus position, characterized in that: include: Determining a target screen partition to be focused on among a plurality of screen partitions of an image acquisition device; During the movement of the image acquisition device, determining the real-time gradient sum of a plurality of first pixel points of the target screen partition, and determining the maximum real-time gradient sum among the plurality of real-time gradient sums; The maximum real-time gradient and the corresponding target position of the image acquisition device are determined as a focus position for focusing on the target screen partition.
2. The method for determining the focus position according to claim 1, characterized in that: Before determining a target screen partition to be focused on among the multiple screen partitions of the image acquisition device, the method further includes: determining a first screen size of a screen of the image acquisition device; Determining a second screen size of the plurality of screen partitions to be screen partitioned according to the screen size; The screen is partitioned according to the second screen size to obtain the multiple screen partitions.
3. The method for determining a focus position according to claim 1, wherein: Determining a target screen partition to be focused on among a plurality of screen partitions of an image acquisition device includes: In case of receiving a target operation of a target object, determining a target area corresponding to the target operation; Determine a plurality of second pixel points in the target area, and determine a ratio of the number of the plurality of second pixel points in each screen partition to the total number of the second pixel points; determining a maximum ratio among a plurality of ratios; The screen partition corresponding to the maximum ratio is determined as the target screen partition.
4. The method for determining a focus position according to claim 1, wherein: During the movement of the image acquisition device, determining the real-time gradient sum of a plurality of first pixel points of the target screen partition comprises: Determining a plurality of first pixel points of the target screen partition; Determine the gradient value of each first pixel at each moving position; The sum of the multiple gradient values is determined as the real-time gradient sum of the multiple first pixel points at each moving position.
5. The method for determining a focus position according to claim 4, wherein: Determine the gradient value of each first pixel at each moving position, including: Acquire the amplitude grayscale value received by each first pixel at each moving position; Calculating the horizontal gradient corresponding to the amplitude grayscale value; and Calculating the vertical gradient corresponding to the amplitude grayscale value; and Calculating the diagonal gradient corresponding to the amplitude grayscale value; Determining the product of the diagonal gradient and a preset weighting coefficient; The gradient value of each first pixel at each moving position is determined according to the product, the horizontal gradient and the vertical gradient.
6. The method for determining a focus position according to claim 1, wherein: Determine the maximum real-time gradient sum among multiple real-time gradient sums, including: In the case where it is determined that the multiple real-time gradient sums include n real-time gradient sums, determining a first magnitude relationship between a first real-time gradient sum among the n real-time gradient sums and a second real-time gradient sum among the n real-time gradient sums, wherein n is a positive integer greater than 2; When the first size relationship indicates that the first real-time gradient sum is greater than the second real-time gradient sum, the second real-time gradient sum is determined as the target real-time gradient sum; when the first size relationship indicates that the first real-time gradient sum is less than or equal to the second real-time gradient sum, the first real-time gradient sum is determined as the target real-time gradient sum; The maximum real-time gradient sum is determined according to the target real-time gradient sum.
7. The method for determining a focus position according to claim 6, wherein: Determining the maximum real-time gradient sum according to the target real-time gradient sum includes: Determine a second magnitude relationship between the target real-time gradient sum and an m-th real-time gradient sum among the n real-time gradient sums, where m is a positive integer greater than 2 and less than n; When the second magnitude relationship indicates that the target real-time gradient sum is greater than the mth real-time gradient sum, the target real-time gradient sum is not updated; When the second magnitude relationship indicates that the target real-time gradient sum is less than or equal to the m-th real-time gradient sum, updating the m-th real-time gradient sum to the target real-time gradient sum; Determining a third magnitude relationship between the target real-time gradient sum and an nth real-time gradient sum among the n real-time gradient sums; When the third size relationship indicates that the target real-time gradient sum is greater than the n-th real-time gradient sum, the target real-time gradient sum is determined as the maximum real-time gradient sum; when the third size relationship indicates that the target real-time gradient sum is less than or equal to the n-th real-time gradient sum, the n-th real-time gradient sum is determined as the maximum real-time gradient sum.
8. A device for determining a focus position, characterized in that: include: A first determining module, used to determine a target screen partition to be focused on among multiple screen partitions of the image acquisition device; A second determination module is used to determine the real-time gradient sum of multiple first pixel points of the target screen partition during the movement of the image acquisition device, and determine the maximum real-time gradient sum among the multiple real-time gradient sums; The third determining module is used to determine the maximum real-time gradient and the corresponding target position of the image acquisition device as the focus position for focusing on the target screen partition.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein the program executes the method described in any one of claims 1 to 7 when executed.
10. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 7 through the computer program.
