Intelligent gun pressing method and related equipment based on image recognition
By obtaining and comparing the gun and magnifying bitmaps in the game images in the shooting game, calculating the gun pressure value and automatically sliding the screen, the problems of low accuracy and slow recognition in the prior art are solved, and efficient Real-time intelligent gun pressing effect improves shooting accuracy.
Patent Information
- Application Number
- CN202410348114.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-26
- Publication Date
- 2024-12-20
- Estimated Expiration
- 2044-03-26
AI Technical Summary
The existing image recognition algorithms are used in shooting games to adjust the gun accuracy and slow recognition speed, which cannot meet the needs of real-time identification of guns and magnifiers.
By obtaining the gun and magnifying bitmaps in the game image, performing binarization processing and comparing with the preset bitmaps, obtaining the data with the highest pixel overlap ratio as the current gun and magnifying data, and calculate the gun pressure value based on these data , after the user triggers the shooting action, slide down the game screen with the gun press value as the moving distance to achieve the gun press effect.
It realizes efficient and real-time identification of guns and magnification mirrors, and quickly responds to gun cutting and switching magnification mirrors, reducing the difficulty of shooting games and improving shooting accuracy. Users do not need to manually slide the screen to offset gun recoil.
Smart Images

Figure CN118286671B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of game technology, and in particular relates to an intelligent gun pressing method based on image recognition and related equipment. Background Art
[0002] When playing shooting games, each gun and each scope will have different recoil. Therefore, when playing shooting games, the user needs to slide down the screen in real time to suppress the gun, otherwise the gun will float up and miss the target.
[0003] In the related art, there are some methods that use image recognition algorithms to identify the guns and scopes in the game through images on the screen, and adjust the offset distance when pressing the gun according to the recognition results to achieve the purpose of adjusting the crosshairs. However, the image recognition algorithm usually requires a lot of training in advance to obtain the algorithm model, and then the model is stored in the background. When in use, it requires real-time calculation through network requests. For example, an image recognition and image comparison algorithm based on the opencv architecture is used. After testing, the gun pressure adjustment method using the image recognition algorithm not only has a low recognition accuracy, but also the recognition and comparison speed of a single image is more than two seconds, so it cannot meet the needs of real-time recognition of guns and scopes. Summary of the invention
[0004] The present invention aims to provide an intelligent gun pressing method and related equipment based on image recognition, in order to solve the technical problems that the existing image recognition algorithm has low recognition accuracy and slow speed when adjusting the gun pressing.
[0005] In order to solve the aforementioned technical problems, a first aspect of the present invention provides an intelligent gun pressing method based on image recognition, and the intelligent gun pressing method based on image recognition comprises:
[0006] Acquire a current frame of game image, obtain a gun bitmap and a zoom lens bitmap from the game image, perform binarization on the gun bitmap and the zoom lens bitmap, and compare them with a preset gun black-and-white bitmap and a preset zoom lens black-and-white bitmap, and use the gun and zoom lens corresponding to the gun black-and-white bitmap and the zoom lens black-and-white bitmap with the highest pixel overlap ratio as the gun data and the zoom lens data currently used by the user;
[0007] According to the firearm data and the scope data, obtain the currently required gun pressure value;
[0008] After the user triggers the shooting action, the game screen is slid downward with the gun pressing value as the moving distance to achieve the gun pressing effect.
[0009] Optionally, in the aforementioned intelligent gun control method based on image recognition, obtaining a current frame of game image, and obtaining a gun bitmap and a zoom lens bitmap from the game image include:
[0010] Based on the preset screen width, the game image is enlarged and reduced to determine the size of the firearm and the scope in the game image, the distance between the firearm and the top of the image, the distance between the scope and the top of the image, the distance between the firearm and the left side of the image, and the distance between the scope and the left side of the image;
[0011] Locating the positions of the firearm and the scope in the game image according to the distance between the firearm and the top of the image, the distance between the scope and the top of the image, the distance between the firearm and the left side of the image, and the distance between the scope and the left side of the image;
[0012] According to the size and position of the firearm and the scope in the game image, a firearm bitmap and a scope bitmap in the game image are obtained.
[0013] Optionally, in the intelligent gun control method based on image recognition as described above, when obtaining the gun bitmap and the scope bitmap in the game image according to the size and position of the gun and the scope in the game image, by adopting the createBitmap method of Bitmap, matrix data with the size and position data of the gun is passed in to obtain the gun bitmap, and matrix data with the size and position data of the scope is passed in to obtain the scope bitmap.
[0014] Optionally, in the aforementioned intelligent gun pressing method based on image recognition, after the gun bitmap and the zoom lens bitmap are binarized and before they are compared with a preset gun black and white bitmap and zoom lens black and white bitmap, the following steps are included:
[0015] After the gun bitmap and the zoom bitmap are binarized, they are compared with the preset HSV values respectively. If a pixel in the gun bitmap or the zoom bitmap is in the white value range, the pixel value is the pixel value corresponding to white, and the remaining pixels are the pixel values corresponding to black, so that the gun bitmap and the zoom bitmap are black and white bitmaps.
[0016] Optionally, in the aforementioned intelligent gun pressing method based on image recognition, before comparing with the preset black-and-white bitmap of the firearm and the black-and-white bitmap of the zoom lens, it also includes base map training of the black-and-white bitmap of the firearm and the black-and-white bitmap of the zoom lens:
[0017] Collect and binarize the images of guns and scopes on terminals with different resolutions to obtain a base map dataset;
[0018] Perform pixel comparison on the same firearm or scope with different resolutions, continue to represent common pixels with pixel values corresponding to white or black, and represent different pixels with transparent values, to obtain a black and white bitmap of the firearm or scope;
[0019] After the gun bitmap and the zoom lens bitmap are binarized, when they are compared with the preset gun black and white bitmap and the zoom lens black and white bitmap, only the pixels where the black dots and the white dots are located are compared.
[0020] Optionally, in the aforementioned intelligent gun control method based on image recognition, the gun and zoom lens images in different game scenes are collected and binarized before being put into the base map data set;
[0021] Perform pixel comparison on the same firearm or scope in different game scenes, continue to represent common pixels with pixel values corresponding to white or black, and represent different pixels with transparent values, to obtain a black and white bitmap of the firearm or scope.
[0022] Optionally, in the aforementioned intelligent gun pressing method based on image recognition, before comparing with the preset black-and-white bitmap of the firearm and the black-and-white bitmap of the zoom lens, it also includes base map training of the black-and-white bitmap of the firearm and the black-and-white bitmap of the zoom lens:
[0023] Collect and binarize images of guns and zoom lenses in different game scenarios from terminals with different resolutions to obtain a base map dataset.
[0024] Compare pixels of the same firearm or scope at different resolutions and in different game scenes, continue to represent common pixels with pixel values corresponding to white or black, and represent different pixels with transparent values, to obtain a black and white bitmap of the firearm or scope;
[0025] After the gun bitmap and the zoom lens bitmap are binarized, when they are compared with the preset gun black and white bitmap and the zoom lens black and white bitmap, only the pixels where the black dots and the white dots are located are compared.
[0026] Optionally, in the aforementioned intelligent gun pressing method based on image recognition, after the user triggers the shooting action, the game screen is slid downward with the gun pressing value as the moving distance to achieve the gun pressing effect, including:
[0027] After the user triggers the shooting action, the gun-control effect is achieved by injecting a move event, wherein the sliding distance of each frame of the move event is the gun-control value.
[0028] In order to solve the aforementioned technical problems, the second aspect of the present invention provides an intelligent gun pressing device based on image recognition, and the intelligent gun pressing device based on image recognition comprises:
[0029] An image processing module is used to obtain a current frame of game image, obtain a gun bitmap and a zoom lens bitmap from the game image, perform binarization on the gun bitmap and the zoom lens bitmap, and compare them with a preset gun black-and-white bitmap and zoom lens black-and-white bitmap, and use the gun and zoom lens corresponding to the gun black-and-white bitmap and the zoom lens black-and-white bitmap with the highest pixel overlap ratio as the gun data and the zoom lens data currently used by the user;
[0030] A gun pressure value acquisition module is used to acquire the currently required gun pressure value according to the firearm data and the scope data;
[0031] The trigger gun pressure effect module is used to slide the game screen downward with the gun pressure value as the moving distance after the user triggers the shooting action to achieve the gun pressure effect.
[0032] In order to solve the aforementioned technical problems, the third aspect of the present invention provides an electronic product, which includes a memory and a processor, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the processor executes the steps of the above-mentioned intelligent gun pressing method based on image recognition.
[0033] In order to solve the aforementioned technical problem, the fourth aspect of the present invention provides a storage medium storing computer-readable instructions, which, when executed by one or more processors, enables one or more processors to perform the steps of the above-mentioned intelligent gun pressing method based on image recognition.
[0034] The positive and progressive effects of the present invention are:
[0035] 1. The present invention adopts image recognition technology, through precise positioning and binarization of firearms and scopes. Although it is relatively complicated during base map training, during actual graphic recognition and comparison, pixels are compared through multiple cycles, which can achieve the effect of efficient and real-time recognition of firearms and scopes, and can immediately respond after switching guns and / or scopes, and change the gun pressure value, thereby achieving the purpose of intelligent gun pressure.
[0036] 2. The image recognition technology used in the present invention is faster and more efficient than the image recognition of OpenCV and the like on the market, and can achieve the effect of accurate and intelligent gun control immediately after the user switches the gun.
[0037] 3. The present invention determines the gun pressure value through the two dimensions of the gun and the zoom lens, which reduces the difficulty of the shooting game and improves the shooting accuracy. The user does not need to slide the screen to press the gun to offset the recoil of the gun. The image recognition and intelligent gun pressure algorithm of the present invention can automatically help the user to offset the recoil of the gun and improve the shooting accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] The disclosure of the present invention will become more apparent with reference to the accompanying drawings. It should be understood that these drawings are only for illustrative purposes and are not intended to limit the scope of protection of the present invention. In the drawings:
[0039] Figure 1 A method flow chart of the present invention;
[0040] Figure 2 The present invention is an application flow chart. DETAILED DESCRIPTION
[0041] The following describes the embodiments of the present invention through specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention.
[0042] It should be noted that the following embodiments and features therein may be combined with each other if there is no conflict.
[0043] In the description of the present invention, it should be noted that directional words such as the terms "outside", "middle", "inside", "outside", etc., which indicate directions and positional relationships, are based on the directions or positional relationships shown in the drawings. They are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific direction, be constructed and operated in a specific direction, and cannot be understood as limiting the specific protection scope of the present invention.
[0044] In addition, the terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features. Therefore, the definition of "first" and "second" features can explicitly or implicitly include one or more of the features. In the description of the present invention, "several" and "a number" mean two or more, unless otherwise clearly and specifically defined.
[0045] Reference Figure 1 The embodiment of the present invention provides an intelligent gun pressing method based on image recognition. The intelligent gun pressing method is used to solve the recoil problem when the user shoots during the game. The intelligent gun pressing method includes the following steps:
[0046] S1, image processing: obtain the current frame of the game image, obtain the gun bitmap and the zoom lens bitmap from the game image, perform binarization on the gun bitmap and the zoom lens bitmap, and compare them with the preset gun black-and-white bitmap and the zoom lens black-and-white bitmap, and use the gun and the zoom lens corresponding to the gun black-and-white bitmap and the zoom lens black-and-white bitmap with the highest pixel overlap ratio as the gun data and the zoom lens data currently used by the user.
[0047] The game image in this step is the game screen of each frame during the game process of the user. By processing and identifying each frame of the game image, the firearm and zoom lens actually used by the user can be obtained.
[0048] Specifically, you can apply for screen recording permission through the application to obtain every frame of the game screen.
[0049] This step uses an image recognition algorithm different from the prior art when performing image recognition. That is, a pixel-by-pixel comparison method is used to compare the binary processed gun bitmap and zoom lens bitmap with the preset gun black and white bitmap and zoom lens black and white bitmap. Figure 1 The pixels are compared one by one, and finally the pixel overlap ratio is calculated and statistically analyzed. The one with the highest ratio is identified as this firearm or scope.
[0050] This step can achieve efficient image recognition by accurately positioning the gun and the scope, binarizing it, and comparing pixels in multiple cycles. For example, when comparing 40 guns, the current gun can be accurately matched within 100ms.
[0051] In some embodiments, in step S1, a current frame of a game image is obtained, and a gun bitmap and a zoom lens bitmap are obtained from the game image, including:
[0052] S101, based on the preset screen width, the game image is enlarged and reduced to determine the size of the gun and the scope in the game image, the distance between the gun and the top of the image, the distance between the scope and the top of the image, the distance between the gun and the left side of the image, and the distance between the scope and the left side of the image.
[0053] Usually, the display positions of guns and scopes in the game screen are fixed, for example, the gun is displayed in the center and at the bottom of the screen. However, the resolution and screen width ratio of the display interface of each terminal may be different, and the normal screen width can be considered to be 1080P wide, which can be used as the preset screen width. Therefore, this step can be based on different resolutions, according to the width ratio of the screen, with 1080P width as the benchmark, to perform zooming in and out processing, and calculate the specific size of the gun and scope, the distance between the gun and scope and the top of the screen, and the distance between the gun and scope and the left side of the screen.
[0054] S102, locating the positions of the gun and the scope in the game image according to the distance between the gun and the top of the image, the distance between the scope and the top of the image, the distance between the gun and the left side of the image, and the distance between the scope and the left side of the image.
[0055] S103, obtaining a gun bitmap and a zoom scope bitmap in the game image according to the size and position of the gun and the zoom scope in the game image.
[0056] In this step, when obtaining the gun bitmap and the zoom lens bitmap, the following method is preferably used:
[0057] By using the createBitmap method of Bitmap, the matrix data with the size and position data of the gun is passed in to obtain the gun bitmap, and the matrix data with the size and position data of the scope is passed in to obtain the scope bitmap.
[0058] It can be seen that the gun bitmap only contains guns, not scopes. The scope bitmap only contains scopes, not guns, and the two are obtained independently.
[0059] In some embodiments, in step S1, after the gun bitmap and the zoom lens bitmap are binarized and before they are compared with the preset gun black and white bitmap and the zoom lens black and white bitmap, the following steps are included:
[0060] After the gun bitmap and the scope bitmap are binarized, they are compared with the preset HSV values respectively. If a pixel in the gun bitmap or the scope bitmap is in the white value range, the pixel value is the pixel value corresponding to white, and the remaining pixels are the pixel values corresponding to black, so that the gun bitmap and the scope bitmap are black and white bitmaps.
[0061] Among them, the pixel value corresponding to white can be expressed as #FFFFFF, and the pixel value corresponding to black can be expressed as #000000.
[0062] HSV value is a way to represent color, which consists of three elements: hue, saturation, and value. All three elements have a color component value range, for example: hue H is measured in angles, with a value range of 0°~360°; saturation S has a value range of 0~1; and brightness V has a value range of 0~1. In some applications, such as opencv, it is processed, and the hue H value range is 0°~180°; the saturation S value range is 0~255; and the brightness V value range is 0~255. Therefore, in different applications, the value ranges of the three elements may be different.
[0063] Before performing image recognition, this embodiment pre-sets the HSV value, and in particular, pre-limits the white value range. If a pixel in the gun bitmap or the zoom lens bitmap is within the preset white value range, the pixel directly takes the pixel value corresponding to white. After each pixel is compared, the remaining pixels that are not within the white value range take the pixel values corresponding to black, thereby obtaining a gun bitmap with only pure black and pure white and a zoom lens bitmap with only pure black and pure white.
[0064] In some embodiments, in step S1, before comparing with the preset black-and-white bitmap of the firearm and the black-and-white bitmap of the zoom lens, step S0 is also included: performing base image training on the black-and-white bitmap of the firearm and the black-and-white bitmap of the zoom lens:
[0065] S001, collect and binarize images of guns and scopes on terminals with different resolutions to obtain a base map dataset.
[0066] In this step, a set of firearm and zoom images are collected for each terminal of each resolution on the market as much as possible, and then binarized to obtain a base map dataset.
[0067] S002, performing pixel comparison on the same firearm or scope with different resolutions, continuing to represent common pixels with pixel values corresponding to white or black, and representing different pixels with transparent values, to obtain a black and white bitmap of the firearm or scope.
[0068] This step merges the same gun at all resolutions to find the common pixels and different pixels. The common pixels are represented by normal black (#000000) and white (#FFFFFF), and the different pixels are represented by transparent values (such as -1 or #00000000). Then, a gun bitmap with the same common pixels can be obtained.
[0069] This step merges the same zoom lens of all resolutions to find the common pixels and different pixels. The common pixels are represented by normal black (#000000) and white (#FFFFFF), and the different pixels are represented by transparent values (such as -1 or #00000000). Then you can get a zoom lens bitmap with the same common pixels.
[0070] With the above design, in step S1, after the gun bitmap and the zoom lens bitmap are binarized, when they are compared with the preset gun black and white bitmap and the zoom lens black and white bitmap, only the pixels where the black and white dots are located are compared, and the transparent dots (-1 or #00000000) are skipped and not compared, so that it can be adapted to terminals with most resolutions.
[0071] In some embodiments, the base map data set in step S001 can be regularly increased. When a terminal of a certain resolution that has not been collected appears on the market, the firearms and zoom lens images can be collected and binarized to enrich the base map database, and step S002 can be performed to update each firearm bitmap and zoom lens bitmap.
[0072] In some embodiments, in this embodiment, in addition to collecting situations with different resolutions, step S0 also includes the following steps:
[0073] S003, collect and binarize the images of guns and zoom lenses in different game scenes, and put them into the base map data set.
[0074] S004, similar to step S002, performs pixel comparison on the same firearm or scope in different game scenes, continues to represent common pixels with pixel values corresponding to white or pixel values corresponding to black, and represents different pixels with transparent values, to obtain a black and white bitmap of the firearm or scope.
[0075] With the above design, the black and white bitmap of the gun and the black and white bitmap of the zoom lens can be adapted to the images in different game scenarios.
[0076] Of course, the order of the above step S001 and step S003 can be interchanged, that is, step S003 and step S004 can be performed first, and then step S001 and step S002.
[0077] In some embodiments, in step S1, before comparing with the preset black-and-white bitmap of the firearm and the black-and-white bitmap of the zoom lens, step S0 is also included: performing base image training on the black-and-white bitmap of the firearm and the black-and-white bitmap of the zoom lens:
[0078] S011, collect and binarize images of guns and zoom lenses of terminals with different resolutions in different game scenes to obtain a base map data set.
[0079] This step is different from S001, that is, this step collects a set of gun and zoom images in various game scenes for each terminal of each resolution on the market as much as possible.
[0080] S012, performing pixel comparison on the same firearm or scope under different resolutions and different game scenes, continuing to represent common pixels with pixel values corresponding to white or pixel values corresponding to black, and representing different pixels with transparent values, to obtain a black and white bitmap of the firearm or scope.
[0081] With the above design, in step S1, after the gun bitmap and the zoom lens bitmap are binarized, when they are compared with the preset gun black and white bitmap and the zoom lens black and white bitmap, only the pixels where the black and white dots are located are compared, and the transparent dots (such as -1 or #00000000) are skipped and not compared.
[0082] This embodiment obtains several base images of the same firearm or scope in two dimensions of resolution and game scene for pixel comparison. This can adapt to terminals of most resolutions and images in different scenes. In addition, fewer base images are used for comparison in step S1, which greatly reduces the comparison time and improves the comparison efficiency.
[0083] S2, obtain the gun pressure value: according to the gun data and the scope data, obtain the currently required gun pressure value.
[0084] Different gun and scope combinations will produce different recoil. Therefore, before this step, a gun pressure value mapping table can be pre-stored, and each unit in the gun pressure value mapping table is the gun pressure value corresponding to each gun and scope combination. The gun pressure value is pre-determined and is obtained through actual testing. Of course, the user can also adjust it by himself.
[0085] S3, triggering the gun suppression effect: after the user triggers the shooting action, slide the game screen downward with the gun suppression value as the moving distance to achieve the gun suppression effect.
[0086] This step is not triggered when the user does not shoot. Only after the user shoots, that is, after the shooting action is triggered, the user is automatically helped to slide the screen downward, so the effect of intelligent gun suppression is achieved to offset the upward drift problem caused by the recoil of the gun.
[0087] In some embodiments, in step S3, after the user triggers the shooting action, a move (slide) event is injected through an application (APP) to achieve a gun-pressing effect, wherein the sliding distance of each frame of the move event is the gun-pressing value.
[0088] In some embodiments, the terminal is a mobile phone, and the mobile phone has a built-in shooting game APP, then refer to Figure 2 , an intelligent gun pressing method, the method is applied to the terminal, comprising:
[0089] 1. Apply for screen recording permission from the user through the APP.
[0090] 2. Get the current frame of the game image.
[0091] 3. Based on the 1080P screen width, the game image is enlarged and reduced to determine the specific size of the gun and the scope, the distance between the gun and the scope and the top of the screen, and the distance between the gun and the scope and the left side of the screen, so as to locate the specific position of the gun and the scope;
[0092] By passing in the matrix data through the createBitmap method of Bitmap, you can get a gun bitmap with only the gun or a scope bitmap with only the scope.
[0093] 4. Binarize the gun bitmap and the zoom lens bitmap, and process them into gun bitmaps and zoom lens bitmaps with only pure black and pure white.
[0094] 5. Read all the black and white bitmaps of firearms and zoom lenses that have been trained in advance.
[0095] 6. Perform pixel comparison on the gun bitmap and all gun black and white bitmaps one by one, and obtain the gun with the highest matching degree as the gun that the current user can use;
[0096] The zoom lens bitmap is compared with all zoom lens black and white bitmaps one by one, and the zoom lens with the highest matching degree is obtained as the practical zoom lens for the current user.
[0097] 7. According to the current firearm and scope, obtain the corresponding gun pressure value from the database.
[0098] 8. When the user shoots, the move event is automatically injected through the APP. The sliding distance of each frame of the move event is the gun pressure value.
[0099] The embodiment of the present invention further provides an intelligent gun suppressing device based on image recognition, and the intelligent gun suppressing device based on image recognition includes:
[0100] An image processing module is used to obtain a current frame of game image, obtain a gun bitmap and a zoom lens bitmap from the game image, perform binarization on the gun bitmap and the zoom lens bitmap, and compare them with a preset gun black-and-white bitmap and zoom lens black-and-white bitmap, and use the gun and zoom lens corresponding to the gun black-and-white bitmap and the zoom lens black-and-white bitmap with the highest pixel overlap ratio as the gun data and zoom lens data currently used by the user;
[0101] The module for obtaining the gun pressure value is used to obtain the currently required gun pressure value according to the gun data and the scope data;
[0102] The trigger gun suppression effect module is used to slide the game screen downward with the gun suppression value as the moving distance after the user triggers the shooting action to achieve the gun suppression effect.
[0103] An embodiment of the present invention further provides an electronic product, which includes a memory and a processor. The memory stores computer-readable instructions. When the computer-readable instructions are executed by the processor, the processor executes the steps of the intelligent gun pressing method based on image recognition in the above-mentioned embodiments.
[0104] An embodiment of the present invention further provides a storage medium storing computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the intelligent gun pressing method based on image recognition in the above-mentioned embodiments.
[0105] The present invention is described in detail above in conjunction with the embodiments of the accompanying drawings. A person skilled in the art can make various variations of the present invention according to the above description. Therefore, some details in the embodiments should not be construed as limiting the present invention, and the present invention shall be protected by the scope defined by the attached claims.
Claims
1. An intelligent gun pressing method based on image recognition, characterized in that: The intelligent gun pressing method based on image recognition includes: Get a current frame of game image, get a gun bitmap and a scope bitmap from the game image, perform binarization on the gun bitmap and the scope bitmap, and compare them with preset HSV values respectively. If a pixel in the gun bitmap or the scope bitmap is in the white value range, the pixel value is the pixel value corresponding to white, and the remaining pixels are the pixel values corresponding to black, so that the gun bitmap and the scope bitmap are obtained as black-and-white bitmaps. Compare the gun bitmap and the scope bitmap with the preset gun black-and-white bitmap and the scope black-and-white bitmap, and use the gun and scope corresponding to the gun black-and-white bitmap and the scope black-and-white bitmap with the highest pixel overlap ratio as the gun data and scope data currently used by the user; According to the firearm data and the scope data, obtain the currently required gun pressure value; After the user triggers the shooting action, the game screen is slid downwards with the gun pressing value as the moving distance to achieve the gun pressing effect; Before comparing with the preset black and white bitmap of the gun and the black and white bitmap of the zoom lens, the base map training of the black and white bitmap of the gun and the black and white bitmap of the zoom lens is also included: Collect and binarize the images of guns and zoom lenses in at least one of two situations on terminals with different resolutions and in different game scenarios to obtain a base map dataset; Perform pixel comparison for the same firearm or scope in at least one of the two situations of different resolutions and different game scenes, continue to represent common pixels with pixel values corresponding to white or pixel values corresponding to black, and represent different pixels with transparent values, to obtain a black and white bitmap of the firearm or scope; After the gun bitmap and the zoom lens bitmap are binarized, when they are compared with the preset gun black and white bitmap and the zoom lens black and white bitmap, only the pixels where the black dots and the white dots are located are compared.
2. The intelligent gun pressing method based on image recognition according to claim 1, characterized in that: Get the current frame of the game image, and get the gun bitmap and the zoom lens bitmap from the game image, including: Based on the preset screen width, the game image is enlarged and reduced to determine the size of the firearm and the scope in the game image, the distance between the firearm and the top of the image, the distance between the scope and the top of the image, the distance between the firearm and the left side of the image, and the distance between the scope and the left side of the image; Locating the positions of the firearm and the scope in the game image according to the distance between the firearm and the top of the image, the distance between the scope and the top of the image, the distance between the firearm and the left side of the image, and the distance between the scope and the left side of the image; According to the size and position of the firearm and the scope in the game image, a firearm bitmap and a scope bitmap in the game image are obtained.
3. The intelligent gun pressing method based on image recognition as claimed in claim 2, characterized in that: When obtaining the gun bitmap and scope bitmap in the game image according to the size and position of the gun and scope in the game image, the createBitmap method of Bitmap is adopted, and the matrix data with the size and position data of the gun is passed in to obtain the gun bitmap, and the matrix data with the size and position data of the scope is passed in to obtain the scope bitmap.
4. The intelligent gun pressing method based on image recognition according to claim 1, characterized in that: After the user triggers the shooting action, the game screen is slid downward with the gun pressing value as the moving distance to achieve the gun pressing effect, including: After the user triggers the shooting action, the gun-control effect is achieved by injecting a move event, wherein the sliding distance of each frame of the move event is the gun-control value.
5. An intelligent gun pressing device based on image recognition, characterized in that: The intelligent gun pressing device based on image recognition includes: An image processing module is used to obtain a current frame of game image, obtain a gun bitmap and a zoom lens bitmap from the game image, perform binarization on the gun bitmap and the zoom lens bitmap, and then compare them with preset HSV values respectively; if a pixel in the gun bitmap or the zoom lens bitmap is in the white value range, the pixel value is the pixel value corresponding to white, and the remaining pixels are the pixel values corresponding to black, so that the gun bitmap and the zoom lens bitmap are obtained as black-and-white bitmaps, and the gun bitmap and the zoom lens bitmap are compared with preset gun black-and-white bitmaps and zoom lens black-and-white bitmaps, and the gun and the zoom lens corresponding to the gun black-and-white bitmap and the zoom lens black-and-white bitmap with the highest pixel overlap ratio are used as the gun data and the zoom lens data currently used by the user; The base map training module is used to collect and binarize the images of guns and scopes on terminals with different resolutions and in at least one of the two situations in different game scenarios to obtain a base map data set; perform pixel comparison on the same gun or scope in at least one of the two situations in different resolutions and different game scenarios, continue to represent common pixels with pixel values corresponding to white or pixel values corresponding to black, and represent different pixels with transparent values to obtain a black and white bitmap of the gun or scope; A gun pressure value acquisition module is used to acquire the currently required gun pressure value according to the firearm data and the scope data; The trigger gun pressure effect module is used to slide the game screen downward with the gun pressure value as the moving distance after the user triggers the shooting action to achieve the gun pressure effect.
6. An electronic product, comprising a memory and a processor, wherein the memory stores computer-readable instructions, characterized in that: When the computer-readable instructions are executed by the processor, the processor executes the steps of the intelligent gun pressing method based on image recognition as described in any one of claims 1 to 4.
7. A storage medium storing computer-readable instructions, characterized in that: When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the intelligent gun pressing method based on image recognition as described in any one of claims 1 to 4.
