Visibility determination method, device, computer equipment and storage medium
By dividing the image area and vertically, clustering transmittance and calculating the proportion, the problem of local areas of the image interfering with global visibility is solved, and more accurate visibility detection is achieved.
Patent Information
- Application Number
- CN202011104027.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-10-15
- Publication Date
- 2024-12-17
- Estimated Expiration
- 2040-10-15
AI Technical Summary
The existing image-based visibility detection method has the situation where the local area of the image interferes with the global, resulting in the visibility being unable to accurately reflect the visibility during image acquisition.
By dividing the target image area and vertically, clustering the transmittance, calculating the transmittance proportion of each area, and inputting a visibility recognition model to obtain target visibility, eliminating the impact of a single image on the entire image, and reducing the local area interference.
More accurate visibility detection is achieved, avoiding interference from local areas of the image on global visibility, and improving detection accuracy.
Smart Images

Figure CN112419231B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a visibility determination method, apparatus, computer equipment and storage medium. Background Art
[0002] With the development of image processing technology, the technology of visibility detection based on images has emerged. The technology of visibility detection based on images can avoid the problems of difficult and high cost of equipment installation in traditional visibility detection, and can save the cost of visibility detection to a certain extent and improve the detection speed. At present, the method of visibility detection based on images is usually to determine the transmittance of the image, and then determine the visibility when the image is acquired based on the transmittance of the image.
[0003] However, due to the influence of the image shooting environment, shooting equipment and shooting angle, there may be a situation where the local area of the image cannot effectively reflect the visibility when the image is acquired. The current method of determining the corresponding visibility of the image by the transmittance of the image is prone to the situation where the local area of the image interferes with the global area, and the obtained visibility cannot accurately reflect the visibility when the image is acquired. Summary of the invention
[0004] Based on this, it is necessary to provide a visibility determination method, device, computer equipment and storage medium that can accurately reflect image visibility in response to the above technical problems.
[0005] A visibility determination method, the method comprising:
[0006] Dividing the target image into regions according to a first preset size to obtain a first number of first images;
[0007] According to a second preset size, the target image is divided vertically to obtain a second number of second images;
[0008] Clustering the transmittances of the first number of first images according to preset cluster centers to obtain a preset number of categories corresponding to the cluster centers;
[0009] For each of the second images, determining the proportion of the first image corresponding to each of the categories in the second image, and obtaining a preset number of ratios corresponding to the second image;
[0010] A preset number of ratios corresponding to each second image is input into a preset visibility recognition model to obtain target visibility corresponding to the image; wherein the visibility recognition model is obtained by training based on historical images.
[0011] In one embodiment, inputting a preset number of ratios corresponding to each second image into a preset visibility recognition model to obtain the target visibility corresponding to the image includes:
[0012] For each second image, inputting a preset number of ratios corresponding to the second image into a preset visibility recognition model to obtain the visibility corresponding to the second image; wherein the second number of second images corresponds to a second number of visibilities;
[0013] The second number of visibility is weighted to obtain the target visibility.
[0014] In one embodiment, the method for obtaining the visibility recognition model includes:
[0015] Acquire a historical image, and determine a preset number of ratios corresponding to the historical image and a historical visibility corresponding to the historical image;
[0016] A preset number of ratios corresponding to the historical images are used as input, and the historical visibility is used as supervision information, and a preset initial visibility recognition model is trained to obtain the visibility recognition model.
[0017] In one embodiment, for each of the second images, determining the proportion of the first image corresponding to each of the categories in the second image, and obtaining a preset number of ratios corresponding to the second image, includes:
[0018] For each of the second images, determining a total number of pixels of the first image of each category in the second image;
[0019] The ratio between the total number of pixels of the first image corresponding to each of the categories and the total number of second pixels corresponding to the second image is determined as one of the preset number of ratios corresponding to the second image; each category corresponds to one ratio, and the second image corresponds to a preset number of ratios.
[0020] In one embodiment, for each of the second images, determining the total number of pixels of the first image of each category in the second image includes:
[0021] For each of the second images, determining a first image corresponding to each of the categories in the second image as a first target image;
[0022] The number of pixel points corresponding to each of the first target images is obtained, and the sum of the number of pixel points corresponding to each of the first target images is determined as the total number of pixel points.
[0023] In one embodiment, clustering the transmittances of the first number of first images according to a preset cluster center to obtain a category corresponding to the cluster center includes:
[0024] Acquire the transmittance corresponding to each of the first images to obtain the first number of transmittances;
[0025] The first number of transmittances are clustered according to the cluster centers to obtain categories corresponding to the cluster centers.
[0026] In one embodiment, acquiring the transmittance corresponding to each of the first images to obtain the first number of transmittances includes:
[0027] For each of the first images, the transmittance corresponding to each of the first images is determined by a dark channel priori algorithm to obtain the first number of transmittances.
[0028] A visibility determination device, the device comprising:
[0029] A first image segmentation module, used to divide the target image into regions according to a first preset size to obtain a first number of first images;
[0030] A second image segmentation module, used for dividing the target image vertically according to a second preset size to obtain a second number of second images;
[0031] a transmittance clustering module, configured to cluster the transmittances of the first number of first images according to preset cluster centers, to obtain a preset number of categories corresponding to the cluster centers;
[0032] a ratio determination module, configured to determine, for each of the second images, a proportion of the first image corresponding to each of the categories in the second image, and obtain a preset number of ratios corresponding to the second image;
[0033] The visibility determination module is used to input a preset number of ratios corresponding to each second image into a preset visibility recognition model to obtain the target visibility corresponding to the image; wherein the visibility recognition model is obtained by training based on historical images.
[0034] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any one of the above methods when executing the computer program.
[0035] A computer-readable storage medium stores a computer program, which implements the steps of any of the above methods when executed by a processor.
[0036] The visibility determination method, device, computer equipment and storage medium cluster the transmittances of the first number of first images according to the preset cluster center, obtain the preset number of categories corresponding to the cluster center, and further determine the transmittance on the local image corresponding to each first image. And according to the clustering result of the transmittance, determine the proportion of the first image corresponding to each category in the second image, and obtain the preset number of ratios corresponding to the second image. The ratio can eliminate the influence of a single first image on the whole image, reduce the influence of the local image corresponding to the first image, avoid the situation where the local area of the image interferes with the whole, so that the target visibility determined according to the preset number of ratios is more accurate. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 A diagram of an application environment of a visibility determination method in one embodiment;
[0038] Figure 2 is a flow chart of a visibility determination method in one embodiment;
[0039] Figure 3 A flowchart of a possible implementation method of step S500 in an embodiment;
[0040] Figure 4 A flowchart of a possible implementation method of step S400 in an embodiment;
[0041] Figure 5 This is a flowchart of a possible implementation method of step S300 in an embodiment;
[0042] Figure 6 is a structural block diagram of a visibility determination device in one embodiment;
[0043] Figure 7 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0044] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0045] The visibility determination method provided in this application can be applied to Figure 1In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The terminal 102 clusters the transmittance of the first number of first images according to the preset clustering center, obtains the preset number of categories corresponding to the clustering center, and further determines the transmittance on the local image corresponding to each first image. And according to the clustering result of the transmittance, the proportion of the first image corresponding to each category in the second image is determined, and the preset number of ratios corresponding to the second image are obtained. This ratio can eliminate the influence of a single first image on the entire image, reduce the influence of the local image corresponding to the first image, avoid the situation where the local area of the image interferes with the global situation, so that the target visibility determined according to the preset number of ratios is more accurate. Among them, the terminal 102 can be but not limited to various personal computers, laptops, smart phones, tablet computers and portable wearable devices, and the server 104 can be implemented by an independent server or a server cluster composed of multiple servers.
[0046] In one embodiment, Figure 2 As shown, a visibility determination method is provided, which is applied to Figure 1 The terminal in is used as an example to illustrate, including the following steps:
[0047] Step S100: dividing the target image into regions according to a first preset size to obtain a first number of first images.
[0048] Step S200: dividing the target image vertically according to a second preset size to obtain a second number of second images.
[0049] Step S300: clustering the transmittances of a first number of first images according to preset cluster centers to obtain a preset number of categories corresponding to the cluster centers.
[0050] Step S400: for each second image, determine the proportion of the first image corresponding to each category in the second image, and obtain a preset number of ratios corresponding to the second image.
[0051] Step S500, inputting a preset number of ratios corresponding to each second image into a preset visibility recognition model to obtain target visibility corresponding to the image; wherein the visibility recognition model is obtained by training based on historical images.
[0052] Among them, visibility is a routine item in meteorological observation. It refers to the maximum distance at which the outline of the target object can be distinguished from the background when observing the target object. Atmospheric visibility can be divided into daytime visibility and nighttime visibility. Daytime visibility refers to the maximum distance at which a person with normal vision can see and identify a target object (black, of appropriate size) from the sky background under the current weather conditions. Nighttime visibility includes the following two definitions: (1) Assuming that the overall illumination increases to the normal daytime level, the maximum distance at which a black target of appropriate size can be seen and identified; (2) The maximum distance at which a medium-intensity luminous body can be seen and identified. The target image is an image used for visibility detection. For the acquisition of the target image, it is necessary to ensure that the camera is basically horizontal and facing a certain direction of the observation station, and the image field of view cannot be blocked, so as to ensure that most of the information in the image can be obtained. At the same time, the image data used is not limited to the images collected by a single camera, and images collected by multiple similar cameras can be used. If images from different cameras are used, it is necessary to ensure that the terrain and content in the image are not too different to prevent calculation inconsistency due to the influence of image content. Each target image, first image, and second image corresponds to a set of image data, respectively. Image data refers to a set of grayscale values of each pixel represented by a numerical value. The first preset size is the size of the small area for dividing the target image into regions. Optionally, the first preset size can be a 10*10 small block with a length of 10 pixels and a width of 10 pixels. The second preset size is the size for dividing the target image vertically. Optionally, the second preset size can be a length of 20 pixels, a length of 100 pixels, or a length of 1000 pixels. The preset cluster center is the center for clustering the transmittance of the first number of first images. Optionally, the cluster center can be 0.05, 0.35, 0.5, 0.6, 0.8, etc. The preset number refers to the number of categories obtained by clustering according to the preset cluster center. Generally, the number of cluster centers is the corresponding preset number.
[0053] Specifically, after acquiring the target image, the target image is divided according to a first preset size to obtain a first number of first images. For example, if the target image is 640*480 in size, if it is divided according to a first preset size of 10*10, (640*480) / (10*10)=3072 first images can be obtained.
[0054] Similarly, the target image is divided longitudinally according to the second preset size to obtain a second number of second images. For example, if the target image is 640*480 in size and has a length of 640 from left to right, if it is divided according to the second preset size of 128, 640 / 128=5 second images can be obtained. Optionally, the target image can also be divided according to the preset second number to obtain a second number of second images. The reason for the longitudinal division of the target image is that, in general, the components of the target image have an obvious change in the longitudinal direction. For example, the upper half of the general image is the sky or a distant scene, while the middle of the image is a closer scene, and the bottom of the image is a near scene. Therefore, the longitudinal division of the target image can make each second image have a more uniform change in depth. The ratio distribution obtained later is made more uniform, avoiding abnormal ratios for determining the visibility image. At the same time, since the target image has a large transmittance change in the longitudinal region, the longitudinal division enables the subsequent steps to take into account the transmittance distribution change on each second image, so that the final target visibility is more accurate. Optionally, the target image may also be divided horizontally, and the specific division form may be set according to different requirements.
[0055] According to the preset clustering centers, the transmittances of the first number of first images are clustered to obtain the preset number of categories corresponding to the clustering centers. For example, the preset clustering centers are 0.05, 0.35, 0.5, 0.6, and 0.8, respectively. The transmittance corresponding to a first image is 0.65. Since it is closest to 0.6, it belongs to the fourth category. All first images are clustered according to the preset clustering centers of 0.05, 0.35, 0.5, 0.6, and 0.8, and 5 categories can be obtained. For each second image, the proportion of the first image corresponding to each category in the second image is determined to obtain the preset number of ratios corresponding to the second image. For example, the size of the second image is 100*300 pixels, then there are 300 10*10 small areas in the second image, of which each category has 60 blocks, and the preset number of ratios corresponding to the second image are [0.2, 0.2, 0.2, 0.2, 0.2]. A preset number of ratios corresponding to each second image are input into a preset visibility recognition model to obtain the visibility corresponding to each second image, and the visibility corresponding to each second image is weighted to obtain the target visibility corresponding to the image.
[0056] The above visibility determination method divides the target image into a first number of first images, and the transmittance can be determined on a smaller area, so that the transmittance can better reflect the transmittance of the corresponding area. The target image is divided into a second number of second images, which is obtained on the basis of longitudinal division of the target image. Since the target image has a large change in transmittance in the longitudinal area, the longitudinal division enables the subsequent steps to take into account the change in transmittance distribution on each second image, so that the target visibility is finally obtained more accurately. By clustering the transmittance of the first number of first images according to the preset cluster center, a preset number of categories corresponding to the cluster center are obtained, and the transmittance on the local image corresponding to each first image is further determined. And according to the clustering result of the transmittance, the proportion of the first image corresponding to each category in the second image is determined, and the preset number of ratios corresponding to the second image are obtained. The ratio can eliminate the influence of a single first image on the entire image, reduce the influence of the local image corresponding to the first image, and avoid the situation where the local area of the image interferes with the global, so that the target visibility determined according to the preset number of ratios is more accurate.
[0057] In one embodiment, Figure 3 FIG. 5 is a flow chart of an implementable method of step S500, which includes the following steps:
[0058] Step S510, for each second image, input a preset number of ratios corresponding to the second image into a preset visibility recognition model to obtain the visibility corresponding to the second image; wherein the second number of second images corresponds to the second number of visibilities.
[0059] Step S520: weighting the second number of visibility to obtain target visibility.
[0060] Specifically, a preset number of ratios corresponding to a second image is input into a preset visibility recognition model to obtain the visibility corresponding to the second image. The visibility corresponding to all second images is weighted and summed to obtain the target visibility corresponding to the entire target image. The visibility corresponding to all second images can be weighted averaged to obtain the target visibility corresponding to the target image. The visibility corresponding to the second image can also be weighted according to a preset weighting value to obtain the target visibility corresponding to the target image.
[0061] In the above embodiment, for each second image, a preset number of ratios corresponding to the second image are input into a preset visibility recognition model to obtain the visibility corresponding to the second image; wherein the second number of second images corresponds to the second number of visibilities; the second number of visibilities are weighted to obtain the target visibility. Thus, the visibility corresponding to each second image can be determined in a small area, so that the visibility can more finely reflect the visibility of the second image, avoiding the situation where the local area of the image interferes with the global situation, and the target visibility of the target image is obtained by weighting, so that the target visibility determined according to the preset number of ratios is more accurate.
[0062] In one embodiment, the method for obtaining the visibility recognition model includes:
[0063] Obtain historical images, and determine a preset number of ratios corresponding to the historical images and a historical visibility corresponding to the historical images; use the preset number of ratios corresponding to the historical images as input and the historical visibility as supervision information to train a preset initial visibility recognition model to obtain a visibility recognition model.
[0064] Specifically, after acquiring the historical image, the historical image is divided into regions according to a first preset size to obtain a first number of first historical images; the historical image is divided vertically according to a second preset size to obtain a second number of second historical images; the transmittance of the first number of first historical images is clustered according to a preset cluster center to obtain a preset number of categories corresponding to the cluster center; for each second historical image, the proportion of the first historical image corresponding to each category in the second historical image is determined to obtain a preset number of ratios corresponding to the second historical image; and the preset number of ratios corresponding to the historical image is used as input, and the historical visibility is used as supervision information to train the preset initial visibility recognition model to obtain a visibility recognition model. The historical visibility is the visibility corresponding to the historical image, which can be obtained by observing at an observation station and is a value that truly reflects the visibility of the historical image.
[0065] In the above embodiment, historical images are obtained, and a preset number of ratios corresponding to the historical images and historical visibility corresponding to the historical images are determined; the preset number of ratios corresponding to the historical images are used as input, and the historical visibility is used as supervision information to train the preset initial visibility recognition model to obtain the visibility recognition model. This provides a basis for determining the target visibility according to the target image.
[0066] In one embodiment, Figure 4 FIG. 4 is a flow chart of an implementable method of step S400, which includes the following steps:
[0067] Step S410: for each second image, determine the total number of pixels of each category of the first image in the second image.
[0068] Step S420, determine the ratio between the total number of pixels of the first image corresponding to each category and the total number of second pixels corresponding to the second image as one of the preset number of ratios corresponding to the second image; each category corresponds to one ratio, and the second image corresponds to a preset number of ratios.
[0069] Specifically, in each second image, the number of first images of each category contained in the second image and the total number of pixels of the first image of each category are determined. For example, the size of a second image is 100*300, which includes first images of 5 categories, 60 first images of the first category, and the size of each first image is 10*10, then the total number of pixels of the first image of the first category is 60*(10*10). The ratio between the total number of pixels of the first image corresponding to each category 60*(10*10) and the total number of second pixels corresponding to the second image 100*300 [60*(10*10)] / [100*300]=0.2 is determined as one of the preset number of ratios corresponding to the second image, one ratio corresponding to each category, and a preset number of ratios corresponding to the second image. When there are 60 first images of each category and the size of each first image is 10*10, the preset number of ratios is [0.2, 0.2, 0.2, 0.2, 0.2].
[0070] Optionally, for each second image, the first image corresponding to each category in the second image is determined as the first target image; the number of pixels corresponding to each first target image is obtained, and the sum of the number of pixels corresponding to each first target image is determined as the total number of pixels.
[0071] Specifically, for example, the size of a second image is 100*300, which includes 5 categories of first images. The first image of the first category is determined as the first target image. If the number of first target images is 60 and the size of each first target image is 10*10, the total number of pixels of the first target image of the first category is 60*(10*10).
[0072] In the above embodiment, for each second image, the total number of pixels of the first image of each category in the second image is determined; the ratio between the total number of pixels of the first image corresponding to each category and the total number of second pixels corresponding to the second image is determined as one of the preset number of ratios corresponding to the second image; each category corresponds to a ratio, and the second image corresponds to a preset number of ratios. The preset number of ratios can more finely reflect the transmittance distribution of the second image, avoid the situation where the local area of the image interferes with the overall situation, and make the target visibility finally determined more accurate.
[0073] In one embodiment, Figure 5 FIG. 1 is a flow chart of an implementable method of step S300, which includes the following steps:
[0074] Step S310, acquiring the transmittance corresponding to each first image to obtain a first number of transmittances.
[0075] Step S320: clustering the first number of transmittances according to the cluster centers to obtain categories corresponding to the cluster centers.
[0076] Optionally, for each first image, a transmittance corresponding to each first image is determined by a dark channel priori algorithm to obtain a first number of transmittances.
[0077] Among them, the dark channel prior theory believes that in most outdoor fog-free images, except for local areas of the sky, there are some pixels that satisfy the requirement that the intensity value of at least one color channel is very low, close to 0.
[0078] Specifically, for each first image, the transmittance corresponding to each first image is calculated by a dark channel prior algorithm to obtain a first number of transmittances, and the first number of transmittances are clustered according to cluster centers 0.05, 0.35, 0.5, 0.6, and 0.8 to obtain categories corresponding to the cluster centers.
[0079] The specific method of determining the transmittance through the dark channel prior algorithm is as follows:
[0080] The haze digital image model is shown in formula (1):
[0081] I(x)=J(x)t(x)+A(1-t(x)) (1)
[0082] Where I is the observed image intensity, J is the intensity of the target light, A is the atmospheric ambient light, and t is the transmittance of the propagation medium, which describes the proportion of light from the target that reaches the camera after propagation through the medium. The first term on the right side of the equation, J(x)t(x), is called direct attenuation, which is the intensity of the light emitted or reflected by the target that eventually reaches the camera, and A(1-t(x)) is called the atmospheric light component, which is the intensity of the ambient light that eventually enters the camera.
[0083] The dark channel prior theory holds that in most outdoor fog-free images, except for the local area of the sky, there are some pixels that satisfy the condition that the intensity value of at least one color channel is very low, close to 0. The determination method of image J is shown in formula (2):
[0084]
[0085] Among them, J c represents a color channel of J, and Ω(x) is a neighborhood centered on x. The dark channel prior theory states that for a haze-free image, J except for the sky area dark The value is close to 0 and is called J dark is the dark channel of J.
[0086] Assume that the transmittance of the area Ω(x) centered at x is equal and is recorded as Then for formula (1), take the minimum value in the domain, and then take the minimum value in the three primary color channels to obtain formula (3):
[0087]
[0088] According to the prior knowledge of dark channel, the dark channel of fog-free image is close to 0, while the atmospheric ambient light is always positive, so there is formula (4):
[0089]
[0090] Substituting the above formula into formula (3), we can estimate the transmittance
[0091]
[0092] Since there are still a small amount of particles in the atmosphere in any fog-free weather, the observed image should introduce an inherent parameter ω (0<ω≤1). Here, the empirical value is 0.95.
[0093] Among them, regarding the estimation of atmospheric light intensity, I dark The intensity is arranged from high to low, and the brightest pixel values in the top 0.1% are taken as the global atmospheric light intensity of the current image. After the transmittance is obtained, guided filtering can be used to optimize the transmittance.
[0094] In the above embodiment, the transmittance corresponding to each first image is obtained to obtain a first number of transmittances; the first number of transmittances are clustered according to the cluster center to obtain the category corresponding to the cluster center. Thus, the transmittance can be determined on a smaller area, so that the transmittance can better reflect the transmittance of the corresponding area. At the same time, in the subsequent process of obtaining the target visibility, the influence of the local image corresponding to the first image can be reduced to avoid the situation where the local area of the image interferes with the global situation, so that the target visibility determined according to the preset number of ratios is more accurate.
[0095] In a specific embodiment, first, the target image can be divided into small blocks of 10*10 pixels (first image), and the average transmittance of each small block is taken instead of the transmittance value of the whole block. Through the accumulation of a large amount of data under different visibility conditions, the transmittances of all small blocks are clustered into several categories. Optionally, 5 categories are selected and 5 cluster centers are obtained. For the entire target image, after being divided into small blocks, the average transmittance value of each block is determined based on which cluster center it is closest to, and the block is then divided into a certain category. For example, the cluster centers are 0.05, 0.35, 0.5, 0.6, and 0.8 respectively, and the average transmittance of a small block is calculated to be 0.65. Since it is closest to 0.6, it belongs to the fourth category.
[0096] Next, divide the whole image into several strips (second image) vertically, and obtain the distribution value of each category for each strip. For example, if 5 strips are taken, 5*[f1, f2, f3, f4, f5] will be obtained. Among them, f1, f2, f3, f4, f5 represent the ratio of each small block of the first to fifth categories to the number of small blocks in the whole strip. For example, there are 300 small blocks in a 100*300 pixel strip, of which there are 60 blocks in each category, so the characteristic value (ratio) of the strip is [0.2, 0.2, 0.2, 0.2, 0.2].
[0097] According to the feature values, the regression model (initial visibility recognition model) is trained. Specifically, after data collection and preprocessing, many historical image feature values can be obtained, and the training label L (visibility level) is generated according to the visibility values corresponding to the historical images, that is, a training data is [f1, f2, f3, f4, f5; L].
[0098] Optionally, a polynomial regression model can be used as the initial visibility recognition model. Theoretically, any function can be infinitely approximated by a polynomial, which is the basic principle of polynomial regression. During training, the least squares method is used to optimize the parameters, with 80% as training data and 20% as test data. Finally, the model with better performance is selected as the final regression model (visibility recognition model).
[0099] When determining visibility, the target image is first preprocessed to obtain the feature values of several long strips. The feature value of each strip is input into the trained regression model to calculate the visibility value. Finally, the visibility output of the entire image takes the average of the visibility values of all strips as the final result.
[0100] In the above embodiment, the error that may be generated by directly calculating the visibility value through the dark channel information of the target object is avoided, and the interference caused by the inappropriate color of the object in the local area is avoided.
[0101] It should be understood that although Figure 2-5 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2-5 At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.
[0102] In one embodiment, Figure 6 As shown, a visibility determination device is provided, comprising: a first image segmentation module 601, a second image segmentation module 602, a transmittance clustering module 603, a ratio determination module 604 and a visibility determination module 605, wherein:
[0103] A first image segmentation module 601 is used to divide the target image into regions according to a first preset size to obtain a first number of first images;
[0104] A second image segmentation module 602, configured to vertically segment the target image according to a second preset size to obtain a second number of second images;
[0105] The transmittance clustering module 603 is used to cluster the transmittances of the first number of first images according to the preset clustering centers to obtain a preset number of categories corresponding to the clustering centers;
[0106] A ratio determination module 604 is used to determine, for each second image, the proportion of the first image corresponding to each category in the second image, and obtain a preset number of ratios corresponding to the second image;
[0107] The visibility determination module 605 is used to input a preset number of ratios corresponding to each second image into a preset visibility recognition model to obtain the target visibility corresponding to the image; wherein the visibility recognition model is obtained by training based on historical images.
[0108] In one embodiment, the visibility determination module 605 is also used to, for each second image, input a preset number of ratios corresponding to the second image into a preset visibility recognition model to obtain the visibility corresponding to the second image; wherein the second number of second images corresponds to a second number of visibilities; and the second number of visibilities are weighted to obtain the target visibility.
[0109] In one embodiment, the visibility determination module 605 is also used to obtain historical images and determine a preset number of ratios corresponding to the historical images and the historical visibility corresponding to the historical images; using the preset number of ratios corresponding to the historical images as input and the historical visibility as supervision information, a preset initial visibility recognition model is trained to obtain a visibility recognition model.
[0110] In one embodiment, the ratio determination module 604 is also used to determine, for each second image, the total number of pixels of the first image of each category in the second image; and determine the ratio between the total number of pixels of the first image corresponding to each category and the total number of second pixels corresponding to the second image as one of a preset number of ratios corresponding to the second image; each category corresponds to a ratio, and the second image corresponds to a preset number of ratios.
[0111] In one embodiment, the ratio determination module 604 is also used to determine, for each second image, the first image corresponding to each category in the second image as the first target image; obtain the number of pixels corresponding to each first target image, and determine the sum of the number of pixels corresponding to each first target image as the total number of pixels.
[0112] In one embodiment, the transmittance clustering module 603 is further used to obtain the transmittance corresponding to each first image to obtain a first number of transmittances; cluster the first number of transmittances according to the cluster center to obtain a category corresponding to the cluster center.
[0113] In one embodiment, the transmittance clustering module 603 is further configured to determine the transmittance corresponding to each first image by using a dark channel priori algorithm to obtain a first number of transmittances.
[0114] For the specific definition of the visibility determination device, please refer to the definition of the visibility determination method above, which will not be repeated here. Each module in the above-mentioned visibility determination device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0115] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 7 As shown. The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a visibility determination method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a key, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0116] Those skilled in the art will understand that Figure 7 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0117] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0118] Dividing the target image vertically according to a second preset size to obtain a second number of second images;
[0119] Clustering the transmittances of a first number of first images according to a preset clustering center to obtain a preset number of categories corresponding to the clustering center;
[0120] For each second image, determining the proportion of the first image corresponding to each category in the second image, and obtaining a preset number of ratios corresponding to the second image;
[0121] A preset number of ratios corresponding to each second image is input into a preset visibility recognition model to obtain target visibility corresponding to the image; wherein the visibility recognition model is obtained by training based on historical images.
[0122] In one embodiment, when the processor executes the computer program, the following steps are also implemented: for each second image, a preset number of ratios corresponding to the second image are input into a preset visibility recognition model to obtain the visibility corresponding to the second image; wherein a second number of second images corresponds to a second number of visibilities; and the second number of visibilities are weighted to obtain the target visibility.
[0123] In one embodiment, when the processor executes the computer program, the following steps are also implemented: obtaining historical images, and determining a preset number of ratios corresponding to the historical images and the historical visibility corresponding to the historical images; using the preset number of ratios corresponding to the historical images as input and the historical visibility as supervision information, training a preset initial visibility recognition model to obtain a visibility recognition model.
[0124] In one embodiment, the processor also implements the following steps when executing the computer program: for each second image, determine the total number of pixels of the first image of each category in the second image; determine the ratio between the total number of pixels of the first image corresponding to each category and the total number of second pixels corresponding to the second image as one of a preset number of ratios corresponding to the second image; each category corresponds to a ratio, and the second image corresponds to a preset number of ratios.
[0125] In one embodiment, when the processor executes the computer program, the following steps are also implemented: for each second image, the first image corresponding to each category in the second image is determined as the first target image; the number of pixels corresponding to each first target image is obtained, and the sum of the number of pixels corresponding to each first target image is determined as the total number of pixels.
[0126] In one embodiment, when the processor executes the computer program, the following steps are also implemented: acquiring the transmittance corresponding to each first image to obtain a first number of transmittances; clustering the first number of transmittances according to cluster centers to obtain categories corresponding to the cluster centers.
[0127] In one embodiment, when the processor executes the computer program, the following steps are further implemented: for each first image, the transmittance corresponding to each first image is determined by a dark channel priori algorithm to obtain a first number of transmittances.
[0128] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0129] Dividing the target image vertically according to a second preset size to obtain a second number of second images;
[0130] Clustering the transmittances of a first number of first images according to a preset clustering center to obtain a preset number of categories corresponding to the clustering center;
[0131] For each second image, determining the proportion of the first image corresponding to each category in the second image, and obtaining a preset number of ratios corresponding to the second image;
[0132] A preset number of ratios corresponding to each second image is input into a preset visibility recognition model to obtain target visibility corresponding to the image; wherein the visibility recognition model is obtained by training based on historical images.
[0133] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: for each second image, a preset number of ratios corresponding to the second image are input into a preset visibility recognition model to obtain the visibility corresponding to the second image; wherein a second number of second images corresponds to a second number of visibilities; and the second number of visibilities are weighted to obtain the target visibility.
[0134] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: obtaining historical images, and determining a preset number of ratios corresponding to the historical images and the historical visibility corresponding to the historical images; using the preset number of ratios corresponding to the historical images as input and the historical visibility as supervision information, training a preset initial visibility recognition model to obtain a visibility recognition model.
[0135] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: for each second image, the total number of pixels of the first image of each category in the second image is determined; the ratio between the total number of pixels of the first image corresponding to each category and the total number of second pixels corresponding to the second image is determined as one of a preset number of ratios corresponding to the second image; each category corresponds to a ratio, and the second image corresponds to a preset number of ratios.
[0136] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: for each second image, the first image corresponding to each category in the second image is determined as the first target image; the number of pixels corresponding to each first target image is obtained, and the sum of the number of pixels corresponding to each first target image is determined as the total number of pixels.
[0137] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: obtaining the transmittance corresponding to each first image to obtain a first number of transmittances; clustering the first number of transmittances according to the cluster center to obtain the category corresponding to the cluster center.
[0138] In one embodiment, when the computer program is executed by the processor, the following steps are further implemented: for each first image, the transmittance corresponding to each first image is determined by a dark channel priori algorithm to obtain a first number of transmittances.
[0139] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0140] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0141] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A visibility determination method, characterized in that: The method comprises: Dividing the target image into regions according to a first preset size to obtain a first number of first images; Dividing the target image vertically according to a second preset size to obtain a second number of second images; Clustering the transmittances of the first number of first images according to preset cluster centers to obtain a preset number of categories corresponding to the cluster centers; For each of the second images, determining a total number of pixels of the first image of each category in the second image; Determine the ratio between the total number of pixels of the first image corresponding to each of the categories and the total number of second pixels corresponding to the second image as one of a preset number of ratios corresponding to the second image; each of the categories corresponds to one ratio, and the second image corresponds to a preset number of ratios; A preset number of ratios corresponding to each second image is input into a preset visibility recognition model to obtain target visibility corresponding to the image; wherein the visibility recognition model is obtained by training based on historical images.
2. The method according to claim 1, characterized in that: The step of inputting a preset number of ratios corresponding to each second image into a preset visibility recognition model to obtain the target visibility corresponding to the image includes: For each second image, inputting a preset number of ratios corresponding to the second image into a preset visibility recognition model to obtain the visibility corresponding to the second image; wherein the second number of second images corresponds to a second number of visibilities; The second number of visibility is weighted to obtain the target visibility.
3. The method according to claim 1 or 2, characterized in that: The method for obtaining the visibility recognition model includes: Acquire a historical image, and determine a preset number of ratios corresponding to the historical image and a historical visibility corresponding to the historical image; A preset number of ratios corresponding to the historical images are used as input, and the historical visibility is used as supervision information, and a preset initial visibility recognition model is trained to obtain the visibility recognition model.
4. The method according to claim 1, characterized in that: The step of determining, for each of the second images, a total number of pixels of each of the first images of the category in the second image comprises: For each of the second images, determining a first image corresponding to each of the categories in the second image as a first target image; The number of pixel points corresponding to each of the first target images is obtained, and the sum of the number of pixel points corresponding to each of the first target images is determined as the total number of pixel points.
5. The method according to claim 1, characterized in that The clustering of the transmittances of the first number of first images according to the preset cluster center to obtain the category corresponding to the cluster center includes: Acquire the transmittance corresponding to each of the first images to obtain the first number of transmittances; The first number of transmittances are clustered according to the cluster centers to obtain categories corresponding to the cluster centers.
6. The method according to claim 5, characterized in that The acquiring the transmittance corresponding to each of the first images to obtain the first number of transmittances includes: For each of the first images, the transmittance corresponding to each of the first images is determined by a dark channel priori algorithm to obtain the first number of transmittances.
7. A visibility determination device, characterized in that: The device comprises: A first image segmentation module, used to divide the target image into regions according to a first preset size to obtain a first number of first images; A second image segmentation module, used for dividing the target image vertically according to a second preset size to obtain a second number of second images; a transmittance clustering module, configured to cluster the transmittances of the first number of first images according to preset cluster centers, to obtain a preset number of categories corresponding to the cluster centers; a ratio determination module, configured to determine, for each of the second images, the total number of pixels of the first image of each of the categories in the second image; and determine the ratio between the total number of pixels of the first image corresponding to each of the categories and the total number of second pixels corresponding to the second image as one of a preset number of ratios corresponding to the second image; each of the categories corresponds to one ratio, and the second image corresponds to a preset number of ratios; The visibility determination module is used to input a preset number of ratios corresponding to each second image into a preset visibility recognition model to obtain the target visibility corresponding to the image; wherein the visibility recognition model is obtained by training based on historical images.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
