A vibration control method, device, chip, and medium for a motor.
By identifying gun types in shooting games and generating corresponding motor vibration control information, the problem of a single motor vibration mode is solved, enabling specific vibration feedback based on gun type and improving the user's gaming experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHANGHAI AWINIC TECH CO LTD
- Filing Date
- 2021-06-30
- Publication Date
- 2026-05-05
AI Technical Summary
In existing shooting games, the vibration mode of the motor is monotonous, making it difficult to provide specific vibration sensations for different gun types, resulting in a poor user gaming experience.
By acquiring gun display images from target game images, performing image processing to identify gun types, and generating motor vibration control information based on the identification results, vibration control for specific gun types can be achieved.
It enhances the user's gaming experience by accurately identifying gun types and providing specific vibration feedback, thereby improving the multi-dimensional feedback effect of the game.
Smart Images

Figure CN115531861B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of control, specifically to a vibration control method, device, chip, and medium for a motor. Background Technology
[0002] Shooting games are games where users control a character to move and shoot, competing against other users. During gameplay, the device plays corresponding sound effects as the game progresses. For example, a gunshot sound might be played when the user fires a shot, enhancing the user's gaming experience. Furthermore, the device can control motor vibration while playing sound through its speakers, providing users with multi-dimensional game feedback through vibration.
[0003] Currently, the vibration patterns of motors in games are relatively uniform. Different gun models used by users in the game exhibit the same or similar vibration patterns when firing, making it difficult for users to experience specific vibration sensations based on the particular gun model, resulting in a poor gaming experience. Summary of the Invention
[0004] In view of this, embodiments of this application provide a vibration control method, device, chip, and medium for a motor, which can control the motor to vibrate according to the vibration mode corresponding to a specific gun type, thereby improving the user experience.
[0005] To address the above problems, the technical solutions provided in this application are as follows:
[0006] In a first aspect, this application provides a vibration control method for a motor, the method comprising:
[0007] A gun-shaped display image is obtained from the target game image, and the gun-shaped display image is processed to obtain the gun-shaped image to be identified.
[0008] The target gun type corresponding to the displayed gun type image is determined using the image of the gun type to be identified;
[0009] Based on preset vibration information corresponding to the target gun type, motor vibration control information is generated, which is used to control motor vibration.
[0010] In one possible implementation, the image of the gun to be identified consists of black pixels and white pixels;
[0011] The step of determining the target gun type corresponding to the gun type display image using the gun type image to be identified includes: sequentially obtaining the number of target color pixels in each pixel region of the gun type image to be identified, and obtaining a number sequence; the pixel region is a pixel row or a pixel column; the target color pixels are white pixels or black pixels;
[0012] Based on the number sequence, a target sequence is selected from a preset sequence; the preset sequence is a sequence composed of the number of target color pixels in each pixel region of a standard gun image corresponding to a preset gun type;
[0013] The preset gun type corresponding to the target sequence is taken as the target gun type.
[0014] In one possible implementation, before selecting the target sequence from the preset sequence according to the number sequence, the method further includes:
[0015] If the image size of the standard gun image is different from the image size of the gun image to be identified, the number sequence or the preset sequence is processed to be of equal length.
[0016] In one possible implementation, if the image size of the standard gun image is different from the image size of the gun image to be identified, the step of performing equal-length processing on the number sequence or the preset sequence includes:
[0017] If the image size of the standard gun image is larger than the image size of the gun image to be identified, the preset sequence is adjusted to obtain an updated preset sequence;
[0018] If the image size of the gun type image to be identified is larger than the image size of the standard gun type image, the count sequence is adjusted to obtain an updated count sequence.
[0019] In one possible implementation, adjusting the preset sequence to obtain an updated preset sequence includes:
[0020] The first step length and the first ratio are determined based on the image size of the standard gun image and the image size of the gun image to be identified.
[0021] Based on the first step length, a first target pixel region is determined in the standard gun-shaped image;
[0022] Obtain the number of target color pixels in the first target pixel region, and use it as the first pixel count;
[0023] The updated preset sequence is obtained based on the first number of pixels and the first ratio.
[0024] In one possible implementation, adjusting the count sequence to obtain the updated count sequence includes:
[0025] The second step size and the second ratio are determined based on the image size of the standard gun image and the image size of the gun image to be identified.
[0026] Based on the second step length, a second target pixel region is determined in the image of the gun type to be identified;
[0027] Obtain the number of target color pixels in the second target pixel region, and use it as the number of second pixels;
[0028] The updated number sequence is obtained based on the second number of pixels and the second ratio.
[0029] In one possible implementation, selecting the target sequence from the preset sequence based on the number sequence includes:
[0030] The preset sequence with the smallest difference from the number sequence or the ratio closest to 1 is taken as the target sequence.
[0031] In one possible implementation, prior to obtaining the gun-shaped display image from the target game image, the method further includes:
[0032] If the image acquisition conditions are met, the game image to be processed is acquired at a preset time interval, and the gun-shaped display mark is identified in the game image to be processed.
[0033] If the game image to be processed contains a gun-shaped display icon, then the game image to be processed is used as the target game image.
[0034] In one possible implementation, before sequentially obtaining the number of target color pixels in each pixel region of the image of the gun type to be identified and obtaining the number sequence, the method further includes:
[0035] Obtain the image size of the gun image to be identified, and determine the digital region based on the image size of the gun image to be identified;
[0036] The color of the pixels in the digital area is set as the background color to obtain the updated image of the gun to be identified.
[0037] Secondly, this application provides a vibration control device for a motor, the device comprising:
[0038] The first acquisition unit is used to acquire a gun-shaped display image from a target game image, and to perform image processing on the gun-shaped display image to obtain a gun-shaped image to be identified.
[0039] The first determining unit is used to determine the target gun type corresponding to the gun type display image using the gun type image to be identified;
[0040] The generation unit is used to generate motor vibration control information based on preset vibration information corresponding to the target gun type, and the motor vibration control information is used to control motor vibration.
[0041] In one possible implementation, the image of the gun to be identified consists of black pixels and white pixels;
[0042] The first determining unit includes:
[0043] The first acquisition subunit is used to sequentially acquire the number of target color pixels in each pixel region of the gun image to be identified, and obtain a sequence of counts; the pixel region is a pixel row or a pixel column; the target color pixels are white pixels or black pixels;
[0044] A selection subunit is used to select a target sequence from a preset sequence based on the number sequence; the preset sequence is a sequence composed of the number of target color pixels in each pixel region of a standard gun image corresponding to a preset gun type;
[0045] A subunit is defined to identify the preset gun type corresponding to the target sequence as the target gun type.
[0046] In one possible implementation, the device further includes:
[0047] An adjustment unit is used to perform equal-length processing on the number sequence or the preset sequence if the image size of the standard gun image is different from the image size of the gun image to be identified.
[0048] In one possible implementation, the adjustment unit includes:
[0049] The first adjustment subunit is used to adjust the preset sequence if the image size of the standard gun image is larger than the image size of the gun image to be identified, so as to obtain an updated preset sequence.
[0050] The second adjustment subunit is used to adjust the number sequence if the image size of the gun image to be identified is larger than the image size of the standard gun image, so as to obtain an updated number sequence.
[0051] In one possible implementation, the first adjustment subunit is specifically used to determine the first step length and the first ratio based on the image size of the standard gun image and the image size of the gun image to be identified;
[0052] Based on the first step length, a first target pixel region is determined in the standard gun-shaped image;
[0053] Obtain the number of target color pixels in the first target pixel region, and use it as the first pixel count;
[0054] The updated preset sequence is obtained based on the first number of pixels and the first ratio.
[0055] In one possible implementation, the second adjustment subunit is specifically used to determine a second step size and a second ratio based on the image size of the standard gun image and the image size of the gun image to be identified;
[0056] Based on the second step length, a second target pixel region is determined in the image of the gun type to be identified;
[0057] Obtain the number of target color pixels in the second target pixel region, and use it as the number of second pixels;
[0058] The updated number sequence is obtained based on the second number of pixels and the second ratio.
[0059] In one possible implementation, the selection of sub-units is specifically used to select a preset sequence that has the smallest difference from the number sequence or whose ratio is closest to 1 as the target sequence.
[0060] In one possible implementation, the device further includes:
[0061] The second acquisition unit is used to acquire the game image to be processed at a preset time interval if the image acquisition conditions are met, and to identify the gun-shaped display mark on the game image to be processed.
[0062] The second determining unit is used to determine the game image to be processed as the target game image if the game image to be processed contains a gun-shaped display icon.
[0063] In one possible implementation, the device further includes:
[0064] The third acquisition unit is used to acquire the image size of the gun image to be identified, and to determine the digital region based on the image size of the gun image to be identified.
[0065] The update unit is used to set the color of the pixels in the digital area to the background color to obtain an updated image of the gun to be identified.
[0066] Thirdly, this application provides a vibration control chip for a motor, comprising: a processor and a memory;
[0067] The memory is used to store computer execution instructions; when executed by the processor, the instructions cause the processor to perform the method described in any of the above embodiments.
[0068] Fourthly, this application provides a computer-readable storage medium storing instructions that, when executed on a terminal device, cause the terminal device to perform the method described in any of the above embodiments.
[0069] Therefore, the embodiments of this application have the following beneficial effects:
[0070] This application provides a method, apparatus, chip, and medium for controlling motor vibration. First, a gun model display image is acquired from a target game image and processed to obtain a gun model image to be identified. The target gun model corresponding to the gun model display image is then determined based on the gun model image to be identified. This allows for a relatively accurate determination of the target gun model used by the user in the current game. Then, using preset vibration information corresponding to the target gun model, motor vibration control information is generated to control the motor vibration, enabling the generation of specific vibration sensations for specific gun models by controlling the motor, thereby enhancing the user's gaming experience. Attached Figure Description
[0071] Figure 1 A schematic diagram of a scenario for the vibration control method of a motor provided in an embodiment of this application;
[0072] Figure 2 A flowchart illustrating a vibration control method for a motor provided in an embodiment of this application;
[0073] Figure 3 A schematic diagram of a target game image provided in an embodiment of this application;
[0074] Figure 4 A schematic diagram of a gun-shaped display image provided in an embodiment of this application;
[0075] Figure 5 A schematic diagram of a gun type image to be identified, provided as an embodiment of this application;
[0076] Figure 6 A schematic diagram of a preset sequence provided in an embodiment of this application;
[0077] Figure 7 This is a schematic diagram of the structure of a vibration control device for a motor provided in an embodiment of this application. Detailed Implementation
[0078] To facilitate understanding and explanation of the technical solutions provided in the embodiments of this application, the background technology of this application will be described first.
[0079] After researching the vibration of traditional shooting game terminals, the inventors discovered that when users shoot different types of firearms, the terminal plays the corresponding gunshot sound and vibrates to simulate the sound effects and feel of real shooting. However, the terminal's motor has limited vibration modes and cannot produce specific vibrations for particular firearm types, making it impossible for users to identify the type of firearm using vibration. Furthermore, a single vibration mode can easily lead to user fatigue, reducing the user experience.
[0080] Based on this, embodiments of this application provide a vibration control method, device, chip, and medium for a motor. First, a gun model display image is obtained from a target game image, and this image is processed to obtain a gun model image to be identified. The target gun model corresponding to the gun model display image is then determined based on the gun model image to be identified. This allows for a relatively accurate determination of the target gun model used by the user in the current game. Then, using preset vibration information corresponding to the target gun model, motor vibration control information is generated to control the motor vibration, enabling the generation of specific vibration sensations for specific gun models by controlling the motor, thereby enhancing the user's gaming experience.
[0081] To facilitate understanding of the motor vibration control method provided in the embodiments of this application, the following is combined with... Figure 1 The scenario example shown is used for illustration. The vibration control method for the motor provided in this embodiment can be applied to terminal 101.
[0082] like Figure 1 As shown in the figure, this figure is a schematic diagram of a scenario for a motor vibration control method provided in an embodiment of this application.
[0083] In practical applications, when playing shooting games on terminal 101, a screenshot of the game image displayed on terminal 101 is taken to determine the target game image. The gun display image is then obtained from the captured target game image. Different gun display images correspond to specific gun types. Image processing is performed on the obtained gun display image to obtain the gun type image to be identified. The corresponding target gun type is then determined based on the gun type image to be identified. Finally, motor vibration control information is generated based on the preset vibration information corresponding to the target gun type. This motor vibration control information is sent to the motor, and the motor vibration is controlled using this information.
[0084] Those skilled in the art will understand that Figure 1 The schematic diagram shown is merely one example in which embodiments of this application can be implemented. The scope of application of the embodiments of this application is not limited by any aspect of this framework.
[0085] To facilitate understanding of the technical solutions provided in the embodiments of this application, the vibration control method for a motor provided in the embodiments of this application will be described below with reference to the accompanying drawings.
[0086] See Figure 2 As shown, this figure is a flowchart of a vibration control method for a motor provided in an embodiment of this application, the method including S201-S203:
[0087] S201: Obtain the gun display image from the target game image, perform image processing on the gun display image, and obtain the gun image to be identified.
[0088] In shooting games, users can possess multiple firearms. To help users clearly identify the types of firearms they have, different firearms have corresponding weapon images. Before firing, the user selects the desired firearm. A corresponding selection box or other specific selection icon will appear on the game interface to remind the user of the currently used firearm. The weapon image surrounded by the selection box or with other selection icons is the weapon display image.
[0089] It is understandable that in shooting games, there may be a preparation phase for the player, or a phase where no weapon is used. In these cases, the screenshot may not show the weapon type, making it impossible to determine the type of weapon used by the user. Such images can be filtered out to reduce the complexity of image processing. Based on this, this application provides a specific implementation method for determining the target game image, as detailed below.
[0090] The image containing the gun-shaped display image is used as the target game image. The target game image can be a 1920*1080 resolution three-color game screenshot. The resolution of the target game image can be determined based on the resolution of the game display. After obtaining the target game image, the gun-shaped display image is extracted from it. In one possible implementation, the gun-shaped display image can be extracted based on an identifier present in the gun-shaped display image. For example, see... Figure 3 As shown, this figure is a schematic diagram of a target game image provided in an embodiment of this application. The gun-shaped display image is marked by a selection box, and can be cropped from the target game image according to the selection box to obtain the gun-shaped display image. The obtained gun-shaped display image is as follows. Figure 4 As shown, this figure is a schematic diagram of a gun-shaped display image provided in an embodiment of this application.
[0091] The obtained gun-shaped display image may be composed of pixel values of multiple colors, and multiple colors may affect the recognition of the gun-shaped parts.
[0092] In order to accurately identify the gun type corresponding to the gun type display image, image processing is required for the gun type display image, which may include grayscale conversion and binarization.
[0093] The gun image is converted to grayscale from a color image. Then, the grayscale image is converted back to a black-and-white image of the gun to be identified. (See also...) Figure 5 As shown in the figure, this figure is a schematic diagram of a gun image to be identified provided in an embodiment of this application.
[0094] Specifically, for grayscale processing, the color channel values of each pixel point in the gun-shaped display image can be obtained. In the embodiments of the present application, the RGB color channel values of each pixel point can be obtained. And the gun-shaped display image is converted into a grayscale image by using formula (1).
[0095] Gray(a,b) = 0.299×R(a,b) + 0.578×G(a,b) + 0.114×B(a,b) (1)
[0096] Where, a represents the a-th in the horizontal direction of the gun-shaped display image, 0 ≤ a < X, and X is the total number of horizontal pixels of the gun-shaped display image; b represents the b-th in the vertical direction of the gun-shaped display image, 0 ≤ b < Y, and Y is the total number of vertical pixels of the gun-shaped display image. R(a,b) represents the red channel value of the a-th pixel point in the horizontal direction and the b-th pixel point in the vertical direction. G(a,b) represents the green channel value of the a-th pixel point in the horizontal direction and the b-th pixel point in the vertical direction. B(a,b) represents the blue channel value of the a-th pixel point in the horizontal direction and the b-th pixel point in the vertical direction. The obtained Gray(a,b) represents the grayscale value of the a-th pixel point in the horizontal direction and the b-th pixel point in the vertical direction after conversion.
[0097] Further, the gun-shaped display image after grayscale processing is binarized to obtain a gun-shaped image to be recognized with a black background and a white gun-shaped pattern.
[0098] In a possible implementation, the grayscale threshold can be set to 250 according to the gun-shaped pattern with a color bias towards white in the gun-shaped display image. When binarizing the gun-shaped display image, the pixel points with a grayscale value less than or equal to the grayscale threshold are set as black pixel points, and the pixel points with a grayscale value greater than the grayscale threshold are set as white pixel points to obtain the gun-shaped image to be recognized. The specific calculation formula is as follows:
[0099]
[0100] Where, Image_Gun_Binary(a,b) represents the binarization value of the a-th pixel point in the horizontal direction and the b-th pixel point in the vertical direction in the binarized gun-shaped display image. Gray(a,b) represents the grayscale value of the a-th pixel point in the horizontal direction and the b-th pixel point in the vertical direction in the gun-shaped display image before binarization. GrayTd represents the grayscale threshold, and GrayTd = 250.
[0101] S202: Determine the target gun type corresponding to the gun-shaped display image by using the gun-shaped image to be recognized.
[0102] The image of the gun to be identified includes a gun pattern, and different gun models correspond to different gun patterns. Based on the image of the gun to be identified, the gun model corresponding to the displayed image can be determined, that is, the target gun model.
[0103] In one possible implementation, the image of the gun type to be identified consists of black and white pixels, and the target gun type can be determined based on the distribution of black and white pixels in the image. This application provides a specific implementation method for determining the target gun type corresponding to the displayed gun type image using the image of the gun type to be identified; please refer to the following text.
[0104] S203: Based on the preset vibration information corresponding to the target gun type, generate motor vibration control information, which is used to control motor vibration.
[0105] Preset vibration information refers to the motor vibration mode information related to the gun model. Based on the preset vibration information, different vibration conditions can be achieved at the firing end of different gun models. First, the preset vibration information corresponding to the target gun model is selected. Then, based on the corresponding preset vibration information, motor vibration control information is generated. Motor vibration control information is used to control motor vibration. The preset vibration information can be pre-stored in a database.
[0106] Based on the above S201-S203, it is known that by capturing and processing the displayed image of the gun, an image of the gun to be identified is obtained. Using this image, the target gun type corresponding to the displayed image can be determined. This allows for accurate identification of the gun type in the displayed image, enabling the motor to vibrate according to preset vibration information corresponding to the target gun type when it is used, thus achieving specific vibrations for a specific gun type and improving the user's gaming experience.
[0107] In one possible implementation, the image of the gun to be identified consists of black and white pixels. By analyzing the distribution of black and white pixels in the image, the specific gun type included in the image can be determined. This application provides a specific implementation method for determining the target gun type corresponding to the displayed gun image using the image of the gun to be identified, including the following three steps:
[0108] A1: Sequentially obtain the number of target color pixels in each pixel region of the gun image to be identified, and obtain a number sequence; the pixel region is a pixel row or pixel column; the target color pixel is a white pixel or a black pixel.
[0109] After converting the gun-shaped display image into a gun-shaped image to be identified, the number of white and black pixels in the gun-shaped image to be identified is counted.
[0110] The number of target color pixels in each pixel region of the image of the gun to be identified is sequentially obtained. A pixel region can be a pixel row or a pixel column. Target color pixels can be white or black. Based on the obtained number of target color pixels in each pixel region, a sequence of counts corresponding to the gun type in the image to be identified can be obtained. The number of data points in the count sequence is the same as the number of pixel regions.
[0111] The number sequence reflects the distribution of white or black pixels in various pixel regions of the image of the gun to be identified, corresponding to the gun pattern in the image. The data contained in the number sequence differs for different gun types, thus allowing the identification of the corresponding gun type.
[0112] In particular, given that the gun-shaped image is horizontally distributed, the sequence of the number of white pixels in the statistical pixel column can better reflect the characteristics of the gun-shaped image.
[0113] A2: Select a target sequence from a preset sequence based on the number sequence; the preset sequence is a sequence composed of the number of target color pixels in each pixel region of a standard gun image corresponding to a preset gun type.
[0114] Understandably, each shooting game has preset gun types, and each preset gun type has a corresponding standard gun image. The number of target color pixels in each pixel region of the standard gun image is sequentially obtained, and these counts are used to form a preset sequence. The number of preset sequences is the same as the number of preset gun types. It should be noted that the method for obtaining the count sequence is the same as the method for obtaining the preset sequence, facilitating comparison between the count sequence and the preset sequence.
[0115] The preset sequence can be stored in the sample library in advance. After obtaining the number of sequences, the preset sequence is retrieved from the sample library to determine the target sequence.
[0116] See Figure 6 As shown in the figure, this is a schematic diagram of a preset sequence provided in an embodiment of this application. The horizontal axis of the coordinate system represents different pixel regions, and the vertical axis represents the number of target pixels in each pixel region. Different curves in the coordinate system represent preset sequences corresponding to different gun types.
[0117] In one possible implementation, this application provides a specific method for selecting a target sequence from a preset sequence based on the number sequence, specifically including:
[0118] The preset sequence with the smallest difference from the number sequence or the ratio closest to 1 is taken as the target sequence.
[0119] Calculate the difference between the count sequence and the preset sequence, or calculate the ratio between the count sequence and the preset sequence, and take the preset sequence with the smallest difference or the ratio closest to 1 as the target sequence.
[0120] Specifically, this application provides a specific implementation method for calculating the difference between a sequence of counts and a preset sequence, including the following steps:
[0121] Calculate the difference between the number of target color pixels in each pixel region of the number sequence and the number of target color pixels in the corresponding pixel region of the preset sequence to obtain a first difference value; the number of the first difference values is the same as the number of pixel regions.
[0122] Calculate the absolute value of the first difference to obtain the second difference;
[0123] The second difference is added together to obtain the target difference corresponding to the preset sequence;
[0124] The preset sequence corresponding to the smallest target difference is taken as the target sequence;
[0125] The preset gun type corresponding to the target sequence is taken as the target gun type.
[0126] The number of target color pixels in the pixel region of the count sequence is the same as the number of target color pixels in the preset sequence. The difference between the number of target color pixels in each pixel region of the count sequence and the corresponding number of target color pixels in the preset sequence is calculated. Specifically, for example, the difference between the number of target color pixels in the first pixel region of the count sequence and the number of target color pixels in the first pixel region of the preset sequence is calculated; the difference between the number of target color pixels in the second pixel region of the count sequence and the number of target color pixels in the second pixel region of the preset sequence is calculated; ...; the difference between the number of target color pixels in the last pixel region of the count sequence and the number of target color pixels in the last pixel region of the preset sequence is calculated. The calculated difference is the first difference, and the number of first differences is the same as the number of pixel regions.
[0127] Understandably, the first difference can be positive, negative, or zero. To facilitate calculating the difference between the preset sequence and the count sequence, the absolute value of each first difference is calculated to obtain a second difference, which can be positive or zero. The second differences are then summed to obtain the target difference corresponding to the preset sequence. The target difference reflects the difference between the count sequence and the preset sequence. The target differences between the count sequence and each preset sequence are calculated, and the preset sequence corresponding to the smallest target difference is taken as the target sequence, and the preset gun type corresponding to the target sequence is taken as the target gun type.
[0128] In this embodiment, a first difference is calculated, and after processing, a target difference corresponding to a preset sequence is obtained. From the calculated target differences, the preset sequence corresponding to the target difference with the smallest value is determined as the target sequence. This determines the preset sequence closest to the number sequence, thus accurately identifying the gun type corresponding to the displayed image of the gun to be identified, achieving the identification of the gun type currently used by the user.
[0129] A3: Use the preset gun type corresponding to the target sequence as the target gun type.
[0130] The target sequence is a preset sequence that is closest to the number sequence. The preset gun type corresponding to the target sequence is used as the target gun type displayed in the gun type image.
[0131] In this embodiment of the application, by determining the target sequence, a preset sequence that is close to the number sequence can be determined, thereby achieving accurate identification of the firearm type contained in the image of the firearm type to be identified and improving the accuracy of the determined firearm type.
[0132] The preset sequence is generated based on a standard gun image. When the image size of the standard gun image and the image size of the gun to be identified are large, the difference between the preset sequence and the number sequence is large, which affects the selection of the target sequence that is closest to the number sequence from the preset sequence.
[0133] This application provides a vibration control method for a motor. In addition to the steps described above, before selecting a target sequence from a preset sequence, the method further includes:
[0134] If the image size of the standard gun image is different from the image size of the gun image to be identified, the number sequence or the preset sequence is processed to be of equal length.
[0135] First, compare the image size of the standard gun image with the image size of the gun image to be identified. If the image size of the standard gun image and the image size of the gun image to be identified are different, then the number sequence or the preset sequence needs to be processed to equalize the length to facilitate the subsequent comparison of the number sequence and the preset sequence to determine the target sequence.
[0136] This application provides a specific implementation method for performing equal-length processing on the number sequence or the preset sequence if the image size of the standard gun image is different from the image size of the gun image to be identified, specifically including:
[0137] If the image size of the standard gun image is larger than the image size of the gun image to be identified, the preset sequence is adjusted to obtain an updated preset sequence;
[0138] If the image size of the gun type image to be identified is larger than the image size of the standard gun type image, the count sequence is adjusted to obtain an updated count sequence.
[0139] The image size of a standard gun image can be represented by the number of pixels in the horizontal and vertical directions. Similarly, the image size of the gun image to be identified can be represented by the number of pixels in the horizontal and vertical directions. If the image size of the standard gun image is larger than the image size of the gun image to be identified, then the number of data points in the preset sequence is greater than the number of data points in the count sequence, and / or the value range of the data points in the preset sequence is greater than the value range of the data points in the count sequence. The preset sequence can be further adjusted so that the updated preset sequence and the count sequence are similar in length and value range for each data point, facilitating comparison between the updated preset sequence and the count sequence.
[0140] If the image size of the gun type to be identified is larger than the image size of the standard gun type image, then the length of the counting sequence is greater than the length of the preset sequence, and / or the value range of the data in the counting sequence is greater than the value range of the data in the preset sequence. The counting sequence can be further adjusted to obtain an updated counting sequence.
[0141] This application provides a specific implementation method for adjusting a preset sequence to obtain an updated preset sequence, including the following four steps:
[0142] B1: Determine the first step length and the first ratio based on the image size of the standard gun image and the image size of the gun image to be identified.
[0143] The first step length is the length of the pixel region selected in the standard gun image. Specifically, the first step length can be determined based on the specific type of the pixel region in the standard gun image. For example, if the pixel region is a row of pixels, the corresponding first step length can be determined based on the width of the standard gun image and the width of the gun image to be identified. If the pixel region is a column of pixels, the corresponding first step length can be determined based on the length of the standard gun image and the length of the gun image to be identified.
[0144] The first ratio is used to adjust the values of the data in the preset sequence. Specifically, the first ratio can be determined based on the specific type of pixel region in the standard gun image. For example, if the pixel region is a pixel row, the corresponding first ratio can be determined based on the length of the standard gun image and the length of the gun image to be identified. If the pixel region is a pixel column, the corresponding first ratio can be determined based on the width of the standard gun image and the width of the gun image to be identified.
[0145] B2: Based on the first step length, determine the first target pixel region in the standard gun image.
[0146] The first target pixel region is determined in the standard gun image based on the first step length. Specifically, the standard gun image can be divided into pixel regions according to the first step length to obtain the first target pixel region. Alternatively, a portion of the pixel region can be selected from the standard gun image according to the first step length to obtain the first target pixel region.
[0147] B3: Obtain the number of target color pixels in the first target pixel region as the first pixel count.
[0148] Based on the determined first target pixel region, the number of target color pixels in the first target pixel region is obtained as the first pixel count, and the preset sequence can be updated based on the first pixel count.
[0149] B4: Obtain the updated preset sequence based on the first number of pixels and the first ratio.
[0150] By using the first ratio again, the number of first pixels can be adjusted to obtain the updated preset sequence.
[0151] Based on the above, by determining the first step length and the first ratio, the updated preset sequence can be determined using the first step length and the first ratio, thereby enabling a more accurate determination of the target sequence from the preset sequence.
[0152] This application provides a specific calculation method for updating the preset sequence, as detailed below.
[0153] In one possible implementation, the number of pixels in the horizontal direction of the standard gun image and the gun image to be identified are first obtained to obtain the first and second dimension lengths. Then, the number of pixels in the vertical direction of the standard gun image and the gun image to be identified are obtained to obtain the third and fourth dimension lengths. Specifically, the first dimension length can be represented by X_Lib, the second dimension length by X_T, the third dimension length by Y_Lib, and the fourth dimension length by Y_T.
[0154] If the first target pixel region is a pixel row, the number of pixels corresponding to the pixel row in the preset number needs to be reduced, and the value of the preset number needs to be reduced accordingly.
[0155] In one possible calculation method, the pixel regions at the edges and the pixel regions in the middle of the selected portion can be used as the first target pixel regions respectively.
[0156] Subtract 2 from the first dimension length, then subtract 2 from the second dimension length. The ratio between these two values gives the first step length. The formula for calculating the first step length is as follows:
[0157]
[0158] It should be noted that the first step length is used to reduce the number of corresponding pixel rows in the preset number. The calculated first step length has a value greater than 1, and can be an integer or a decimal.
[0159] Calculate the ratio of the fourth dimension length to the third dimension length to obtain the first ratio. The formula for calculating the first ratio is as follows:
[0160]
[0161] If the pixel region for obtaining the target number of pixels is a pixel column, the number of pixels corresponding to the pixel column in the preset number needs to be reduced, and the value of the preset number needs to be reduced accordingly.
[0162] Subtract 2 from the third dimension length, then subtract 2 from the fourth dimension length, and calculate the ratio of the two numbers to obtain the first step length. The formula for calculating the first step length is as follows:
[0163]
[0164] It should be noted that the first step length is used to reduce the number of corresponding pixel columns in the preset number. The calculated first step length has a value greater than 1, and it may be an integer or a decimal.
[0165] Calculate the ratio of the second dimension length to the first dimension length to obtain the first ratio. The formula for calculating the first ratio is as follows:
[0166]
[0167] For the preset sequence to be reduced, the updated preset sequence is obtained by using the number of target color pixels in the first target pixel region located at the edge of the standard gun image and the number of target color pixels in the first target pixel region located in the middle of the standard gun image. Using the number of target color pixels corresponding to the first pixel region in the preset region, the number of target color pixels corresponding to the first pixel region in the updated preset sequence is calculated. Multiplying the number of target color pixels corresponding to the first pixel region in the preset region by a first ratio yields the number of target color pixels corresponding to the reduced pixel region, and this number is used as the number of target color pixels corresponding to the first pixel region in the updated preset sequence.
[0168] The calculation formula is as follows:
[0169] X_Zoom1(0)=Image_Lib_Num_White(0)×A1 (7)
[0170] Where Image_Lib_Num_White(0) represents the number of target color pixels corresponding to the first pixel region in the preset region. X_Zoom1(0) represents the number of target color pixels corresponding to the first pixel region in the updated preset sequence. A1 represents the first ratio, and the specific value of A1 is related to the type of pixel region.
[0171] Understandably, since there are a large number of pixel regions in the preset sequence, it is necessary to use the first step to select some pixel regions from the preset sequence and adjust the number of target color pixels corresponding to the pixel regions.
[0172] The range of the pixel region to be adjusted is determined based on the first step length. The number of target color pixels corresponding to the [1+(i-1)×step1]th pixel region is taken as the first number to be compared in the preset sequence. Here, the initial value of i is 1, and step1 is the first step length. The specific value of step1 is related to the type of pixel region.
[0173] The number of target color pixels corresponding to the (i×step1)th pixel region is used as the last number to be compared in the preset sequence.
[0174] The number of target color pixels corresponding to the pixel region between the [1+(i-1)×step1]th pixel region and the (i×step1)th pixel region is also used as the first number to be compared.
[0175] The number of items to be compared in the first step is 1. By selecting the first number of items to be compared, a selection of a portion of the data in the preset sequence can be made, thereby adjusting the preset sequence.
[0176] To ensure the accuracy of the updated preset sequence, the largest value among the first number of comparisons is taken as the first pixel count. This preserves the largest number of target color pixels corresponding to the pixel regions in step 1, making the number of target color pixels corresponding to the pixel regions in the determined updated preset sequence more accurate.
[0177] Calculate the product of the number of first pixels and the first ratio to obtain the number of target color pixels corresponding to the i-th pixel region of the updated preset sequence.
[0178] The corresponding calculation formula is as follows:
[0179]
[0180] Increment the value of i by 1 to obtain the updated value of i. Use the updated value of i to determine whether to completely convert the middle part of the preset sequence into the corresponding updated preset sequence.
[0181] If the pixel region is a pixel row, compare the value of i with the value of X_T-2. If i is less than or equal to, it means that the middle part of the preset sequence has not been completely converted into the corresponding updated preset sequence. Repeat the above steps of determining the range of the pixel region to be adjusted and the subsequent steps of determining the number of the first pixel. Stop the calculation when the value of i is greater than X_T-2.
[0182] If the pixel region is a pixel column, compare the value of i with the value of Y_T-2. If i is less than or equal to Y_T-2, it means that the middle part of the preset sequence has not been completely converted into the corresponding updated preset sequence, and the above steps are repeated. Then, the calculation stops when the value of i is greater than Y_T-2.
[0183] Using the number of target color pixels corresponding to the last pixel region in the preset region, the number of target color pixels corresponding to the last pixel region in the updated preset sequence is calculated. This number is then multiplied by a first ratio to obtain the number of target color pixels corresponding to the reduced pixel region. This result is used as the number of target color pixels corresponding to the last pixel region in the updated preset sequence.
[0184] If the pixel region is a pixel row, the calculation formula is as follows:
[0185] X_Zoom1(X_T-1)=Image_Lib_Num_White(X_Lib-1)×A1 (9)
[0186] Here, Image_Lib_Num_White(X_Lib-1) represents the number of target color pixels corresponding to the last pixel region in the preset region. X_Zoom1(X_T-1) represents the number of target color pixels corresponding to the last pixel region in the updated preset sequence. A1 represents the first ratio, and the specific value of A1 is related to the type of pixel region.
[0187] If the pixel region is a column of pixels, the calculation formula is as follows:
[0188] X_Zoom1(Y_T-1)=Image_Lib_Num_White(Y_Lib-1)×A1 (10)
[0189] Here, Image_Lib_Num_White(Y_Lib-1) represents the number of target color pixels corresponding to the last pixel region in the preset region. X_Zoom1(Y_T-1) represents the number of target color pixels corresponding to the last pixel region in the updated preset sequence. A1 represents the first ratio, and the specific value of A1 is related to the type of pixel region.
[0190] Based on the above, the number of target color pixels corresponding to the first and last pixel regions of the preset sequence is obtained by counting the target color pixels corresponding to the first and last pixel regions of the preset sequence. Then, the number of target color pixels corresponding to a portion of the middle pixel regions of the preset sequence is selected, and the number of target color pixels corresponding to the middle pixel regions of the updated preset sequence is calculated. This adjusts the preset sequence so that the length of the updated preset sequence is consistent with the count sequence, and the value range of each number in the preset sequence is the same as the value range of each number in the count sequence, thus facilitating comparison between the updated preset sequence and the count sequence.
[0191] In another possible implementation, the standard gun-shaped image can be segmented using the first step length to obtain multiple first target pixel regions. The number of target color pixels in the middle position of the first target pixel region is taken as the first pixel count. Then, using the first ratio and the first pixel count, the updated preset sequence can be obtained.
[0192] Furthermore, this application embodiment also provides a specific implementation method for adjusting the count sequence to obtain an updated count sequence if the image size of the gun type image to be identified is larger than the image size of the standard gun type image, including the following four steps:
[0193] C1: Determine the second step length and the second ratio based on the image size of the standard gun image and the image size of the gun image to be identified.
[0194] The second step length is the length of the pixel region selected from the image of the gun model to be identified. Specifically, the second step length can be determined based on the specific type of the pixel region in the image of the gun model to be identified. For example, if the pixel region is a row of pixels, the corresponding second step length can be determined based on the width of the image of the gun model to be identified and the width of the standard gun model image. If the pixel region is a column of pixels, the corresponding second step length can be determined based on the length of the image of the gun model to be identified and the length of the standard gun model image.
[0195] The second ratio is used to adjust the values of the data in the number sequence. Specifically, the second ratio can be determined based on the specific type of the pixel region in the image of the gun type to be identified. For example, if the pixel region is a row of pixels, the corresponding second ratio can be determined based on the length of the image of the gun type to be identified and the length of the standard gun type image. If the pixel region is a column of pixels, the corresponding second ratio can be determined based on the width of the image of the gun type to be identified and the width of the standard gun type image.
[0196] C2: Determine the second target pixel region in the image of the gun to be identified based on the second step size.
[0197] The second target pixel region is determined in the image of the gun to be identified based on the second step length. Specifically, the second target pixel region can be obtained by dividing the image of the gun to be identified into pixel regions according to the second step length. Alternatively, a portion of the pixel region can be selected from the image of the gun to be identified according to the second step length to obtain the second target pixel region.
[0198] C3: Obtain the number of target color pixels in the second target pixel region, and use it as the number of second pixels.
[0199] Based on the determined second target pixel region, the number of target color pixels in the second target pixel region is obtained as the second pixel count, and the count sequence can be updated based on the second pixel count.
[0200] C4: Obtain the updated number sequence based on the second number of pixels and the second ratio.
[0201] By using the second ratio, the number of the second pixel can be adjusted to obtain the updated number sequence.
[0202] Based on the above, by determining the second step length and the second ratio, the updated number sequence can be determined using the second step length and the second ratio, thereby enabling a more accurate determination of the target sequence from the preset sequence.
[0203] Correspondingly, this application provides a specific calculation method for the updated number sequence, which can be found below.
[0204] The specific implementation method for updating the number sequence is similar to the above-described method for updating the preset sequence. The calculation formulas for the second step length, the second ratio, and the updated number sequence are described below.
[0205] If the pixel region is a pixel row, the formula for calculating the second step length is as shown in formula (11):
[0206]
[0207] The formula for calculating the second ratio is as follows:
[0208]
[0209] If the pixel region is a pixel column, the formula for calculating the second step length is as shown in formula (13):
[0210]
[0211] The formula for calculating the second ratio is as follows:
[0212]
[0213] If the pixel region is a pixel row, the number of target color pixels corresponding to the pixel region in the updated number sequence is calculated as follows:
[0214]
[0215] The initial value of j is 1, and 1≤j≤X_Lib-2.
[0216] If the pixel region is a pixel column, the number of target color pixels corresponding to the pixel region in the updated number sequence is calculated as follows:
[0217]
[0218] The initial value of j is 1, and 1≤j≤Y_Lib-2.
[0219] Based on the above, the number of target color pixels corresponding to the first and last pixel regions of the updated count sequence is obtained by counting the target color pixels corresponding to the first and last pixel regions of the count sequence. Then, the number of target color pixels corresponding to a portion of the middle pixel regions of the count sequence is selected, and the number of target color pixels corresponding to the middle pixel regions of the updated count sequence is calculated. This adjusts the count sequence so that the length of the updated count sequence is the same as the preset sequence, and the value range of each number in the count sequence is the same as the value range of each number in the preset sequence, thus facilitating comparison between the updated count sequence and the preset sequence.
[0220] In another possible implementation, the image of the gun to be identified can be segmented using a second step size to obtain multiple second target pixel regions. The number of target color pixels in the middle position of the second target pixel region is taken as the second pixel count. Then, using the second ratio and the second pixel count, the updated count sequence is obtained.
[0221] In one possible implementation, the target game image can be obtained by taking a screenshot of an image displayed on a terminal. This application also provides a vibration control method for a motor, which further includes the following steps before obtaining the gun-shaped display image from the target game image:
[0222] If the image acquisition conditions are met, the game image to be processed is acquired at a preset time interval, and the gun-shaped display mark is identified in the game image to be processed.
[0223] If the game image to be processed contains a gun-shaped display icon, then the game image to be processed is used as the target game image.
[0224] Image acquisition conditions are used to determine the conditions that trigger the acquisition of game images to be processed. It's understandable that during a shooting game played on a terminal, there are stages where the user cannot operate the weapon; during these stages, there's no need to take screenshots to obtain game images. Specifically, the image acquisition condition could be that the terminal's display sensor detects the user touching the display screen. Another example is that the image acquisition condition could be the start of a game match.
[0225] Once the image acquisition conditions are met, the game image to be processed is acquired at preset time intervals. The game image to be processed can be obtained by taking a screenshot of the game screen displayed on the terminal. The time interval is the time interval between acquiring two game images to be processed. The time interval can be set according to the terminal's performance and the game mechanics. Specifically, the preset time interval can be 100ms.
[0226] Gun-shaped indicator tags are used to mark gun-shaped display images. The obtained game image to be processed may or may not contain gun-shaped indicator tags. The process involves identifying these gun-shaped indicator tags within the acquired game image. For example, if the gun-shaped indicator is a yellow selection box, the shape of the object being scanned can be set to a rectangle, and the color to yellow.
[0227] If the game image to be processed contains a gun-shaped display identifier, then the game image to be processed is identified as the target game image, making it easier to obtain the gun-shaped display image from the target game image later.
[0228] Based on the above, it can be seen that by acquiring the game image to be processed after meeting the image acquisition conditions, and then filtering the game image to be processed, the target game image that needs to be processed can be determined, reducing the number of images that need to be processed and improving the efficiency of determining the target gun type.
[0229] In some shooting games, the gun display image also includes the number of bullets. The number of bullets affects the recognition of the gun type. In one possible implementation, this application embodiment also provides a vibration control method for a motor, which further includes, before obtaining the number sequence:
[0230] Obtain the dimensions of the gun image to be identified, and determine the digital region based on the dimensions of the gun image to be identified;
[0231] The color of the pixels in the digital area is set as the background color to obtain the updated image of the gun to be identified.
[0232] The image of the gun model to be identified contains numerical regions located at fixed positions. The color of the pixels in these numerical regions may be similar to the color of the pixels in the gun model itself. Before obtaining the number sequence from the image, these numerical regions need to be removed to avoid them affecting gun model recognition.
[0233] The numerical region can be determined based on the size of the image of the gun to be identified. It's understandable that there's a correspondence between numerical regions and the images of guns to be identified in various shooting games. Based on this predetermined correspondence, the numerical region can be determined within the image of the gun to be identified.
[0234] The color of each pixel in the digital area is set to the background color, thereby avoiding interference from the digital area in the identification of the target gun type.
[0235] In one possible implementation, the digital regions in the gun-shaped display image can be set after obtaining the image of the gun shape to be identified. To improve the processing efficiency of the gun-shaped image to be identified, the digital regions in the gun-shaped display image can also be set before image processing of the gun-shaped display image.
[0236] In this embodiment of the application, by setting the digital area, the influence of the digital area on the determination of the target gun type can be avoided, thereby improving the efficiency of determining the target gun type.
[0237] Based on the vibration control method for a motor provided in the above-described embodiments, this application also provides a vibration control device for a motor, which will be described below with reference to the accompanying drawings.
[0238] See Figure 7This figure is a schematic diagram of the structure of a vibration control device for a motor provided in an embodiment of this application. Figure 7 As shown, the vibration control device for the motor includes:
[0239] The first acquisition unit 701 is used to acquire a gun-shaped display image from a target game image, and to perform image processing on the gun-shaped display image to obtain a gun-shaped image to be identified.
[0240] The first determining unit 702 is used to determine the target gun type corresponding to the gun type display image using the gun type image to be identified;
[0241] The generation unit 703 is used to generate motor vibration control information based on preset vibration information corresponding to the target gun type, and the motor vibration control information is used to control motor vibration.
[0242] In one possible implementation, the image of the gun to be identified consists of black pixels and white pixels;
[0243] The first determining unit 702 includes:
[0244] The first acquisition subunit is used to sequentially acquire the number of target color pixels in each pixel region of the gun image to be identified, and obtain a sequence of counts; the pixel region is a pixel row or a pixel column; the target color pixels are white pixels or black pixels;
[0245] A selection subunit is used to select a target sequence from a preset sequence based on the number sequence; the preset sequence is a sequence composed of the number of target color pixels in each pixel region of a standard gun image corresponding to a preset gun type;
[0246] A subunit is defined to identify the preset gun type corresponding to the target sequence as the target gun type.
[0247] In one possible implementation, the device further includes:
[0248] An adjustment unit is used to perform equal-length processing on the number sequence or the preset sequence if the image size of the standard gun image is different from the image size of the gun image to be identified.
[0249] In one possible implementation, the adjustment unit includes:
[0250] The first adjustment subunit is used to adjust the preset sequence if the image size of the standard gun image is larger than the image size of the gun image to be identified, so as to obtain an updated preset sequence.
[0251] The second adjustment subunit is used to adjust the number sequence if the image size of the gun image to be identified is larger than the image size of the standard gun image, so as to obtain an updated number sequence.
[0252] In one possible implementation, the first adjustment subunit is specifically used to determine the first step length and the first ratio based on the image size of the standard gun image and the image size of the gun image to be identified;
[0253] Based on the first step length, a first target pixel region is determined in the standard gun-shaped image;
[0254] Obtain the number of target color pixels in the first target pixel region, and use it as the first pixel count;
[0255] The updated preset sequence is obtained based on the first number of pixels and the first ratio.
[0256] In one possible implementation, the second adjustment subunit is specifically used to determine a second step size and a second ratio based on the image size of the standard gun image and the image size of the gun image to be identified;
[0257] Based on the second step length, a second target pixel region is determined in the image of the gun type to be identified;
[0258] Obtain the number of target color pixels in the second target pixel region, and use it as the number of second pixels;
[0259] The updated number sequence is obtained based on the second number of pixels and the second ratio.
[0260] In one possible implementation, the selection of sub-units is specifically used to select a preset sequence that has the smallest difference from the number sequence or whose ratio is closest to 1 as the target sequence.
[0261] In one possible implementation, the device further includes:
[0262] The second acquisition unit is used to acquire the game image to be processed at a preset time interval if the image acquisition conditions are met, and to identify the gun-shaped display mark on the game image to be processed.
[0263] The second determining unit is used to determine the game image to be processed as the target game image if the game image to be processed contains a gun-shaped display icon.
[0264] In one possible implementation, the device further includes:
[0265] The third acquisition unit is used to acquire the image size of the gun image to be identified, and to determine the digital region based on the image size of the gun image to be identified.
[0266] The update unit is used to set the color of the pixels in the digital area to the background color to obtain an updated image of the gun to be identified.
[0267] Based on the vibration control method for a motor provided in the above-described method embodiments, this application provides a vibration control chip for a motor, comprising: a processor and a memory;
[0268] The memory is used to store computer-executed instructions;
[0269] When executed by the processor, the instruction causes the processor to perform the method described in any of the above embodiments.
[0270] Based on the vibration control method for a motor provided in the above-described method embodiments, this application provides a computer-readable storage medium storing instructions that, when executed on a terminal device, cause the terminal device to perform the method described in the above embodiments.
[0271] It should be noted that the various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the systems or apparatus disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple, and relevant parts can be referred to the method section.
[0272] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0273] It should also be noted that, in this document, relational terms such as "first" and "second" are used only 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 "comprising," "including," or any other variations thereof 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. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0274] 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.
[0275] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A vibration control method for a motor, characterized in that, The method includes: A gun-shaped display image is obtained from the target game image, and the gun-shaped display image is processed to obtain a gun-shaped image to be identified; the gun-shaped image to be identified is composed of black pixels and white pixels; The target gun model corresponding to the displayed gun model is determined using the image of the gun model to be identified. Specifically, this step involves: sequentially obtaining the number of target color pixels in each pixel region of the image of the gun model to be identified, resulting in a sequence of counts; the pixel region is a pixel row or pixel column; the target color pixels are white or black pixels; based on the count sequence, a target sequence is selected from a preset sequence; the preset sequence is a sequence composed of the number of target color pixels in each pixel region of a standard gun model image corresponding to a preset gun model; the preset gun model corresponding to the target sequence is taken as the target gun model. Based on preset vibration information corresponding to the target gun type, motor vibration control information is generated, and the motor vibration control information is used to control motor vibration. Before selecting a target sequence from a preset sequence based on the count sequence, the method further includes: if the image size of the standard gun image is different from the image size of the gun image to be identified, performing equal-length processing on the count sequence or the preset sequence; specifically, if the image size of the standard gun image is larger than the image size of the gun image to be identified, adjusting the preset sequence to obtain an updated preset sequence; if the image size of the gun image to be identified is larger than the image size of the standard gun image, adjusting the count sequence to obtain an updated count sequence.
2. The method according to claim 1, characterized in that, The step of adjusting the preset sequence to obtain the updated preset sequence includes: The first step length and the first ratio are determined based on the image size of the standard gun image and the image size of the gun image to be identified. Based on the first step length, a first target pixel region is determined in the standard gun-shaped image; Obtain the number of target color pixels in the first target pixel region, and use it as the first pixel count; The updated preset sequence is obtained based on the first number of pixels and the first ratio.
3. The method according to claim 1, characterized in that, The step of adjusting the count sequence to obtain the updated count sequence includes: The second step size and the second ratio are determined based on the image size of the standard gun image and the image size of the gun image to be identified. Based on the second step length, a second target pixel region is determined in the image of the gun type to be identified; Obtain the number of target color pixels in the second target pixel region, and use it as the number of second pixels; The updated number sequence is obtained based on the second number of pixels and the second ratio.
4. The method according to claim 1, characterized in that, The step of selecting a target sequence from a preset sequence based on the number sequence includes: The preset sequence with the smallest difference from the number sequence or the ratio closest to 1 is taken as the target sequence.
5. The method according to claim 1, characterized in that, Before obtaining the gun display image from the target game image, the method further includes: If the image acquisition conditions are met, the game image to be processed is acquired at a preset time interval, and the gun-shaped display mark is identified in the game image to be processed. If the game image to be processed contains a gun-shaped display icon, then the game image to be processed is used as the target game image.
6. The method according to claim 1, characterized in that, Before sequentially obtaining the number of target color pixels in each pixel region of the image of the gun type to be identified, and obtaining the number sequence, the method further includes: Obtain the image size of the gun image to be identified, and determine the digital region based on the image size of the gun image to be identified; The color of the pixels in the digital area is set as the background color to obtain the updated image of the gun to be identified.
7. A vibration control device for a motor, characterized in that, The device includes: The first acquisition unit is used to acquire a gun-shaped display image from a target game image, and perform image processing on the gun-shaped display image to obtain a gun-shaped image to be identified; the gun-shaped image to be identified is composed of black pixels and white pixels; The first determining unit is used to determine the target gun type corresponding to the gun type display image using the gun type image to be identified; specifically, it is used to: sequentially obtain the number of target color pixels in each pixel region of the gun type image to be identified, to obtain a number sequence; the pixel region is a pixel row or pixel column; the target color pixels are white pixels or black pixels; select a target sequence from a preset sequence according to the number sequence; the preset sequence is a sequence composed of the number of target color pixels in each pixel region of the standard gun type image corresponding to the preset gun type; and take the preset gun type corresponding to the target sequence as the target gun type; The generation unit is used to generate motor vibration control information based on preset vibration information corresponding to the target gun type, and the motor vibration control information is used to control motor vibration. The device further includes: An adjustment unit is used to perform equal-length processing on the number sequence or the preset sequence if the image size of the standard gun image is different from the image size of the gun image to be identified. The adjustment unit includes: The first adjustment subunit is used to adjust the preset sequence if the image size of the standard gun image is larger than the image size of the gun image to be identified, so as to obtain an updated preset sequence. The second adjustment subunit is used to adjust the number sequence if the image size of the gun image to be identified is larger than the image size of the standard gun image, so as to obtain an updated number sequence.
8. A vibration control chip for a motor, characterized in that, include: Processor and memory; The memory is used to store computer execution instructions; when executed by the processor, the instructions cause the processor to perform the method according to any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed on a terminal device, cause the terminal device to perform the method described in any one of claims 1-6.
Citation Information
Patent Citations
Vibration control method, device, mobile terminal and computer readable storage medium
CN110465080A
Information processing method and device, readable storage medium and electronic equipment
CN112449055A