A method for obtaining realistic color background images in adaptive camouflage devices
Through white balance, lighting correction and KNN classification algorithms, the problem of inaccurate background image color in traditional adaptive camouflage technology is solved, and efficient camouflage effect is achieved in changing environments.
Patent Information
- Application Number
- CN202411003273.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-25
- Publication Date
- 2024-11-05
- Estimated Expiration
- 2044-07-25
AI Technical Summary
Traditional adaptive camouflage technology cannot obtain the true color of the background image, resulting in poor camouflage effect when the external environment changes.
Take a white background board image through a white balance camera, correct lens defects, perform uneven lighting correction and noise cancellation, use the HSV color space enhancement algorithm and KNN classification algorithm to obtain the real RGB three-channel value of the background color block, and generate a camouflage image driver power Color-causing array.
Improve the accuracy of color recognition, obtain the true color of the background image, and avoid camouflage failure caused by changes in the external environment.
Smart Images

Figure CN118552457B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing and analysis, and in particular to a method for obtaining a real color background image in an adaptive camouflage device. Background Art
[0002] Due to the wide range, long distance and changing combat environment in modern military, the traditional camouflage cloth with fixed pattern cannot meet the requirements of good camouflage in various environments. In order to enable the camouflaged target to be camouflaged in a changing environment in real time, adaptive camouflage technology based on various color-changing materials has begun to attract people's attention. Adaptive camouflage technology controls the change of camouflage color by detecting the background image to generate the driving signal of the color-changing material, so obtaining a clear and accurate background image is an important part of adaptive camouflage technology.
[0003] Traditionally, background images are acquired by taking pictures with a camera and segmenting the images according to the arrangement of the color-changing material array. An averaging algorithm is applied to each segmented part to calculate the color average as a driving signal. However, usually due to changes in the external lighting environment and the influence of shadows when the lens is shooting, the driving signal obtained by the color-changing material often cannot reflect the true color of the actual background image, which will result in a poor camouflage effect when the external lighting or shadow changes. Summary of the invention
[0004] In order to solve the problem that the real color of the background image cannot be obtained in the prior art, resulting in poor camouflage effect when the external environment changes, the purpose of the present invention is to provide a method for obtaining a real color background image in an adaptive camouflage device.
[0005] The technical solution adopted by the present invention is specifically as follows:
[0006] A method for obtaining a real color background image in an adaptive camouflage device, the method comprising the following steps:
[0007] The camera is white-balanced according to the set image brightness, and a white background plate image is taken and stored in a computer; an arbitrary color card array image is taken with the white-balanced camera as an initial background color block image; and the initial background color block image is stored in a computer;
[0008] Performing camera lens defect correction according to the white background plate image stored in the computer to obtain a brightness gain matrix, performing bilinear interpolation on the brightness gain matrix to obtain a full-pixel brightness gain matrix; processing the initial background color block image stored in the computer according to the full-pixel brightness gain matrix to obtain a background color block image corrected for uneven illumination;
[0009] Converting the background color block image after the illumination unevenness correction into a grayscale image; converting the grayscale image into a binary image by using an adaptive threshold method; obtaining a color block coordinate matrix of the background color block image by eliminating noise and sorting color blocks according to the binary image;
[0010] Extracting RGB three-channel values of color blocks in a range centered on the coordinates in the background color block image according to the color block coordinate matrix; converting the extracted RGB three-channel values into an HSV color space to improve the difference between similar colors through an enhancement algorithm, and then converting from the HSV color space to the RGB color space to obtain an enhanced RGB three-channel image;
[0011] A machine learning model corresponding to the standard camouflage color is obtained through the KNN classification algorithm according to the enhanced RGB three-channel image; and an image of a randomly arranged color block array taken by a camera is processed through the machine learning model to obtain a camouflage image that drives the electrochromic array to change color.
[0012] Further, the steps of performing camera lens defect correction according to the white background plate image stored in the computer to obtain a brightness gain matrix, and performing bilinear interpolation on the brightness gain matrix to obtain a full-pixel brightness gain matrix include:
[0013] According to the white background image stored in the computer, the image is divided into d parts horizontally through d-1 dividing lines, and the image is divided into d parts vertically through d-1 dividing lines to obtain the white background image after segmentation, and the value of d is an even number; according to the white background image after segmentation, the segmented image is obtained through the dividing lines, and the segmented image is divided into three channels of RGB for separate processing, and a dividing line intersection at the center position is selected as a reference brightness value; according to the reference brightness value, the gain of the brightness value at each dividing line intersection to the reference brightness value is calculated to obtain a brightness gain matrix with the same number of elements as the number of dividing points, and bilinear interpolation is performed on the brightness gain matrix, and the brightness gain matrix is expanded to the corresponding gain of each pixel point on the entire image to obtain a full-pixel brightness gain matrix.
[0014] Furthermore, the step of obtaining a color block coordinate matrix of a background color block image by eliminating noise and sorting color blocks according to the binary image includes:
[0015] The snowflake noise in the binary image is eliminated by the morphological opening method to obtain a binary image containing only color block information;
[0016] The connected domain is judged based on the binary image of the color block after the snowflake noise is eliminated, and the color blocks forming the connected domain in the background color block image are preliminarily numbered, that is, one connected domain corresponds to only one number;
[0017] According to the background color block image with preliminary numbering, pixel values are obtained row by row scanning; when the number of color blocks corresponding to the row of pixels on the background color block image obtained by row scanning is the same as the number of columns of the electrochromic array, the color blocks corresponding to the row of pixels are sorted, and the arrangement order increases from top to bottom and from left to right;
[0018] The centroid coordinates of each color block in the sorted background color block image are extracted to generate a color block coordinate matrix.
[0019] Furthermore, the difference between similar colors is improved by converting the extracted RGB three-channel values into the HSV color space through an enhancement algorithm, including: extracting the HSV three-channel values in the HSV color space, and performing image enhancement through a gain coefficient set by a host computer.
[0020] Further, the step of obtaining a machine learning model corresponding to a standard camouflage color through a KNN classification algorithm according to the enhanced RGB three-channel values; and processing an image of a randomly arranged color block array taken by a camera through the machine learning model to obtain a camouflage image to drive the electrochromic array to change color includes:
[0021] According to the enhanced RGB three-channel image, the RGB three-channel value at the coordinate position is obtained through the color block coordinate matrix; according to the RGB three-channel value at the coordinate position, the input standard camouflage color corresponds to the RGB three-channel value at the coordinate position, a training set of the KNN classification algorithm is obtained, and the KNN classification algorithm is trained to obtain a machine learning model; the camera is controlled to obtain an image of a randomly arranged color block array as a background color block image, and after uneven illumination correction, noise elimination, color block sorting, and image enhancement, a randomly arranged color block image with color correction to the standard camouflage color is obtained through the machine learning model; according to the randomly arranged color block image with color correction to the standard camouflage color, a data string corresponding to the electrochromic array and compliant with the communication protocol is obtained through the color block coordinate matrix, so as to control the color change of the electrochromic array through the serial port.
[0022] Furthermore, the enhanced RGB three-channel image is subjected to two-dimensional Wiener filtering on the RGB three channels respectively.
[0023] The present invention has the following beneficial effects:
[0024] In the present invention, controlling the exposure time and white balance of the camera can reduce the impact of large external lighting changes, obtain an image with moderate brightness, and preliminarily improve the accuracy of color recognition. Obtaining a correction matrix based on the white background plate image can correct the inherent uneven lighting defects of the lens and obtain an image with uniform brightness. Obtaining a binary image of the color block based on the morphological opening method (Otsu threshold) can effectively eliminate the snow noise that appears during shooting; according to the connected domain judgment and the color block sorting algorithm, the coordinate matrix of the captured color block can be obtained according to the arrangement order of the electrochromic array. According to the HSV enhancement algorithm, the error of recognition confusion caused by similar color blocks can be avoided, and the accuracy of color recognition can be further improved. According to the KNN classification algorithm, the captured image color block can be mapped to the standard color to obtain the true color of the background color block image, thereby improving the camouflage effect.
[0025] The method of the present invention can obtain the real color of the background image, can obtain the real color of the background color block under external lighting conditions, and avoid the situation where the camouflage fails due to changes in the external environment. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0027] Figure 1 A flow chart of a method for obtaining a real color background image in an adaptive camouflage device provided by an example of the present invention. DETAILED DESCRIPTION
[0028] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. Although certain embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be interpreted as being limited to the embodiments described herein. On the contrary, these embodiments are provided to provide a more thorough and complete understanding of the present invention. It should be understood that the drawings and embodiments of the present invention are only for exemplary purposes and are not intended to limit the scope of protection of the present invention.
[0029] It should be understood that the various steps described in the method embodiments of the present invention may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present invention is not limited in this respect.
[0030] The term "including" and its variations used in this document are open inclusions, that is, "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one other embodiment"; the term "some embodiments" means "at least some embodiments"; the term "optionally" means "optional embodiments". Relevant definitions of other terms will be given in the following description. It should be noted that the concepts of "first", "second", etc. mentioned in the present invention are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0031] It should be noted that the modifications of "one" and "plurality" mentioned in the present invention are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0032] A specific solution of a method for obtaining a real color background in an adaptive camouflage device provided by the present invention is described in detail below with reference to the accompanying drawings.
[0033] See also Figure 1 , which shows a flow chart of a method for obtaining a real color background image in an adaptive camouflage device provided by an embodiment of the present invention, the method comprising the following steps:
[0034] According to the set image brightness, the camera is white balanced and a white background plate image is taken and stored in the computer; the color card array image of any color is taken with the white balanced camera as the initial background color block image; the initial background color block image is stored in the computer. A white background plate image and an initial background color block image with moderate brightness and normal white balance are obtained.
[0035] In an embodiment of the present invention, the implementation scenario is to identify a background color block image composed of color blocks of any color to obtain the real background color block image color. In particular, in one embodiment, a background color block image composed of four camouflage colors (RGB values are: 136, 134, 127; 108, 94, 87; 105, 112, 64; 77, 96, 61) of the camouflage paint film color is selected to identify the real background color block image color. Since the arrangement of the electrochromic array is an m*n array, the four camouflage colors are randomly arranged in an m*n array to form a background color block image. In particular, in one embodiment, m is set to 3 and n is set to 4 to form a 3*4 array background color block image. First, a white background image and an initial background color block image with moderate brightness and normal white balance are obtained. The image can be obtained by shooting with a general CMOS color industrial camera. The different exposure times of the camera will cause the captured image to have too high brightness, i.e., overexposure, and too low brightness, i.e., underexposure, resulting in a decrease in image quality and affecting subsequent image processing; at the same time, a camera that has not undergone white balance will have a large color deviation when shooting, which will lead to confusion in subsequent color recognition. Since under general conditions, industrial cameras require professional software for parameter setting and shooting control, in order to use the present invention to control camera parameters, in the embodiment of the present invention, Visual Studio 2019 software under the Windows platform is selected to perform secondary development on the industrial camera, and the shooting trigger of the industrial camera is set to software trigger and an image brightness and white balance control interface is provided to connect to the host computer, wherein the image brightness control adopts an automatic exposure mode, and the image brightness value input by the host computer automatically sets the appropriate exposure time to obtain the image; the image white balance adopts automatic white balance, and the white balance correction matrix is obtained by correcting the captured white background image to white, and the subsequent image shooting is corrected.
[0036] Perform camera lens defect correction according to the white background plate image stored in the computer to obtain a brightness gain matrix, interpolate the brightness gain matrix to obtain a full-pixel brightness gain matrix; process the initial background color block image stored in the computer according to the full-pixel brightness gain matrix to obtain a background color block image after uneven illumination correction;
[0037] During the image acquisition process of industrial cameras, due to the optical characteristics of the lens, the light intensity received by the edge area of the image sensor is smaller than that received by the center area, which will cause the brightness at the edge of the captured image to decrease while the brightness at the middle of the image is the set normal exposure brightness. As a result, the color blocks at the edge of the captured image are affected by the reduced brightness, resulting in a large difference in the captured color due to the order of the color blocks, which in turn affects the color judgment during subsequent color recognition. The brightness at the center of the captured white background image is the set normal exposure brightness, so the brightness value at the center of the image can be used as a reference to correct the low brightness at the edge of the image.
[0038] Preferably, in one embodiment of the present invention, correcting the uneven illumination of an image includes: dividing the image into multiple parts by segmentation according to the acquired white background plate image with moderate brightness and normal white balance; in the embodiment of the present invention, the number of the segments is n, that is, the image is divided into d parts by d-1 segmentation lines in the horizontal direction and d parts by d-1 segmentation lines in the vertical direction. It should be noted that the value of d needs to be an even number to ensure that the intersection of the segmentation lines is the center of the image. The implementer can determine the number of segments according to the implementation scenario. In particular, in one embodiment, let d be 16 to divide the image into 16 parts in the horizontal and vertical directions respectively. When the number of segments is more, it means that the brightness uniformity matrix is more refined, and the uneven illumination correction effect is better, but it will bring about the problem of increased calculation amount and slow program operation. The segmented image is divided into three RGB channels and processed separately. A segmentation line intersection at the center position is selected as the reference brightness value, and the gain of the brightness value at each remaining segmentation line intersection to the reference brightness value is calculated, thereby obtaining a brightness gain matrix with the same number of elements as the number of segmentation points. In order to expand the brightness gain matrix to the corresponding gain of each pixel point on the entire image, the brightness gain matrix is bilinearly interpolated to obtain a full-pixel brightness gain matrix. It should be noted that the bilinear interpolation algorithm belongs to the prior art, and the specific interpolation steps are not repeated here. In the present invention, the bilinear interpolation algorithm is used to obtain the brightness gain matrix, and the implementer can determine to use other interpolation methods to meet the scene requirements according to the implementation scenario.
[0039] The background color block image after the illumination unevenness correction is converted into a grayscale image; the grayscale image is converted into a binary image through an adaptive threshold method; and the color block coordinate matrix of the background color block image is obtained through noise elimination and color block sorting according to the binary image.
[0040] After the illumination unevenness correction is performed according to the brightness gain matrix, the background color block image color block can be extracted to correspond to the order of the electrochromic array; due to the influence of the external environment illumination changes and shadows, after processing the image illumination unevenness caused by the lens, a small part of black noise will usually still appear on the image, resulting in abnormal points in the order of the color blocks that cannot meet the requirements of the same order as the electrochromic array; therefore, it is necessary to eliminate the noise of the image after the illumination unevenness correction. First, the image is binarized to obtain the noise information, and the image noise is removed according to the morphological opening method to obtain a color block binary image containing only the color block position information.
[0041] Preferably, in one embodiment of the present invention, the background color block image after the illumination unevenness correction is converted into a grayscale image; the grayscale image is converted into a binary image by an adaptive threshold method; specifically, the background color block image after the illumination unevenness correction is converted into a single-channel image with a grayscale value in the range of 0-255, and the threshold value of the image binarization is calculated according to the adaptive threshold algorithm (Otsu threshold segmentation algorithm); it should be noted that the Otsu threshold segmentation algorithm belongs to the prior art, and the specific threshold solution steps are not repeated; in the present invention, the threshold obtained according to the threshold segmentation algorithm is used as a basis for image binarization. According to the binarized image, the morphological opening operation is applied to eliminate the noise points. In the present invention, the threshold value for judging whether the part with a value of 1 in the binary image is a noise point is L, that is, the part with a value of 1 in the binary image with a number of pixels less than L is regarded as a noise point and eliminated. The implementer can determine the noise point threshold value according to the implementation scenario. In particular, in one embodiment, L is taken as 25 as the threshold value for judging the noise point. When the noise in the preview binary image is large, the noise threshold can be increased, but it should be noted that the noise threshold should not be too large, otherwise the color blocks in the image may be identified as noise.
[0042] Further, color blocks are sorted according to the binary image after noise removal to obtain a color block coordinate matrix of the background color block image, specifically including: judging a connected domain according to the binary image after noise removal, and preliminarily numbering the color blocks forming a connected domain in the background color block image, that is, a connected domain corresponds to only one number. Since the value corresponding to each pixel point in the binary image has only two cases of 1 or 0, it can be judged by the values of the eight adjacent pixels of each pixel. In the present invention, the connected domain judgment is performed on the pixels with a pixel value of 1, and each pixel in the binary image is scanned. If the pixel has a connected domain with one or more of its eight adjacent pixels, If the pixel value is the same, the pixel and the adjacent pixels with the same value are grouped into a connected domain and labeled. If the pixel value is 1 and is not labeled, and there is a pixel with a value of 1 but no label among its connected pixels, the pixel and the adjacent pixels with the same value are grouped into another connected domain and labeled. In the present invention, since the electrochromic array is arranged in m*n order, the color blocks are numbered up to m*n. If the color block number is greater than m*n, the noise elimination process is re-performed to eliminate the noise that was not processed and mislabeled before. The implementer can determine the color block number according to the implementation scenario, and only needs to ensure that the number of color blocks is the same as the number of the electrochromic array. After completing the connected domain judgment and labeling, since the captured background color block image may have an image tilt phenomenon that causes the labels to be unable to be arranged in the order of the electrochromic array, it is necessary to recalibrate the color block numbering. In the present invention, a line scanning method is used to scan the background color block image line by line. If n different labels appear in a row during the scanning process, it means that the row passes through n color blocks. The color block labels that the row passes through are reordered in ascending order from left to right to correspond to the electrochromic array order. At the same time, the color block labels after the row is sorted are recorded to facilitate determining the starting number of the second row of color blocks in subsequent row scanning. After the above sorting is completed, a background color block image with the same sorting as the electrochromic array is obtained, and the centroid position coordinates of the background color block image are extracted to determine the color block coordinate matrix.
[0043] The RGB three-channel values of the color blocks in the background color block image within the range centered on the coordinates are extracted according to the color block coordinate matrix; and the enhanced RGB three-channel values are obtained by improving the differences between similar colors through an enhancement algorithm according to the extracted RGB three-channel values.
[0044] In the embodiment of the present invention, the RGB three-channel values of the four camouflage colors that meet the color of the camouflage paint film are similar. When the external environment lighting changes, the four colors may be confused. When the camera is shooting, the four colors may not be clearly distinguished in the captured image, which affects the subsequent color recognition accuracy. Therefore, it is necessary to enhance the captured background color block image to improve the difference between the four colors. In the field of color segmentation, in order to distinguish the difference between colors, the HSV color space is usually used for judgment, where H represents hue, S represents saturation, and V represents brightness; therefore, based on this idea, the hue, saturation and brightness between different colors can be changed by adjusting the gain of the three HSV channels of the image to improve the difference between similar colors.
[0045] Preferably, in one embodiment of the present invention, the RGB three-channel values of the color blocks in the range centered on the coordinates in the background color block image are extracted by the color block coordinate matrix, which is the RGB color space color block image arranged in the same manner as the electrochromic array; the RGB three-channel values of the arranged RGB color space color block image are converted into the HSV color space, and the HSV three-channel values are extracted in the HSV color space respectively, and the image is enhanced by different gain coefficients, and the different gain coefficients are the gain coefficients set by the host computer; after multiple experimental tests, in the embodiment of the present invention, the H hue gain coefficient is set to q, the S saturation gain coefficient is set to w, and the V brightness gain coefficient is set to e. The implementer can determine the HSV three-channel gain coefficient according to the implementation scenario. In particular, in one embodiment, the H hue gain coefficient is set to 4, the S saturation gain coefficient is set to 6, and the V brightness gain coefficient is set to 1.8. According to the enhanced HSV color space image, the enhanced RGB three-channel image is obtained by the color space conversion algorithm. It should be noted that the color space conversion algorithm belongs to the prior art, and the specific conversion steps are not repeated.
[0046] The enhanced RGB three-channel image is used to obtain a machine learning model corresponding to the standard camouflage color through the KNN classification algorithm; according to the machine learning model, a camouflage image is obtained by shooting a randomly arranged color block array with a camera to drive the electrochromic array to change color.
[0047] The color block image after image enhancement can already better distinguish the four camouflage colors that match the color of the camouflage paint film. However, since the hue, saturation and brightness of the image have been processed and have changed significantly compared to the initial unprocessed image, the image color shift is obvious. Therefore, it is necessary to use a classification algorithm to reclassify the shifted colors into the four camouflage colors. Based on this idea, the KNN classification algorithm can be used to calculate the relationship between the enhanced color block color and the standard camouflage color to obtain a color block image with a standard color.
[0048] Preferably, in one embodiment of the present invention, since there is a certain amount of Gaussian noise in the RGB three-channel image after enhancement, the RGB three-channel image is subjected to two-dimensional Wiener filtering to eliminate noise on the RGB three channels after obtaining the enhanced image to avoid the influence of noise on subsequent color processing. In the embodiment of the present invention, the Vienna filter neighborhood size is set to o*p, and the implementer can determine it according to the implementation scenario. In particular, after many experiments, in one embodiment, the values of o and p are both 6 to achieve better filtering effect. According to the obtained Wiener filtered image, the RGB three-channel value at the coordinate position is obtained through the color block coordinate matrix. According to the RGB three-channel value at the coordinate position, the input standard camouflage color corresponds to the RGB three-channel value at the coordinate position to obtain the training set of the KNN classification algorithm. In order to consider the software processing data, reduce the amount of calculation and ensure good training effect at the same time, in the embodiment of the present invention, each coordinate point in the color block coordinate matrix is taken as the center, and each color block range is extracted as x*y data points. The whole color block image contains m*n color blocks, so the data extracted as the training set is m*n*x*y in total; the above data is divided into m*n parts, each part corresponds to a color label, and each color label corresponds to one of the standard colors to form a training set table and send it to the KNN classification algorithm for learning; the implementer can determine the amount of data and the number of labels of the above training set according to the implementation scenario. In particular, after multiple experimental tests, in one embodiment, when x and y are taken as 35, there is a better training effect and a shorter program running time. The larger the amount of training set data, the better the learning effect of the KNN classification algorithm and the more accurate the color recognition. However, since the KNN classification algorithm traverses all data for classification each time, a larger training set will cause a sharp increase in training time and reduce the efficiency of program operation. After the training set is sent to the KNN classification algorithm, after multiple training tests, the K value in the KNN classification algorithm is set to k in the embodiment of the present invention, and k points around the color to be predicted are found as the predicted value of the color. The implementer can set the k value size according to the implementation scenario. In particular, in one embodiment, the k value is set to 1, that is, only the nearest point around the color to be predicted is found as the predicted value of the color; the classification distance of the KNN classification algorithm is set to the calculated Euclidean distance; the implementer can determine the above K value and distance calculation method according to the implementation scenario. The machine learning model obtained by learning the KNN classification algorithm based on the prepared training set is stored in the computer for subsequent color recognition.A randomly arranged color block image is used as a background color block image, and a camera is used to capture an initial image. After uneven illumination correction, noise elimination, color block sorting, and image enhancement, the machine learning model is used to identify the color by applying the machine learning model obtained by the KNN classification algorithm to obtain a randomly arranged color block image whose color is corrected to a standard camouflage color; based on the randomly arranged color block image whose color is corrected to a standard camouflage color, a data string that complies with the communication protocol and corresponds to the electrochromic array is obtained through a color block coordinate matrix, so as to control the color change of the electrochromic array through a serial port.
[0049] Yet another embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method for obtaining a real color background in an adaptive camouflage device as described above is implemented.
[0050] An electronic device that can be used as a server or client of the present invention will now be described, which is an example of a hardware device that can be applied to various aspects of the present invention. Electronic devices are intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. Electronic devices can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples, and are not intended to limit the implementation of the present invention described and / or required herein.
[0051] The electronic device includes a computing unit, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) or a computer program loaded from a storage unit into a random access memory (RAM). In the RAM, various programs and data required for the operation of the device can also be stored. The computing unit, ROM, and RAM are connected to each other through a bus. The input / output (I / 0) interface is also connected to the bus.
[0052] A computer system may include clients and servers. Clients and servers are generally remote from each other and typically interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship to each other.
[0053] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc. In the present application, the unit described as a separate component may or may not be physically separated, and the component displayed as a unit may or may not be a physical unit, that is, it may be located in one place, or it may be distributed on multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment of the present invention. In addition, each functional unit in each embodiment of the present invention can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
[0054] Although the disclosure is disclosed as above, the protection scope of the disclosure is not limited thereto. Those skilled in the art may make various changes and modifications without departing from the spirit and scope of the disclosure, and these changes and modifications will fall within the protection scope of the present invention.
Claims
1. A method for obtaining a true color background image in an adaptive camouflage device, It is characterized in that The method comprises the following steps: The camera is white-balanced according to the set image brightness, and a white background plate image is taken and stored in a computer; an arbitrary color card array image is taken with the white-balanced camera as an initial background color block image; and the initial background color block image is stored in a computer; Performing camera lens defect correction according to the white background plate image stored in the computer to obtain a brightness gain matrix, performing bilinear interpolation on the brightness gain matrix to obtain a full-pixel brightness gain matrix; processing the initial background color block image stored in the computer according to the full-pixel brightness gain matrix to obtain a background color block image corrected for uneven illumination; Converting the background color block image after the illumination unevenness correction into a grayscale image; converting the grayscale image into a binary image by using an adaptive threshold method; obtaining a color block coordinate matrix of the background color block image by eliminating noise and sorting color blocks according to the binary image; Extracting RGB three-channel values of color blocks in a range centered on the coordinates in the background color block image according to the color block coordinate matrix; converting the extracted RGB three-channel values into an HSV color space to improve the difference between similar colors through an enhancement algorithm, and then converting from the HSV color space to the RGB color space to obtain an enhanced RGB three-channel image; A machine learning model corresponding to the standard camouflage color is obtained through the KNN classification algorithm according to the enhanced RGB three-channel image; and an image of a randomly arranged color block array taken by a camera is processed through the machine learning model to obtain a camouflage image that drives the electrochromic array to change color.
2. A method for obtaining a true color background image in an adaptive camouflage device according to claim 1, It is characterized in that The steps of performing camera lens defect correction according to the white background plate image stored in the computer to obtain a brightness gain matrix, and performing bilinear interpolation on the brightness gain matrix to obtain a full-pixel brightness gain matrix include: According to the white background image stored in the computer, the image is divided into d parts horizontally through d-1 dividing lines, and the image is divided into d parts vertically through d-1 dividing lines to obtain the white background image after segmentation, and the value of d is an even number; according to the white background image after segmentation, the segmented image is obtained through the dividing lines, and the segmented image is divided into three channels of RGB for separate processing, and a dividing line intersection at the center position is selected as a reference brightness value; according to the reference brightness value, the gain of the brightness value at each dividing line intersection to the reference brightness value is calculated to obtain a brightness gain matrix with the same number of elements as the number of dividing points, and bilinear interpolation is performed on the brightness gain matrix, and the brightness gain matrix is expanded to the corresponding gain of each pixel point on the entire image to obtain a full-pixel brightness gain matrix.
3. A method for obtaining a real color background image in an adaptive camouflage device according to claim 1, It is characterized in that The step of obtaining a color block coordinate matrix of a background color block image by eliminating noise and sorting color blocks according to the binary image comprises: The snowflake noise in the binary image is eliminated by the morphological opening method to obtain a binary image containing only color block information; The connected domain is judged based on the binary image of the color block after the snowflake noise is eliminated, and the color blocks forming the connected domain in the background color block image are preliminarily numbered, that is, one connected domain corresponds to only one number; According to the background color block image with preliminary numbering, pixel values are obtained row by row scanning; when the number of color blocks corresponding to the row of pixels on the background color block image obtained by row scanning is the same as the number of columns of the electrochromic array, the color blocks corresponding to the row of pixels are sorted, and the arrangement order increases from top to bottom and from left to right; The centroid coordinates of each color block in the sorted background color block image are extracted to generate a color block coordinate matrix.
4. A method for obtaining a true color background image in an adaptive camouflage device according to claim 3, It is characterized in that The extracted RGB three-channel values are converted to the HSV color space to improve the difference between similar colors through the enhancement algorithm, including: extracting the HSV three-channel values in the HSV color space, and performing image enhancement through the gain coefficient set by the host computer.
5. A method for obtaining a real color background image in an adaptive camouflage device according to claim 1, It is characterized in that The steps of obtaining a machine learning model corresponding to the standard camouflage color by using a KNN classification algorithm according to the enhanced RGB three-channel values; and processing an image of a randomly arranged color block array taken by a camera by using the machine learning model to obtain a camouflage image to drive the electrochromic array to change color include: According to the enhanced RGB three-channel image, the RGB three-channel value at the coordinate position is obtained through the color block coordinate matrix; according to the RGB three-channel value at the coordinate position, the input standard camouflage color corresponds to the RGB three-channel value at the coordinate position, a training set of the KNN classification algorithm is obtained, and the KNN classification algorithm is trained to obtain a machine learning model; the camera is controlled to obtain an image of a randomly arranged color block array as a background color block image, and after uneven illumination correction, noise elimination, color block sorting, and image enhancement, a randomly arranged color block image with color correction to the standard camouflage color is obtained through the machine learning model; according to the randomly arranged color block image with color correction to the standard camouflage color, a data string corresponding to the electrochromic array and compliant with the communication protocol is obtained through the color block coordinate matrix, so as to control the color change of the electrochromic array through the serial port.
6. A method for obtaining a true color background image in an adaptive camouflage device according to claim 5, It is characterized in that After enhancement, the RGB three-channel image is subjected to two-dimensional Wiener filtering on the RGB three channels respectively.
Citation Information
Patent Citations
Correction method for non-uniform illumination of mahjong images based on figure classification
CN105447834A
Color text image correction method and system
CN106327437A
Method for enhancing camouflage target
CN118261808A
Image processing method for image distortion automatic correction
CN1937698A
Page background estimation using color, texture and edge features
US20060115153A1
