Day and night mode switching method, device and equipment of camera and medium
Principal component analysis was used to determine the day and night mode switching of the camera. By comprehensively considering multiple influencing factors, the problem of environmental change interference caused by the single judgment of light intensity in the existing technology was solved, and more accurate day and night mode switching was achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ZHEJIANG UNIVIEW TECH CO LTD
- Filing Date
- 2022-11-14
- Publication Date
- 2026-06-23
AI Technical Summary
In existing technologies, the switching of day and night modes of cameras relies solely on light intensity, which is easily affected by environmental changes, has limited applicability, and cannot effectively handle scenes within the light threshold range.
Principal component analysis is used to determine the target principal component based on historical data of multiple candidate parameters, and the day and night mode of the data to be tested is determined according to the day and night weights. By comprehensively considering multiple influencing factors, accurate switching can be achieved.
It effectively reduces the impact of environmental changes, improves the applicability and accuracy of the camera's day/night mode switching, and is suitable for various lighting conditions.
Smart Images

Figure CN116668842B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of camera technology, and in particular to a method, apparatus, device, and medium for switching day and night modes of a camera. Background Technology
[0002] For cameras, the sensor's ability to perceive light is limited. By changing exposure parameters, including aperture, shutter speed, and gain, the amount of light entering the sensor can be altered. Generally, reducing the amount of light in strong light and increasing it in weak light adjusts the sensor to a suitable level for better image quality. For example, turning on the fill light and increasing the gain at night, and turning it off and decreasing the gain during the day. However, in real-world environments, not all strong light scenarios require reducing the amount of light or turning off the fill light. For instance, when performing license plate recognition at night, if a vehicle's headlights are on and close to the camera, it can trigger the camera's day / night mode switch. The fill light's on / off state is often linked to this switch, causing it to turn off. In reality, the license plate receives insufficient light at this time, and turning off the fill light will result in a poorer image quality.
[0003] In related technologies, a threshold strategy is used to switch between day and night modes of a camera based on light intensity, thereby adjusting the amount of light entering the sensor. For example, when the light intensity is above a threshold Tl, the camera switches from night mode to day mode, and when it is below a threshold Th, it switches from day mode to night mode. Under this strategy, Tl and Th cannot be selected too closely, otherwise it may lead to repeated switching.
[0004] The above scheme relies solely on light intensity to determine day and night status, making it a single-source criterion and susceptible to interference and influence from environmental changes. Furthermore, this scheme can only switch between day and night modes for scenes with light levels above the threshold Tl and below the threshold Th, but it is not applicable to light scenes between Tl and Th, thus having significant limitations and failing to adequately meet practical application needs. Summary of the Invention
[0005] This invention provides a method, apparatus, device, and medium for switching day and night modes for a camera. It can simultaneously consider multiple factors affecting day and night modes, achieve precise switching of the camera's day and night modes, effectively reduce the impact of environmental changes, and improve the applicability of the day and night mode switching method.
[0006] According to one aspect of the present invention, a method for switching day and night modes of a camera is provided, the method comprising:
[0007] Based on principal component analysis, at least two target principal components are determined according to historical data of multiple candidate parameters; wherein, the historical data is determined based on historical images captured by a camera, and the target principal components include principal component coefficients corresponding to each candidate parameter;
[0008] The day and night weights of the target principal components are determined based on the historical data.
[0009] The day / night mode corresponding to the test data is determined based on the candidate parameters, the historical data, the target principal component, and the corresponding day / night weights; wherein the test data is determined based on the test images captured by the camera.
[0010] According to another aspect of the present invention, a day / night mode switching device for a camera is provided, comprising:
[0011] The target principal component determination module is used to determine at least two target principal components based on the principal component analysis method and historical data of multiple candidate parameters; wherein, the historical data is determined based on historical images captured by a camera, and the target principal components include principal component coefficients corresponding to each candidate parameter;
[0012] The day-night weight determination module is used to determine the day-night weight of the target principal component based on the historical data;
[0013] The day / night mode determination module is used to determine the day / night mode corresponding to the test data based on the test data and historical data of the candidate parameters, the target principal component, and the corresponding day / night weights; wherein the test data is determined based on the test image captured by the camera.
[0014] According to another aspect of the present invention, a day / night mode switching electronic device for a camera is provided, the electronic device comprising:
[0015] At least one processor; and
[0016] A memory communicatively connected to the at least one processor; wherein,
[0017] The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the day / night mode switching method for a camera according to any embodiment of the present invention.
[0018] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the day / night mode switching method of a camera according to any embodiment of the present invention.
[0019] The technical solution of this invention is based on principal component analysis (PCA). It determines at least two target principal components based on historical data of multiple candidate parameters. The historical data is determined from historical images captured by a camera. The target principal components include principal component coefficients corresponding to each candidate parameter. The day / night weights of the target principal components are determined based on the historical data. The day / night mode corresponding to the test data is determined based on the test data of the candidate parameters, the historical data, the target principal components, and the corresponding day / night weights. The test data is determined from the test images captured by the camera. This technical solution can simultaneously consider multiple factors influencing day / night modes, achieving precise switching of the camera's day / night mode, effectively reducing the impact of environmental changes, and improving the applicability of the day / night mode switching method.
[0020] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0021] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying 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 effort.
[0022] Figure 1 This is a flowchart of a day / night mode switching method for a camera according to Embodiment 1 of the present invention;
[0023] Figure 2 This is a flowchart of a day / night mode switching method for a camera according to Embodiment 2 of the present invention;
[0024] Figure 3 This is a schematic diagram of the structure of a day / night mode switching device for a camera according to Embodiment 3 of the present invention;
[0025] Figure 4 This is a schematic diagram of the structure of an electronic device that implements a day / night mode switching method for a camera according to an embodiment of the present invention. Detailed Implementation
[0026] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0027] It should be noted that the terms "first," "second," "target," etc., used in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0028] Example 1
[0029] Figure 1 This is a flowchart of a day / night mode switching method for a camera according to Embodiment 1 of the present invention. This embodiment is applicable to situations requiring precise switching of the day / night mode of a camera. The method can be executed by a day / night mode switching device for the camera, which can be implemented in hardware and / or software. This device can be configured in an electronic device with data processing capabilities. Figure 1 As shown, the method includes:
[0030] S110, Based on principal component analysis, at least two target principal components are determined according to historical data of multiple candidate parameters; wherein, the historical data are determined based on historical images captured by a camera, and the target principal components include principal component coefficients corresponding to each candidate parameter.
[0031] Principal Component Analysis (PCA) can be understood as a statistical method that transforms a set of correlated data into a set of linearly uncorrelated data through linear combination. The purpose of PCA is to reduce the dimensionality of the data while preserving as much original data information as possible. PCA yields multiple orthogonal eigenvectors and their corresponding eigenvalues. Each eigenvector can be considered a principal component. The target principal component is the one selected from all principal components obtained through PCA that contains the most information from the original data. The target principal component may include principal component coefficients corresponding to each candidate parameter. Principal component coefficients can be the values in the eigenvectors corresponding to each candidate parameter. Candidate parameters can be parameters related to image brightness. For example, candidate parameters can include sensor parameters and image parameters, such as illuminance, gain, shutter speed or exposure time, image signal-to-noise ratio (SNR), the brightness of the target in the image, the SNR of the target, and the number of bright and dark areas in the image. Historical data can be determined based on historical images captured by the camera.
[0032] In this embodiment, the historical data of multiple candidate parameters are first processed using principal component analysis to obtain multiple feature vectors and their corresponding feature values. The specific processing procedure is as follows: Assuming the number of historical images is n and the number of candidate parameters is m, the historical data can be represented as an n x m matrix, denoted as X = (x... ij ) n×m Where X represents the data matrix, i (i≤n) and j (j≤m) are the row and column labels of the data matrix, respectively, and x ij Let represent the data in the i-th row and j-th column of the data matrix. Let the data vector formed by the i-th row of the data matrix be denoted as . It can be done through formula Calculate the mean vector of the data vector. It should be noted that principal component analysis (PCA) already centers the data. If there are significant differences in the dimensions of the input variables, it is usually necessary to standardize the data vector before calculating the mean vector, and then calculate the mean vector based on the standardized result. This embodiment does not limit the standardization method; for example, z-score standardization or range standardization can be used. Taking range standardization as an example, the standardized data vector can be represented as: in, Then, the mean vector is calculated from the standardized data vector using the following formula:
[0033] After obtaining the mean vector of each row of data vectors, we can further calculate the covariance matrix or correlation coefficient matrix of the data matrix. It should be noted that if we need to calculate the correlation coefficient matrix, we must first standardize the data vectors. The covariance matrix can be calculated using the following formula: The correlation coefficient matrix can be calculated using the following formula: Here, T represents the transpose of the vector. After obtaining the covariance matrix S or the correlation coefficient matrix S′, the eigenvalues and corresponding eigenvectors of S or S′ can be further calculated.
[0034] After obtaining multiple feature vectors and their corresponding feature values, the feature vectors can be sorted according to the magnitude of the feature values, and at least two feature vectors containing more information from the original data can be selected as target principal components. For example, the feature vectors can be sorted in descending order of feature values, and the top few feature vectors, equal to a preset number, can be selected as target principal components. The preset number can refer to a pre-defined number of target principal components, which can be set according to the actual application scenario; this embodiment does not limit this. Furthermore, when sorting feature vectors, if feature values are identical, the feature vectors corresponding to the same feature values can be randomly sorted, but they cannot be merged.
[0035] S120 determines the day and night weights of the target principal components based on historical data.
[0036] The day-night weights can be used to characterize the importance of the target principal components to the day-night pattern, and the sum of the day-night weights of each target principal component is 1. In this embodiment, optionally, the day-night weights of the target principal components are determined based on historical data, including: determining the day-night weights of the target principal components based on the contribution rate of the target principal components obtained by principal component analysis; or, determining the historical target principal component scores based on the historical data of the candidate parameters and the principal component coefficients corresponding to each candidate parameter in the target principal components; determining the day-night correlation coefficients of the target principal components based on the historical target principal component scores and the calibrated day-night patterns corresponding to the historical data; and determining the day-night weights of the target principal components based on the day-night correlation coefficients.
[0037] The contribution rate can be defined as the ratio of the eigenvalue of a target principal component to the sum of the eigenvalues of all target principal components, representing the degree of contribution of a target principal component among all target principal components. The historical target principal component score refers to the principal component score corresponding to the target principal component determined based on historical data. The principal component score can be used to measure the importance of the corresponding principal component. Specifically, for the j-th target principal component y... j (1≤j≤m), the target principal component score can be calculated using the following formula: in, X i α represents the data in the i-th row of the data matrix. i This represents the i-th eigenvector after the eigenvalues are sorted in descending order. The calibrated day-night pattern can refer to the actual day-night pattern corresponding to pre-calibrated historical data. The day-night correlation coefficient can refer to the correlation coefficient between the historical target principal component score and the calibrated day-night pattern.
[0038] In this embodiment, the day-night weights of the target principal components can be determined in two ways. One is to determine the day-night weights of the target principal components based on their contribution rates, and the other is to determine them based on their day-night correlation coefficients. In the first method, since the sum of the contribution rates of all target principal components is 1, the contribution rate of the target principal components can be directly determined as their day-night weights. In the second method, the principal component coefficients corresponding to each candidate parameter in the target principal components are first determined based on the historical data of the candidate parameters, and then calculated using the formula... Determine the historical target principal component scores; then, based on the historical target principal component scores and the corresponding calibrated day-night patterns of the historical data, determine the day-night correlation coefficient of the target principal components; subsequently, the day-night correlation coefficient of the target principal components can be normalized using the following formula:
[0039] n selects the number of historical images. Where p j and p′ j Let represent the diurnal correlation coefficients of the target principal components before and after normalization, respectively. The diurnal weights of the target principal components are then determined using the following formula:
[0040] This scheme, through such a setting, allows for the determination of the day and night weights of the target principal components in different ways, thus improving the flexibility in determining the day and night weights.
[0041] S130, determine the day and night mode corresponding to the test data based on the test data and historical data of the candidate parameters, the target principal component and the corresponding day and night weights; wherein, the test data is determined based on the test images captured by the camera.
[0042] In this embodiment, after determining the target principal component and day / night weights, the day / night mode corresponding to the data to be tested can be determined based on the candidate parameters' test data and historical data, the target principal component, and the corresponding day / night weights. The test data can be determined based on the test image captured by the camera. Optionally, determining the day / night mode corresponding to the test data based on the candidate parameters' test data and historical data, the target principal component, and the corresponding day / night weights includes: determining the test target principal component score and historical target principal component score based on the candidate parameters' test data and historical data, and the principal component coefficients corresponding to each candidate parameter in the target principal component; normalizing the test target principal component score based on the test target principal component score and historical target principal component score; determining the day / night score of the test data based on the normalized test target principal component score and the corresponding day / night weights; and determining the day / night mode of the test image based on the day / night score.
[0043] The target principal component score can refer to the principal component score corresponding to the target principal component determined based on the test data. The day-night score can be used to describe the day-night pattern tendency and can serve as a basis for determining the day-night pattern.
[0044] In this embodiment, firstly, based on the test data and historical data of the candidate parameters, and the principal component coefficients corresponding to each candidate parameter in the target principal component, the formula is used. The target principal component score and historical target principal component scores are determined. Then, the target principal component score is normalized based on these two scores. For example, the target principal component score can be normalized using the following formula:
[0045] n is the sum of the number of historical images and the number of images to be tested. Where y′ j This represents the normalized principal component score of the target object. By normalizing the principal component scores of the target object, each principal component score of the target object can be mapped to... between.
[0046] Then, the day-night score of the test data can be determined based on the normalized principal component score of the target and the corresponding day-night weights, and the day-night mode of the test image can be determined based on the day-night score. For example, the normalized principal component scores of the target can be weighted and summed according to the day-night weights, and the result of the weighted summation can be determined as the day-night score of the test data. Specifically, this can be achieved using the formula... The day / night score of the data to be tested is determined. The final day / night score ranges from [-1, 1]. The closer the score is to 1, the closer it is to daytime mode; the closer it is to -1, the closer it is to nighttime mode. For example, when the day / night score is in the range of [-1, 0], the day / night mode of the image to be tested can be determined as nighttime mode; while when the day / night score is in the range of (0, 1), the day / night mode of the image to be tested can be determined as daytime mode. In addition, more refined day / night levels can be divided into multiple levels according to a preset step size. The preset step size can refer to a pre-set interval length, which can be fixed or dynamically changing. With 0 as the boundary, the closer the area is to -1, the higher its nighttime mode level; the closer the area is to 1, the higher its daytime mode level. This allows for the determination of corresponding camera parameter information based on different levels of day / night modes, improving the clarity of images captured by the camera in different modes. It should be noted that the day / night score calculated by the above method is smooth and will not have drastic changes.
[0047] This solution, through its configuration, can effectively address situations where a candidate parameter undergoes drastic changes under certain environments, thereby reducing the impact of environmental changes and improving the applicability of the day / night mode switching method.
[0048] The technical solution of this invention is based on principal component analysis (PCA). It determines at least two target principal components based on historical data of multiple candidate parameters. The historical data is determined from historical images captured by a camera. The target principal components include principal component coefficients corresponding to each candidate parameter. The day / night weights of the target principal components are determined based on the historical data. The day / night mode corresponding to the test data is determined based on the test data of the candidate parameters, the historical data, the target principal components, and the corresponding day / night weights. The test data is determined from the test images captured by the camera. This technical solution can simultaneously consider multiple factors influencing day / night modes, achieving precise switching of the camera's day / night mode, effectively reducing the impact of environmental changes, and improving the applicability of the day / night mode switching method.
[0049] Example 2
[0050] Figure 2This is a flowchart of a day / night mode switching method for a camera provided in Embodiment 2 of the present invention. This embodiment is an optimization based on the above embodiment. Specifically, the optimization is as follows: Based on principal component analysis, at least two target principal components are determined according to historical data of multiple candidate parameters, including: processing the historical data of multiple candidate parameters based on principal component analysis to obtain principal component results; wherein, the principal component results include multiple principal components and the contribution rate corresponding to each principal component; sorting the principal components in descending order according to the contribution rate, and determining the principal component ranked first as the first principal component; determining at least two target principal components according to the principal component coefficients corresponding to each candidate parameter in the first principal component and the ranking result of the contribution rate corresponding to each principal component.
[0051] like Figure 2 As shown, the method in this embodiment specifically includes the following steps:
[0052] S210, Based on the principal component analysis method, the historical data of multiple candidate parameters are processed to obtain the principal component results; wherein, the historical data is determined based on historical images captured by the camera, and the principal component results include multiple principal components and the contribution rate of each principal component.
[0053] In this embodiment, principal component analysis (PCA) is used to process historical data of multiple candidate parameters, yielding multiple eigenvectors and their corresponding eigenvalues. These eigenvectors are the principal components, and the ratio of the eigenvalue of a given principal component to the sum of the eigenvalues of all principal components represents the contribution rate of that principal component. Thus, the principal component analysis results are obtained.
[0054] S220: Sort the principal components in descending order according to their contribution rates, and determine the principal component ranked first as the first principal component.
[0055] Here, the first principal component can refer to the principal component with the largest contribution rate. In this embodiment, after obtaining the principal component results, all principal components can be sorted in descending order according to their contribution rates, and the principal component ranked first is determined as the first principal component. It is understood that the first principal component has the largest contribution rate among all principal components.
[0056] S230, determine at least two target principal components based on the principal component coefficients corresponding to each candidate parameter in the first principal component and the contribution rate ranking results corresponding to each principal component.
[0057] In this embodiment, after determining the first principal component based on the principal component results, at least two target principal components can be further determined based on the principal component coefficients corresponding to each candidate parameter in the first principal component and the contribution rate ranking results corresponding to each principal component. Optionally, determining at least two target principal components based on the principal component coefficients corresponding to each candidate parameter in the first principal component and the contribution rate ranking results corresponding to each principal component includes: determining whether the principal component coefficients corresponding to the reference parameter in the first principal component meet preset conditions; if they do, then determining at least two target principal components based on the contribution rate ranking results corresponding to each principal component; if they do not meet the conditions, then re-performing principal component analysis on the historical data of the candidate parameters.
[0058] The reference parameter can refer to a candidate parameter in the first principal component that is strongly correlated with the day / night mode. For example, assuming the candidate parameters include illuminance, gain, shutter speed, and image signal-to-noise ratio, where the illuminance is strongly correlated with the day / night mode, the illuminance can be determined as the reference parameter. The illuminance can be calculated from historical images or measured using a photoresistor. It should be noted that if multiple candidate parameters in the first principal component are strongly correlated with the day / night mode, the candidate parameter with the highest correlation can be selected as the reference parameter. The preset condition can refer to a pre-defined principal component coefficient condition. For example, the preset condition can be set such that the loading coefficient of the reference parameter in the first principal component is greater than a preset loading coefficient threshold. The preset loading coefficient threshold can refer to a pre-defined reference value for the loading coefficient, which can be set according to actual needs; this embodiment does not limit this. For example, the preset loading coefficient threshold can be set to 0.4.
[0059] In this embodiment, the principal component coefficients corresponding to the reference parameters in the first principal component are first used as loading coefficients. It is then determined whether the loading coefficients of the reference parameters in the first principal component are greater than a preset loading coefficient threshold. If so, the obtained principal component results are reliable. At this point, a preset number of principal components can be selected as target principal components based on the contribution rate ranking results of each principal component. Otherwise, the obtained principal component results are unreliable. In this case, principal component analysis needs to be performed again on the historical data of the candidate parameters. For example, another calculation method can be chosen to re-perform the principal component analysis. For instance, assuming that the principal component results obtained using the covariance matrix calculation method are unreliable, principal component analysis can be performed again on the historical data of the candidate parameters by calculating the correlation coefficient matrix.
[0060] This scheme, through such settings, can determine whether the obtained principal component results are reliable based on preset conditions. If the results are reliable, the target principal component is determined according to the contribution rate ranking results. If the results are unreliable, the principal component analysis is performed again, thereby ensuring the reliability of the principal component results.
[0061] S240 determines the day and night weights of the target principal components based on historical data.
[0062] S250, the day and night mode corresponding to the test data is determined based on the test data and historical data of the candidate parameters, the target principal component and the corresponding day and night weights; wherein, the test data is determined based on the test images captured by the camera.
[0063] The specific implementation methods of S240-S250 can be found in the detailed description of S120-S130, and will not be repeated here.
[0064] The technical solution of this invention processes historical data of multiple candidate parameters using principal component analysis (PCA) to obtain principal component results. These PCA results include multiple principal components and their corresponding contribution rates. The principal components are sorted in descending order based on their contribution rates, and the principal component ranked first is identified as the first principal component. At least two target principal components are determined based on the principal component coefficients corresponding to each candidate parameter in the first principal component and the contribution rate ranking results. This technical solution can simultaneously consider multiple day / night mode influencing factors. By determining the target principal components based on the contribution rate ranking results of the principal components and the principal component coefficients corresponding to each candidate parameter in the first principal component, it achieves accurate switching of the camera's day / night mode, effectively reduces the impact of environmental changes, and improves the applicability of the day / night mode switching method. Furthermore, it ensures the reliability of the target principal components, further improving the accuracy of the camera's day / night mode switching.
[0065] In this embodiment, optionally, determining at least two target principal components based on the contribution rate ranking results corresponding to each principal component includes: sequentially increasing the number of target principal components based on the contribution rate ranking results corresponding to each principal component, and stopping the increase when the sum of the contribution rates of the target principal components is greater than a first contribution rate threshold, or when the contribution rate corresponding to the newly added target principal component is less than a second contribution rate threshold.
[0066] The first contribution rate threshold can be a reference value for the sum of the contribution rates of the target principal components, set in advance. The second contribution rate threshold can be a reference value for the contribution rate corresponding to the newly added target principal component, set in advance. The first contribution rate threshold is greater than the second contribution rate threshold. For example, the first contribution rate threshold can be set to 0.8, and the second contribution rate threshold can be set to 0.15. It should be noted that this embodiment does not impose any limitations on the specific values of the first and second contribution rate thresholds, and they can be set according to actual needs.
[0067] In this embodiment, after determining at least two target principal components based on the contribution rate ranking results of each principal component, the number of target principal components can be increased sequentially in descending order of contribution rate until the sum of the contribution rates of the target principal components exceeds a first contribution rate threshold, or the contribution rate of the newly added target principal component is less than a second contribution rate threshold. Wherein, the increase stops when the sum of the contribution rates of the target principal components exceeds the first contribution rate threshold, indicating that the target principal components contain most of the original data information, thus retaining key information. If the contribution rate of the newly added target principal component is less than the second contribution rate threshold, it indicates that the newly added target principal component contains less original data information, and therefore can be ignored, thereby achieving the purpose of data dimensionality reduction.
[0068] This scheme, through such settings, can reasonably set the number of target principal components based on the first contribution rate threshold and the second contribution rate threshold, and can achieve the purpose of data dimensionality reduction while preserving as much original data information as possible.
[0069] In this embodiment, optionally, principal component analysis is performed again on the historical data of the candidate parameters, including: determining the day-night correlation coefficient of the candidate parameters based on the calibrated day-night pattern corresponding to the historical data of the candidate parameters; determining the target parameter from the candidate parameters based on the day-night correlation coefficient of the candidate parameters and the principal component coefficients corresponding to the candidate parameters in the first principal component; and performing principal component analysis again based on the historical data of the candidate parameters after removing the target parameter.
[0070] The target parameter can refer to a candidate parameter that simultaneously satisfies both a preset day-night correlation coefficient condition and a preset condition. The preset day-night correlation coefficient condition can be set so that the day-night correlation coefficient of the candidate parameter is lower than a preset day-night correlation coefficient threshold. The preset day-night correlation coefficient threshold can be a pre-defined reference value for the day-night correlation coefficient, which can be flexibly set according to actual needs. For example, the preset day-night correlation coefficient threshold can be set to 0.9 or 0.95. For instance, the preset condition can be set so that the loading coefficient of the reference parameter in the first principal component is greater than a preset loading coefficient threshold. The preset loading coefficient threshold can be set to 0.4.
[0071] In this embodiment, the diurnal correlation coefficient of each candidate parameter is first calculated sequentially based on the calibrated diurnal pattern corresponding to the historical data of the candidate parameters. Then, candidate parameters that simultaneously satisfy both the preset diurnal correlation coefficient condition and the preset condition are selected as target parameters. For example, if the preset diurnal correlation coefficient threshold is 0.9 and the preset loading coefficient threshold is 0.4, then candidate parameters with a diurnal correlation coefficient lower than 0.9 and a loading coefficient greater than 0.4 in the first principal component can be selected as target parameters. If multiple target parameters satisfy the conditions, the one with the lowest diurnal correlation coefficient is selected as the target parameter. The target parameter is then removed, and principal component analysis is performed again based on the historical data of the candidate parameters from which the target parameter was removed.
[0072] This scheme, through this setting, can re-perform principal component analysis on the historical data of the candidate parameters after removing the target parameter, thereby improving the reliability of the re-principal component analysis.
[0073] Example 3
[0074] Figure 3 This is a schematic diagram of a day / night mode switching device for a camera according to Embodiment 3 of the present invention. This device can execute the day / night mode switching method for a camera provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects for executing the method. For example... Figure 3 As shown, the device includes:
[0075] The target principal component determination module 310 is used to determine at least two target principal components based on the principal component analysis method and historical data of multiple candidate parameters; wherein, the historical data is determined based on historical images captured by a camera, and the target principal components include principal component coefficients corresponding to each candidate parameter;
[0076] The day-night weight determination module 320 is used to determine the day-night weight of the target principal component based on the historical data;
[0077] The day / night mode determination module 330 is used to determine the day / night mode corresponding to the test data based on the test data and historical data of the candidate parameters, the target principal component, and the corresponding day / night weights; wherein the test data is determined based on the test image captured by the camera.
[0078] Optionally, the target principal component determination module 310 includes:
[0079] The principal component result determination unit is used to process the historical data of the multiple candidate parameters based on the principal component analysis method to obtain the principal component results; wherein, the principal component results include multiple principal components and the contribution rate of each principal component;
[0080] The first principal component determination unit is used to sort the principal components in descending order according to the contribution rate, and determine the principal component ranked first as the first principal component.
[0081] The target principal component determination unit is used to determine at least two target principal components based on the principal component coefficients corresponding to each candidate parameter in the first principal component and the contribution rate ranking results corresponding to each principal component.
[0082] Optionally, the target principal component determination unit includes:
[0083] The principal component coefficient judgment subunit is used to determine whether the principal component coefficients corresponding to the reference parameters in the first principal component meet the preset conditions.
[0084] The target principal component determination subunit is used to determine at least two target principal components based on the contribution rate ranking results of each principal component if the following conditions are met.
[0085] A re-principal component analysis subunit is used to re-perform principal component analysis on the historical data of the candidate parameters if the conditions are not met.
[0086] Optionally, the target principal component determining subunit is used for:
[0087] The number of target principal components is increased sequentially according to the contribution rate ranking results of each principal component. The increase stops when the sum of the contribution rates of the target principal components is greater than the first contribution rate threshold, or when the contribution rate of the newly added target principal component is less than the second contribution rate threshold.
[0088] Optionally, the re-principal component analysis subunit is used for:
[0089] The day-night correlation coefficient of the candidate parameter is determined based on the calibrated day-night pattern corresponding to the historical data of the candidate parameter.
[0090] The target parameter is determined from the candidate parameters based on the day-night correlation coefficient of the candidate parameters and the principal component coefficients corresponding to the candidate parameters in the first principal component.
[0091] Principal component analysis was performed again based on historical data of the candidate parameters after removing the target parameter.
[0092] Optionally, the day / night weight determination module 320 is used for:
[0093] The day-night weights of the target principal components are determined based on the contribution rates of the target principal components obtained from principal component analysis; or,
[0094] The historical target principal component score is determined based on the historical data of the candidate parameters and the principal component coefficients corresponding to each candidate parameter in the target principal component.
[0095] Based on the historical target principal component scores and the calibrated day-night patterns corresponding to the historical data, the day-night correlation coefficient of the target principal component is determined;
[0096] The day-night weights of the target principal components are determined based on their day-night correlation coefficients.
[0097] Optionally, the day / night mode determination module 330 is used for:
[0098] Based on the test data and historical data of the candidate parameters, and the principal component coefficients corresponding to each candidate parameter in the target principal component, the test target principal component score and the historical target principal component score are determined respectively.
[0099] The principal component score of the target to be tested is normalized based on the principal component score of the target to be tested and the historical target principal component scores.
[0100] The day and night score of the test data is determined based on the normalized principal component score of the target and the corresponding day and night weights, and the day and night mode of the test image is determined based on the day and night score.
[0101] The day / night mode switching device for a camera provided in this embodiment of the invention can execute the day / night mode switching method for a camera provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of executing the method.
[0102] Example 4
[0103] Figure 4 A schematic diagram of an electronic device 10 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0104] like Figure 4As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0105] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0106] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as the day / night mode switching method for a camera.
[0107] In some embodiments, the camera's day / night mode switching method can be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the camera's day / night mode switching method described above can be performed. Alternatively, in other embodiments, processor 11 can be configured to perform the camera's day / night mode switching method by any other suitable means (e.g., by means of firmware).
[0108] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0109] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0110] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0111] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0112] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0113] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0114] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0115] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A method for switching day and night modes for a camera, characterized in that, The method includes: Based on principal component analysis, at least two target principal components are determined according to historical data of multiple candidate parameters; wherein, the historical data is determined based on historical images captured by a camera, and the target principal components include principal component coefficients corresponding to each candidate parameter; The day and night weights of the target principal components are determined based on the historical data. The day / night mode corresponding to the test data is determined based on the candidate parameters, the historical data, the target principal component, and the corresponding day / night weights; wherein the test data is determined based on the test images captured by the camera.
2. The method according to claim 1, characterized in that, Based on principal component analysis, at least two target principal components are determined using historical data from multiple candidate parameters, including: The historical data of the multiple candidate parameters are processed using principal component analysis to obtain principal component results; wherein, the principal component results include multiple principal components and the contribution rate of each principal component. The principal components are sorted in descending order according to their contribution rates, and the principal component ranked first is determined as the first principal component. At least two target principal components are determined based on the principal component coefficients corresponding to each candidate parameter in the first principal component and the contribution rate ranking results corresponding to each principal component.
3. The method according to claim 2, characterized in that, Based on the principal component coefficients corresponding to each candidate parameter in the first principal component and the contribution rate ranking results corresponding to each principal component, at least two target principal components are determined, including: Determine whether the principal component coefficients corresponding to the reference parameters in the first principal component meet the preset conditions; If the conditions are met, at least two target principal components are determined based on the contribution rate ranking results corresponding to each principal component. If the conditions are not met, principal component analysis is performed again on the historical data of the candidate parameters.
4. The method according to claim 3, characterized in that, Based on the contribution rate ranking results of each principal component, at least two target principal components are determined, including: The number of target principal components is increased sequentially according to the contribution rate ranking results of each principal component. The increase stops when the sum of the contribution rates of the target principal components is greater than the first contribution rate threshold, or when the contribution rate of the newly added target principal component is less than the second contribution rate threshold.
5. The method according to claim 3, characterized in that, Perform principal component analysis again on the historical data of the candidate parameters, including: The day-night correlation coefficient of the candidate parameter is determined based on the calibrated day-night pattern corresponding to the historical data of the candidate parameter. The target parameter is determined from the candidate parameters based on the day-night correlation coefficient of the candidate parameters and the principal component coefficients corresponding to the candidate parameters in the first principal component. Principal component analysis was performed again based on historical data of the candidate parameters after removing the target parameter.
6. The method according to claim 1, characterized in that, The day-night weights of the target principal components are determined based on the historical data, including: The day-night weights of the target principal components are determined based on the contribution rates of the target principal components obtained from principal component analysis; or, The historical target principal component score is determined based on the historical data of the candidate parameters and the principal component coefficients corresponding to each candidate parameter in the target principal component. Based on the historical target principal component scores and the calibrated day-night patterns corresponding to the historical data, the day-night correlation coefficient of the target principal component is determined; The day-night weights of the target principal components are determined based on their day-night correlation coefficients.
7. The method according to claim 1, characterized in that, The day-night pattern corresponding to the test data is determined based on the candidate parameters' test data and historical data, the target principal component, and the corresponding day-night weights, including: Based on the test data and historical data of the candidate parameters, and the principal component coefficients corresponding to each candidate parameter in the target principal component, the test target principal component score and the historical target principal component score are determined respectively. The principal component score of the target to be tested is normalized based on the principal component score of the target to be tested and the historical target principal component scores. The day and night score of the test data is determined based on the normalized principal component score of the target and the corresponding day and night weights, and the day and night mode of the test image is determined based on the day and night score.
8. A day / night mode switching device for a camera, characterized in that, The device includes: The target principal component determination module is used to determine at least two target principal components based on the principal component analysis method and historical data of multiple candidate parameters; wherein, the historical data is determined based on historical images captured by a camera, and the target principal components include principal component coefficients corresponding to each candidate parameter; The day-night weight determination module is used to determine the day-night weight of the target principal component based on the historical data; The day / night mode determination module is used to determine the day / night mode corresponding to the test data based on the test data and historical data of the candidate parameters, the target principal component, and the corresponding day / night weights; wherein the test data is determined based on the test image captured by the camera.
9. An electronic device for switching day and night modes in a camera, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the day / night mode switching method of the camera according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that, when executed by a processor, implement the day / night mode switching method of the camera according to any one of claims 1-7.