Image processing method and device for high-precision automatic optical detection equipment
By converting parallel computing in computer vision tasks into serial index search, directly extracting image pixel information and building a mapping table, the computing device burden problem caused by the high complexity of deep neural networks is solved, and efficient image processing is achieved on mobile devices.
Patent Information
- Application Number
- CN202410355466.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-25
- Publication Date
- 2025-09-26
AI Technical Summary
In existing computer vision tasks, the high complexity of deep neural networks causes excessive burden on computing devices, making it difficult to apply them efficiently on mobile devices.
Convert parallel computing into serial index search, reduce the amount of calculation and lower the computing burden on the device by directly extracting image pixel information and building a mapping table.
Efficient image processing is achieved on devices with lower computing power, reducing computing costs and improving model inference speed.
Smart Images

Figure CN120707362A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to an image processing method and apparatus for high-precision automatic optical inspection equipment. Background Art
[0002] Currently, deep neural networks are used in many computer vision tasks, including detection and classification. With the development of mobile devices, the demand for computer vision technology is also increasing. To achieve higher accuracy or better results in these computer vision tasks, these tasks often require increased network complexity. However, this higher network complexity also places a significant computational burden on the device. Summary of the Invention
[0003] The present application provides an image processing method that can reduce the computational burden of a device.
[0004] In a first aspect, the present application provides an image processing method, the method comprising:
[0005] Get the target input image;
[0006] Determining pixel information based on the target input image;
[0007] Based on the pixel information, target processing result information is determined.
[0008] In a second aspect, the present application further provides an image processing device, comprising:
[0009] An acquisition module is used to acquire a target input image;
[0010] A first determining module, configured to determine pixel information based on the target input image;
[0011] The second determining module is used to determine target processing result information based on the pixel information.
[0012] In a third aspect, the present application also provides a terminal device, which includes a processor, a memory, and a computer program stored in the memory and runnable on the processor, wherein the processor executes the computer program to implement the steps in any one of the image processing methods described.
[0013] In a fourth aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored, and the computer program is executed by a processor to implement the steps in any one of the image processing methods. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0015] Figure 1 is a schematic diagram of a scenario of an image processing system provided in an embodiment of the present application;
[0016] Figure 2 This is a flow chart of an embodiment of the image processing method in the embodiment of the present application;
[0017] Figure 3 This is a schematic diagram of a model architecture of an embodiment of the image processing method in the embodiment of the present application;
[0018] Figure 4 is a schematic diagram of a functional module of an image processing device in an embodiment of the present application;
[0019] Figure 5 It is a structural diagram of the terminal device in an embodiment of the present application. DETAILED DESCRIPTION
[0020] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without making creative efforts are within the scope of protection of this application.
[0021] In the description of this application, it should be understood that the terms "first" and "second" are used for descriptive purposes only and should not be understood to indicate or imply relative importance or implicitly specify the number of the technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of this application, "plurality" means two or more, unless otherwise specifically defined.
[0022] In this application, the word "exemplary" is used to mean "serving as an example, illustration, or illustration." Any embodiment described in this application as "exemplary" is not necessarily to be construed as being preferred or advantageous over other embodiments. At the same time, it is understood that in the specific implementation of this application, when user information, user data, and other related data are involved, when the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use, and processing of relevant data must comply with relevant laws, regulations, and standards of relevant countries and regions.
[0023] The following description is provided to enable any person skilled in the art to implement and use the present application. In the following description, details are listed for the purpose of explanation. It should be understood that one of ordinary skill in the art will recognize that the present application can be implemented without using these specific details. In other examples, well-known structures and processes will not be elaborated in detail to avoid obscuring the description of the present application with unnecessary details. Therefore, the present application is not intended to be limited to the embodiments shown, but is consistent with the widest range of principles and features disclosed in the present application.
[0024] The present application provides an image processing method, apparatus, device, and storage medium, which are described in detail below.
[0025] First of all, many computer vision tasks currently use deep neural networks, including detection tasks and classification tasks. With the development of mobile devices, the demand for computer vision technology is also increasing. In order to obtain higher accuracy or better results for such computer vision tasks, it is usually necessary to increase the complexity of the network. It is relatively easy to implement calculations using parallel computing modules (such as GPUs), but for user software, smart phones, TVs and other smart terminals, due to their chip computing power, cost, power consumption and other issues, although many model lightweight methods have emerged in recent years, deep networks still cannot be well applied. To this end, this application proposes an image processing method that converts parallel computing into serial index search. This method is often used in embedded systems to accelerate calculations. Since it does not require a large number of floating-point operations, it greatly improves the model inference speed.
[0026] See also Figure 1 , Figure 1 This is a schematic diagram of a scenario of an image processing system provided in an embodiment of the present application. The image processing system may include a terminal device 100 and a storage device 200. The storage device 200 may transmit data to the terminal device 100. Figure 1 The terminal device 100 in the embodiment can obtain the image data stored in the storage device 200 to execute the image processing method in this application.
[0027] In the embodiment of the present application, the terminal device 100 includes but is not limited to a desktop computer, a portable computer, a network server, a personal digital assistant (PDA), a tablet computer, a wireless terminal device, an embedded device, etc.
[0028] In an embodiment of the present application, communication between the terminal device 100 and the storage device 200 can be achieved through any communication method, including but not limited to mobile communications based on the 3rd Generation Partnership Project (3GPP), Long Term Evolution (LTE), and Worldwide Interoperability for Microwave Access (WiMAX), or computer network communications based on the TCP / IP Protocol Suite (TCP / IP) and User Datagram Protocol (UDP).
[0029] It should be noted that Figure 1 The scene diagram of the image processing system shown is only an example. The image processing system and scene described in the embodiment of the present application are intended to more clearly illustrate the technical solution of the embodiment of the present application, and do not constitute a limitation on the technical solution provided by the embodiment of the present application. Ordinary technicians in this field can know that with the evolution of the image processing system and the emergence of new business scenarios, the technical solution provided by the embodiment of the present application is also applicable to similar technical problems.
[0030] like Figure 2 As shown, Figure 2 This is a flow chart of an embodiment of an image processing method in an embodiment of the present application. The image processing method may include the following steps 201 to 203:
[0031] 201. Obtain a target input image.
[0032] In an embodiment of the present application, the target input image can be any type of image data, such as an image in any format such as jpg, jpeg, png, etc., and the specific embodiment of the present application is not limited thereto.
[0033] 202. Determine pixel information based on the target input image.
[0034] In the embodiments of this application, in order to solve the problem of excessive parameter calculations on the device when using neural networks, this application does not use traditional neural network models to extract features from images. Instead, it directly determines the pixel value, brightness, and other comprehensive pixel information of each pixel in the target input image. This eliminates the need to obtain image features through neural network working methods such as convolution kernels, which can reduce the computational effort required to obtain image features.
[0035] It should be noted that the pixel information of the target input image can be directly obtained. For example, after acquiring an image, when the display device displays the image, it will determine the pixel value, brightness, contrast, and other parameter information of each pixel point based on the image file. Only then can the image be displayed smoothly. Therefore, in the embodiments of the present application, the method of extracting pixel features from the target input image can also refer to the method used when the image is displayed to determine the pixel information of the target input image.
[0036] 203. Determine target processing result information based on the pixel information.
[0037] However, if the image is not processed through a neural network, it is difficult to identify the image. Therefore, in order to solve this problem, the embodiment of the present application can now construct a correspondence between input and output for a neural network, so as to save this correspondence. Afterwards, after obtaining the input image, the corresponding output can be found according to the correspondence. However, it should be noted that if this correspondence is to be obtained, it is necessary to perform image recognition or image processing training, such as training a target image processing model, wherein the target image processing model can be any type of neural network model, which is not specifically limited here. At the same time, the method for training the target image processing model here can also be any training method, and similarly, the embodiment of the present application does not limit the specific training method.
[0038] When training a target image processing model, the model extracts pixel features from the training image and outputs them. Once the model is trained, the image to be processed or recognized is input into the model, and the model can then calculate the output corresponding to the input image. Therefore, each input actually corresponds to an output, but this correspondence is calculated in real time by the model. Therefore, in embodiments of the present application, a trained image processing model can be used to recognize a large number of images and record the outputs corresponding to different images, thereby obtaining a correspondence between each input image and the output result. This correspondence can be converted into a mapping table, for example. Once an input image is obtained, the corresponding output can be retrieved using the mapping table. Specifically, various permutations and combinations of different pixel values in various images can be stored in the mapping table. For ease of understanding, consider an apple and a pear. The apple consists of a primarily red pixel or a primarily green pixel, with a small number of black pixel branches. The red or green pixels form a circle, and the black pixels representing the branches are connected to the red or green pixels in the circle. Based on this, the mapping table can use a parameter to represent a circular red pixel or a circular green pixel, and at the same time use a parameter to represent the black pixel branch, and another parameter to represent the connection between the two. In this way, the pixel parameters in the mapping table are set, and the pixel parameters are obtained based on the target image processing model. Afterwards, the corresponding output of this pixel parameter combination is determined to be an apple. Similarly, the same is true for pears. For example, pears are yellow or green, and the shape of pears is more elliptical than that of apples. Therefore, a parameter can be set to represent yellow or green, and another parameter can be set to represent the shape of yellow or green as an ellipse, and then related parameters can be set to represent black branches, the connection between the two, etc. Finally, the output corresponding to these parameter groups can be set to pears. Finally, when an apple image or a pear image is obtained, since the pixel values of each pixel in the specific image can be determined based on the image, the parameters of different pixel values can be determined, and the parameters of the obtained pixel values are compared with each set of parameters in the mapping table. If it is determined that there is a parameter in the mapping table that is the same as or matches the parameter of the pixel value of the input image, the corresponding output can be determined according to the mapping table. The model does not need to go through various complex calculations, which reduces the computing cost. Therefore, this method can be deployed in some devices with lower computing power.
[0039] In other words, the mapping table can determine parameters such as multiple color combinations, shapes composed of colors, and connection relationships of various colors based on the input and output of the target image processing model, as well as the output corresponding to various parameters, thereby forming the mapping table.
[0040] In order to better implement the embodiments of the present application, in one embodiment of the present application, target processing result information is determined based on pixel information, including:
[0041] When a preset output relationship exists for target pixel information, the target output information is determined based on the preset output relationship; or, when no preset output relationship exists for target pixel information, the target output information is determined based on the target pixel information; wherein the target pixel information is determined based on pixel information of each pixel point in the target input image; and target processing result information is obtained based on the target output information.
[0042] The above embodiment provides an implementation method for processing an image according to a mapping table. In the above embodiment, a method is provided for setting multiple parameters, indexing in the mapping table according to different parameters, and outputting the final result. The embodiment of the present application also provides a method for directly searching the mapping table (i.e., the preset output relationship) based on the pixel value and ultimately obtaining the corresponding output result.
[0043] Specifically, as shown below, taking the pixel value of a single pixel as an example, assume that the input for a given pixel is I0. The pixel value of I0 can be 24 (the pixel value range is 0 to 255), and the pixel value 24 is converted to binary as 00011000. Based on this, the high-order bits of 00011000 can be used as the first pixel information, and the low-order bits as the second pixel information, that is, 0001 is the first pixel information, and 1000 is the second pixel information. Furthermore, in the mapping table, each pixel information can be directly recorded in bit form, eliminating the need to establish additional parameters to replace the pixel information. It should be noted that the high-order bits typically represent fine image details and color information. For example, in an 8-bit pixel value, the high-order bits can represent the brightness or red component of the color, while the low-order bits represent other color components, such as green and blue. The low-order bits typically represent coarse image information or noise. These bits are often used to represent the overall brightness or grayscale level of the image. In an 8-bit grayscale image, the low-order bits can be used to indicate the brightness or darkness of the pixel. Therefore, after obtaining a pixel value, the specific color can be determined based on the high bit of the pixel value, thereby corresponding to which objects include this color. Then, a target object in the objects corresponding to the high bit is determined based on the low bit, thereby completing the final output. It should be noted that the high bit and the low bit have a corresponding mapping relationship in the mapping table. It can be seen that in any embodiment of the present application, the output information is actually a kind of output data in the mapping table, specifically a kind of data that can be used to guide classification. As described in the above embodiment, if the target pixel information is red, then the output information can be understood as parameter information of various objects corresponding to red, such as probability, etc. Then, after querying the corresponding output information based on each target pixel information, all the output information is combined to infer the final recognition and classification result of an image, such as apple, pear, etc. It should be noted that the description here is only for ease of understanding and does not constitute a limitation of the present application.
[0044] Specifically, after the target input image is acquired, there are multiple pixels in the target input image, each pixel corresponds to a pixel value, and different pixels have corresponding arrangement relationships in the target input image. Based on these arrangement relationships, the image shape composed of different pixels can be determined. At this time, different image shapes can be represented by setting a parameter. For example, there are some pixels that form a circle, and the high bits of the pixel values of these pixels represent red. Assuming that a red balloon and a red apple can be located at this time, the texture of the balloon or the texture of the apple can be determined based on the low bits, and the result of the balloon or the apple can be output.
[0045] To better implement the embodiments of the present application, in one embodiment of the present application, when target pixel information has a preset output relationship, determining target output information according to the preset output relationship includes:
[0046] The target pixel information is matched with each input parameter information in the preset output relationship, and a target input parameter information matching the target pixel information is obtained from each input parameter information; and the output information corresponding to the target input parameter information is determined as the target output information.
[0047] It should be noted that the above embodiment provides a solution for indexing in a mapping table based on pixel values. However, if a corresponding relationship is established in the mapping table for each color combination of the graphics, the amount of data in the mapping table will be very large. Therefore, in order to avoid the problem that the data in the mapping table is huge and lightweight devices cannot be stored, the embodiment of the present application can reduce the number of mapping relationships stored in the mapping table, thereby reducing the amount of data in the mapping table, so that the parameters in the mapping table can be sampled. It should be noted that in the embodiment of the present application, the mapping pixel information is the relevant parameters of the pixel information stored in the mapping table after sampling. Among them, it should be noted that the mapping pixel information can be set by pre-sampling, for example: for an 8-bit bitmap, each pixel has 2 8 = 256 possible pixel values (0 to 255), that is, the input value, at this time the input value can be 2 4 = 16 sampling intervals for uniform sampling, and we get 2 4 +1 = 17 uniform sampling points, with the sampling point values being 0, 16, ..., 240, and 255. During testing, the values of non-sampling points are interpolated using the values of the nearest sampling point. Of course, other methods can also be used to set the mapped pixel information, and the specific methods are not limited here.
[0048] After reducing the amount of data in the mapping table and acquiring a portion of the input image, there may be situations where there is no corresponding output result in the mapping table. Based on this, after acquiring the target pixel information of the target input image, the mapping table can be queried based on the target pixel information to see if there is fully matching mapping pixel information. For example, if the pixel information in the input image is equal to the sampled pixel value, the corresponding output result can be directly queried in the mapping table based on the mapping pixel information. If the pixel information in the input image does not correspond to the mapping pixel information, the corresponding output result is not output. Alternatively, if a red apple image is a red circular pattern, and the mapping table only contains red mapping pixel information, circular mapping pixel information, or green circular mapping pixel information, it can be determined that there is no target mapping pixel information matching the red apple image in the mapping table. This target mapping pixel information can be understood as a mapping pixel information in the sampled mapping pixel information. Conversely, if the mapping table contains red circular mapping pixel information, it can be determined that there is target mapping pixel information matching the target pixel information in the mapping table. If there is matching target mapping pixel information, the corresponding output result can be determined based on the target mapping pixel information. At this time, if there is no corresponding target mapping pixel information, relevant prompt information may be generated, such as words such as recognition failure and re-recognition.
[0049] To better implement the embodiments of the present application, in one embodiment of the present application, determining target output information based on target pixel information includes:
[0050] According to the bit data of the target pixel information, first pixel information and second pixel information are determined from the target pixel information; and according to the first pixel information and the second pixel information, corresponding target output information is determined.
[0051] According to the above embodiment, a pixel value includes bits, and the high bits in the bits can represent the brightness or red component of the color, while the low bits can represent the components of other colors. Therefore, the high-bit brightness information and the red color component information can be used as the first pixel information, while the low-bit other color component information can be used as the second pixel information. For example, a red apple has a high red component, while a dark red sun also includes a blue component. At this time, based on the high-bit and low-bit information and a preset output relationship, the probability of objects corresponding to different color components can be determined, thereby obtaining a specific output object.
[0052] In order to better implement the embodiments of the present application, in one embodiment of the present application, target pixel information is divided into first pixel information and second pixel information, including:
[0053] Determine the number of bits of the target pixel information; and determine first bit data and second bit data in the bit data according to the number of bits, wherein the first bit data corresponds to the first pixel information of the target pixel information, and the second bit data corresponds to the second pixel information of the target pixel information.
[0054] The above embodiment provides an implementation method for dividing pixel information according to high bits and low bits. The embodiment of the present application also provides a method for determining first pixel information and second pixel information. For example: when the bit number of the pixel value is not 8, but a 10-bit image, the first 5 bits of the 10-bit image can be used as the high bits and the last 5 bits as the low bits. Therefore, after obtaining the target input image, it can be determined how to determine the high bits and low bits according to whether the image is an 8-bit image or a 10-bit image.
[0055] In order to better implement the embodiments of the present application, in one embodiment of the present application, determining corresponding target output information according to the first pixel information and the second pixel information includes:
[0056] According to the first pixel information, a first pixel value corresponding to the first pixel information is determined; the first pixel value is compared with each sampled pixel value to obtain a target sampled pixel value that matches the first pixel value as the initial output information; according to the second pixel information, a second pixel value corresponding to the second pixel information is determined; according to the second pixel value and the number of target sampled pixel values, weight information is determined; and according to the initial output information and the weight information, the corresponding target output information is determined.
[0057] The above embodiment provides a solution for querying a specific output result in a mapping table based on a high bit and a low bit. At the same time, the above embodiment also provides a solution for querying a mapping table based on first pixel information and second pixel information according to an embodiment of the present application.
[0058] Specifically, take 2D interpolation as an example: given input I as pixel information, I0=24(00011000 (2) ) and I1=60(00111100 (2) ), firstly, the input pixel information is divided into 4 most significant bits and 4 least significant bits, which is the same as the above embodiment and will not be described in detail. The values of the most significant bits of I0 and I1 are 1 (0001 (2) ) and 3(0011 (2) ), used to determine the most recent sampled mapped pixel information, that is, to determine the corresponding initial output information based on the first pixel information. The values of the least significant bits of I0 and I1 are L x =8(1000 (2) ) and Ly =12(1100 (2) ), used to determine the boundary vertices and weights, that is, to determine the weight information of the initial output information according to the second pixel information. At this time, the two boundary vertices are fixed as P 00 =LUT[1][3] and P 11 =LUT[1+1][3+1], LUT is a mapping table. Another vertex is compared with L x and L y To determine, since Lx<Ly, P is selected 01 =LUT[1][3+1], otherwise select P 10 =LUT[1+1][3]. The weight of each vertex is the area of the corresponding triangle, calculated as w0=WL y , w1=L y -L x , and w2=L x , where W = 2 4 = 16 (sampling interval). Finally, the output value is calculated as a weighted sum, that is: It should be noted that the value in [] after LUT represents the index coordinate in the mapping table.
[0059] Similarly, 4-dimensional interpolation can be extended to 4-dimensional space through 2-dimensional interpolation. According to the value of the low-significant bit and the value of the high-significant bit (L of I0, I1, I2, I3 respectively) x , L y , L z , L t ), selects a matching case out of a total of 24 cases, and then calculates the output value as a weighted sum:
[0060]
[0061] Where W is the sampling interval, which is the same as the above sampling interval, w i is the weight, O i The coordinate value in the mapping table according to the value of the high-significant bit.
[0062] In order to better implement the embodiments of the present application, in one embodiment of the present application, the method further includes:
[0063] Acquire each training image; train the target image processing model based on the training images, and obtain a trained target image processing model; determine the corresponding results between the pixel information of the input image and the output information based on the trained target image processing model, and the corresponding results are used to determine the target processing result information based on the pixel information.
[0064] The above embodiment provides a method for utilizing a mapping table to assist lightweight devices in performing certain image processing functions, thereby preventing lightweight devices from being unable to perform image processing or image recognition due to insufficient computing power. Determining the mapping table also requires training a corresponding target image processing model, so the present embodiment also provides a method for training this model.
[0065] Specifically, in the embodiment of the present application, the target image processing model can be a deep network consisting of 6 convolutional layers. Except for the last layer, each layer uses the ReLU activation function. The convolution kernel size of the first layer is 2×2, and the kernel size of the remaining layers is set to 1×1. The number of features in the convolution layer is 64, and the number of features c in the last layer can be set according to different task types and requirements. Specifically, Figure 3 , Figure 3 The model structure of the target image processing model of the present application is shown. At the same time, in order to further improve the receptive field of the target image processing model, the embodiment of the present application can also use a receptive field augmentation system. The four receptive field augmentation systems with augmentation angles of 0 degrees, 90 degrees, 180 degrees and 270 degrees respectively cover a total of 9 (3×3) pixels. The outputs of each of the four augmentations are added together to generate the final output. The final output It can be expressed as follows:
[0066]
[0067] Among them, x i is the input image patch, f is the deep neural network, R j It is the operation of expanding the image block to j×90 degrees. It is the reverse augmentation operation.
[0068] After determining the model architecture and the corresponding receptive field augmentation system training method, the model training can be completed. Finally, after the model training is completed, the model extracts the pixel features of the image and the corresponding output parameters each time, and constructs a mapping table.
[0069] In order to better implement the embodiments of the present application, in one embodiment of the present application, the method further includes:
[0070] The target processing result information is compared with each preset image classification result information, and an image classification result information matching the target processing result information is obtained as the target image classification result information; according to the target image classification result information, image recognition is performed on the target input image.
[0071] The above embodiment provides a method for outputting the output results corresponding to the pixel information of the target input image according to the mapping table. After integrating the output results corresponding to the pixel information, a specific image recognition result can be output, such as object recognition in some image recognition tasks.
[0072] Specifically, after the target processing result information of the image is determined according to the above embodiment, it is equivalent to obtaining the output result corresponding to the image according to the mapping relationship. For example, assuming that the image is actually an apple image, a specific feature information is output according to each pixel of the image and the mapping table, such as a target vector for interpreting the image. At this time, the target vector can be compared with each image classification result information. Among them, the image classification result information can also be various preset vector information. At this time, the comparison method can be to calculate the similarity between the two vectors, such as the Euclidean distance, etc., to determine the similarity between the target vector and the vector corresponding to each image classification result information, thereby determining a vector with the highest similarity. The target image classification result information corresponding to the vector with the highest similarity is ultimately used to determine the actual classification of the image. For example, if the label of the target image classification result information corresponds to an apple, then the final recognition result of the target image is an apple, and the entire image recognition process is completed.
[0073] In order to better implement the image processing method in the embodiment of the present application, in addition to the image processing method, the embodiment of the present application also provides an image processing device, such as Figure 4 As shown, the apparatus 300 includes:
[0074] An acquisition module 301 is used to acquire a target input image;
[0075] A first determining module 302 is configured to determine pixel information based on a target input image;
[0076] The second determining module 303 is configured to determine target processing result information based on the pixel information.
[0077] In the image processing device provided by the present application, the acquisition module 301 can acquire a specific input image, and then the first determination module 302 can determine the pixel values of each pixel point in the specific image based on the image, and then the parameters of different pixel values can be determined through the second determination module 303, so as to compare the parameters of the acquired pixel values with each set of parameters in the mapping table. If it is determined that there is a parameter in the mapping table that is the same as or matches the parameter of the pixel value of the input image, the corresponding output can be determined according to the mapping table. There is no need for the model to go through various complex calculations, which reduces the computing cost. Therefore, this method can be deployed in some devices with lower computing power.
[0078] In some embodiments of the present application, the second determining module 303 is specifically configured to:
[0079] When the target pixel information has a preset output relationship, the target output information is determined according to the preset output relationship; or, when the target pixel information does not have a preset output relationship, the target output information is determined according to the target pixel information; wherein the target pixel information is determined according to the pixel information of each pixel point in the target input image;
[0080] The target processing result information is obtained according to the target output information.
[0081] In some embodiments of the present application, the second determining module 303 is further configured to:
[0082] Matching the target pixel information with each input parameter information in the preset output relationship, and obtaining a target input parameter information that matches the target pixel information from each input parameter information;
[0083] The output information corresponding to the target input parameter information is determined as the target output information.
[0084] In some embodiments of the present application, the second determining module 303 is further configured to:
[0085] determining first pixel information and second pixel information from the target pixel information according to the bit data of the target pixel information;
[0086] Corresponding target output information is determined according to the first pixel information and the second pixel information.
[0087] In some embodiments of the present application, the second determining module 303 is further configured to:
[0088] Determine the number of bits of target pixel information;
[0089] According to the number of bits, first bit data and second bit data in the bit data are determined, wherein the first bit data corresponds to first pixel information of the target pixel information, and the second bit data corresponds to second pixel information of the target pixel information.
[0090] In some embodiments of the present application, the second determining module 303 is further configured to:
[0091] Determining a first pixel value corresponding to the first pixel information according to the first pixel information;
[0092] Comparing the first pixel value with each sampled pixel value to obtain a target sampled pixel value that matches the first pixel value as initial output information;
[0093] determining, according to the second pixel information, a second pixel value corresponding to the second pixel information;
[0094] Determining weight information according to the second pixel value and the number of target sample pixel values;
[0095] According to the initial output information and weight information, the corresponding target output information is determined.
[0096] In some embodiments of the present application, the image processing apparatus may further include a training module, which is specifically configured to:
[0097] Obtain each training image;
[0098] According to the training image, the target image processing model is trained, and a trained target image processing model is obtained;
[0099] According to the trained target image processing model, the correspondence between the pixel information of the input image and the output information is determined, and the correspondence is used to determine the target processing result information based on the pixel information.
[0100] In some embodiments of the present application, the image processing device may also be used to:
[0101] Comparing the target processing result information with each image classification result information, and obtaining an image classification result information that matches the target processing result information as the target image classification result information;
[0102] Image recognition is performed on the target input image based on the target image classification result information.
[0103] The present application also provides a terminal device, which includes a processor, a memory, and a computer program stored in the memory and executable on the processor. The processor executes the computer program to implement the steps of any image processing method in the present application. The terminal device integrates any image processing method provided in the present application. Figure 5 , which shows a schematic diagram of the structure of the terminal device involved in the embodiment of the present application, specifically:
[0104] The terminal device may include one or more processing core processors 401, one or more computer-readable storage media memories 402, a power supply 403, an input unit 404 and other components. Those skilled in the art will understand that Figure 5 The terminal device structure shown in the figure does not constitute a limitation on the terminal device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange components differently.
[0105] Processor 401 is the control center of the terminal device. It connects the various components of the entire terminal device using various interfaces and lines. By running or executing software programs and / or modules stored in memory 402 and accessing data stored in memory 402, it performs various functions of the terminal device and processes data, thereby monitoring the terminal device as a whole. Optionally, processor 401 may include one or more processing cores. Processor 401 may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor. Preferably, processor 401 may integrate an application processor and a modem processor, wherein the application processor primarily processes the operating system, user interface, and application programs, while the modem processor primarily handles wireless communications. It is understood that the modem processor may not be integrated into processor 401.
[0106] The memory 402 can be used to store software programs and modules. The processor 401 executes various functional applications and data processing by running the software programs and modules stored in the memory 402. The memory 402 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the terminal device, etc. In addition, the memory 402 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage device. Accordingly, the memory 402 may also include a memory controller to provide the processor 401 with access to the memory 402.
[0107] The terminal device also includes a power supply 403 for supplying power to various components. Preferably, the power supply 403 can be logically connected to the processor 401 via a power management system, thereby enabling the power management system to manage charging, discharging, and power consumption. The power supply 403 can also include one or more DC or AC power supplies, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and other arbitrary components.
[0108] The terminal device may further include an input unit 404, which may be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.
[0109] Although not shown, the terminal device may further include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 401 in the terminal device will load the executable files corresponding to the processes of one or more application programs into the memory 402 according to the following instructions, and the processor 401 will run the application programs stored in the memory 402 to implement various functions, such as:
[0110] Get the target input image;
[0111] Determine pixel information based on the target input image;
[0112] Based on the pixel information, target processing result information is determined.
[0113] Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be accomplished by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0114] To this end, an embodiment of the present application provides a computer-readable storage medium, which may include a read-only memory (ROM), a random access memory (RAM), a disk, or an optical disk. A computer program is stored on the computer-readable storage medium, and the computer program is loaded by a processor to execute the steps of any of the image processing methods provided in the embodiments of the present application. For example, the computer program loaded by the processor may execute the following steps:
[0115] Get the target input image;
[0116] Determine pixel information based on the target input image;
[0117] Based on the pixel information, target processing result information is determined.
[0118] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, please refer to the detailed description of other embodiments above and will not be repeated here.
[0119] In specific implementation, the above units or structures can be implemented as independent entities, or can be arbitrarily combined to implement as the same or several entities. The specific implementation of the above units or structures can refer to the previous method embodiments and will not be repeated here.
[0120] The specific implementation of the above operations can be found in the previous embodiments and will not be repeated here.
[0121] The above is a detailed introduction to an image processing method and device provided in the embodiments of the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for those skilled in the art, based on the ideas of the present application, there may be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. An image processing method, characterized in that: The method comprises: Get the target input image; Determining pixel information based on the target input image; Based on the pixel information, target processing result information is determined.
2. The image processing method according to claim 1, wherein: Determining target processing result information based on the pixel information includes: When a preset output relationship exists for the target pixel information, the target output information is determined according to the preset output relationship; or, when the preset output relationship does not exist for the target pixel information, the target output information is determined according to the target pixel information; wherein the target pixel information is determined according to pixel information of each pixel in the target input image; The target processing result information is obtained according to the target output information.
3. The image processing method according to claim 2, wherein: When the target pixel information has a preset output relationship, determining the target output information according to the preset output relationship includes: Matching the target pixel information with each input parameter information in the preset output relationship, and obtaining a target input parameter information that matches the target pixel information from each input parameter information; The output information corresponding to the target input parameter information is determined as the target output information.
4. The image processing method according to claim 2, wherein: The determining the target output information according to the target pixel information includes: determining first pixel information and second pixel information from the target pixel information according to the bit data of the target pixel information; Corresponding target output information is determined according to the first pixel information and the second pixel information.
5. The image processing method according to claim 4, characterized in that The determining the first pixel information and the second pixel information from the target pixel information according to the bit data of the target pixel information includes: Determining the number of bits of the target pixel information; According to the number of bits, first bit data and second bit data in the bit data are determined, wherein the first bit data corresponds to first pixel information of the target pixel information, and the second bit data corresponds to second pixel information of the target pixel information.
6. The image processing method according to claim 4, wherein: The determining corresponding target output information according to the first pixel information and the second pixel information includes: Determining, based on the first pixel information, a first pixel value corresponding to the first pixel information; comparing the first pixel value with each sampled pixel value to obtain a target sampled pixel value that numerically matches the first pixel value as initial output information; determining, based on the second pixel information, a second pixel value corresponding to the second pixel information; and determining weight information based on the second pixel value and the number of the target sampled pixel values; According to the initial output information and the weight information, corresponding target output information is determined.
7. The image processing method according to claim 1, wherein: The method further comprises: Comparing the target processing result information with each preset image classification result information, and obtaining an image classification result information that matches the target processing result information as the target image classification result information; Image recognition is performed on the target input image according to the target image classification result information.
8. An image processing device, characterized in that: The device comprises: An acquisition module is used to acquire a target input image; A first determining module, configured to determine pixel information based on the target input image; A second determining module is used to determine target processing result information based on the pixel information; Preferably, the second determining module determines target processing result information based on the pixel information, including: When a preset output relationship exists for the target pixel information, the target output information is determined according to the preset output relationship; or, when the preset output relationship does not exist for the target pixel information, the target output information is determined according to the target pixel information; wherein the target pixel information is determined according to pixel information of each pixel in the target input image; Obtaining the target processing result information according to the target output information; Preferably, when the preset output relationship exists in the target pixel information, the second determining module determines the target output information according to the preset output relationship, including: Matching the target pixel information with each input parameter information in the preset output relationship, and obtaining a target input parameter information that matches the target pixel information from each input parameter information; Determining output information corresponding to the target input parameter information as target output information; Preferably, the second determining module determines the target output information based on the target pixel information, including: determining first pixel information and second pixel information from the target pixel information according to the bit data of the target pixel information; determining corresponding target output information according to the first pixel information and the second pixel information; Preferably, the second determining module, based on dividing the target pixel information into first pixel information and second pixel information, includes: Determining the number of bits of the target pixel information; Determining, according to the number of bits, first bit data and second bit data in the bit data, wherein the first bit data corresponds to first pixel information of the target pixel information, and the second bit data corresponds to second pixel information of the target pixel information; Preferably, the second determining module determines corresponding target output information based on the first pixel information and the second pixel information, including: determining, according to the first pixel information, a first pixel value corresponding to the first pixel information; Comparing the first pixel value with each sampled pixel value to obtain a target sampled pixel value that matches the first pixel value as initial output information; determining, according to the second pixel information, a second pixel value corresponding to the second pixel information; Determining weight information according to the second pixel value and the number of the target sampled pixel values; Determining corresponding target output information according to the initial output information and the weight information; Preferably, the second determining module is further configured to: Comparing the target processing result information with each preset image classification result information, and obtaining an image classification result information that matches the target processing result information as the target image classification result information; Image recognition is performed on the target input image according to the target image classification result information.
9. A terminal device, characterized in that: The terminal device includes a processor, a memory, and a computer program stored in the memory and executable on the processor, and the processor executes the computer program to implement the steps of the image processing method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the steps of the image processing method according to any one of claims 1 to 7.