CN115761458B - Indoor and outdoor environment judging method, electronic equipment and storage medium - Google Patents

Indoor and outdoor environment judging method, electronic equipment and storage medium Download PDF

Info

Publication number
CN115761458B
CN115761458B CN202211486022.4A CN202211486022A CN115761458B CN 115761458 B CN115761458 B CN 115761458B CN 202211486022 A CN202211486022 A CN 202211486022A CN 115761458 B CN115761458 B CN 115761458B
Authority
CN
China
Prior art keywords
target
speckle
indoor
image frame
outdoor
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202211486022.4A
Other languages
Chinese (zh)
Other versions
CN115761458A (en
Inventor
刘祺昌
李东洋
王海彬
户磊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Lumingshi Technology Co ltd
Original Assignee
Beijing Lumingshi Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Lumingshi Technology Co ltd filed Critical Beijing Lumingshi Technology Co ltd
Priority to CN202211486022.4A priority Critical patent/CN115761458B/en
Publication of CN115761458A publication Critical patent/CN115761458A/en
Application granted granted Critical
Publication of CN115761458B publication Critical patent/CN115761458B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Image Analysis (AREA)
  • Studio Devices (AREA)

Abstract

The embodiment of the application relates to the field of image detection and discloses an indoor and outdoor environment judging method, electronic equipment and a storage medium. Shooting a target environment where a target object is located through a structured light camera to obtain a plurality of speckle patterns, wherein the gain and current parameters of a projector used in the shooting process corresponding to the speckle patterns are different; selecting a target speckle pattern from the images, and determining the indoor or outdoor of the target environment according to the image quality of a first image frame corresponding to a target object to be shot in the target speckle pattern; the higher the image quality is, the higher the probability of the indoor of the target environment is, and the higher the probability of the outdoor of the target environment is; according to the indoor or outdoor determination result of the target environment, the shooting parameters of the structured light camera are adjusted, and the target object is shot based on the adjusted structured light camera, so that the shooting task of the target object is finished with higher quality.

Description

Indoor and outdoor environment judging method, electronic equipment and storage medium
Technical Field
The embodiment of the application relates to the field of image processing, in particular to an indoor and outdoor environment judging method, electronic equipment and a storage medium.
Background
A Structured Light camera is a camera that obtains depth data by emitting an active infrared Light source, and a Structured Light method (Structured Light) assists in extracting depth information of an object according to stereoscopic information in the Light source by emitting Light having characteristic points to the object whose surface is smooth and has no characteristics. The specific process comprises two steps, namely firstly, projecting a encodable light beam to a target object by using a laser projector to generate a characteristic point; and then calculating the distance between the camera optical center and the characteristic points according to the projection mode and the geometric pattern of the projection light by using a triangulation principle, thereby obtaining the depth information of the generated characteristic points and realizing model reconstruction.
Currently, structured light cameras applied to the market generally employ the same Auto exposure (Auto exposure) method both indoors and outdoors. However, under outdoor environment, because the influence of sunlight can annihilate the infrared laser speckles emitted by the camera, if the same shooting parameters are adopted indoors and outdoors, the working quality of the camera under the outdoor environment can be seriously influenced, so that an indoor and outdoor environment judging method is needed to work in a mode more suitable for the indoor and outdoor environments, and the working tasks under the affiliated environments can be finished with higher quality.
Disclosure of Invention
The embodiment of the application aims to provide an indoor and outdoor environment judging method, electronic equipment and a storage medium, which can be used for rapidly judging the indoor and outdoor environment of a target object to be shot by utilizing a structured light camera, so that the structured light camera is adjusted to operate by using a correct algorithm and parameters, and the quality of a shot image is improved.
In order to solve the above technical problems, an embodiment of the present application provides an indoor and outdoor environment determining method, including:
shooting a target environment where a target object is located through a structured light camera to obtain a plurality of speckle patterns, wherein the gain and current parameters of a projector used in the shooting process corresponding to the speckle patterns are different;
selecting a target speckle pattern from the plurality of speckle patterns;
determining whether the target environment belongs to the indoor or outdoor according to the image quality of a first image frame corresponding to a predetermined target object in the target speckle pattern; the higher the image quality is, the higher the probability that the target environment belongs to the indoor space is, and the higher the probability that the target environment belongs to the outdoor space is;
and adjusting shooting parameters of the structured light camera according to the indoor or outdoor determination result of the target environment, and shooting the target object based on the adjusted structured light camera.
The embodiment of the application also provides electronic equipment, which comprises:
at least one processor; and a memory communicatively coupled to the at least one processor; wherein,,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the indoor and outdoor environment discrimination method as described above.
Embodiments of the present application also provide a computer-readable storage medium storing a computer program which, when executed by a processor, implements the indoor and outdoor environment discrimination method as described above.
Compared with the prior art, the embodiment of the application obtains a plurality of speckle patterns by shooting the target environment where the target object is located through the structured light camera, and the gain and current parameters of the projector used in the shooting process corresponding to the speckle patterns are different; selecting a target speckle pattern from a plurality of speckle patterns; determining the indoor or outdoor of the target environment according to the image quality of a first image frame corresponding to a predetermined target object in a target speckle pattern; the higher the image quality is, the higher the probability of the indoor of the target environment is, and the higher the probability of the outdoor of the target environment is; and adjusting shooting parameters of the structured light camera according to the indoor or outdoor determination result of the target environment, and shooting the target object based on the adjusted structured light camera. According to the scheme, before the target object to be shot is shot, the indoor and outdoor types of the target environment where the target object is located are rapidly judged by the structured light camera, and the shooting parameters of the structured light camera are adjusted based on the judging result, so that the structured light camera is more suitable for shooting the indoor and outdoor types of the target environment, and the shooting task of the target object can be finished with high quality by the structured light camera.
Drawings
One or more embodiments are illustrated by way of example and not limitation in the figures of the accompanying drawings, in which like references indicate similar elements, and in which the figures of the drawings are not to be taken in a limiting sense, unless otherwise indicated.
FIG. 1 is a flowchart of an indoor and outdoor environment determining method according to an embodiment of the present application;
FIG. 2 is a second flowchart of an indoor and outdoor environment determining method according to an embodiment of the present application;
FIG. 3 is a flowchart III of an indoor and outdoor environment discrimination method according to an embodiment of the present application;
FIG. 4 is a flowchart of an indoor and outdoor environment discrimination method according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of an electronic device provided by the present application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present application more apparent, the following detailed description of the embodiments of the present application will be given with reference to the accompanying drawings. However, those of ordinary skill in the art will understand that in various embodiments of the present application, numerous technical details have been set forth in order to provide a better understanding of the present application. However, the claimed application may be practiced without these specific details and with various changes and modifications based on the following embodiments.
An embodiment of the present application relates to an indoor and outdoor environment determining method, as shown in fig. 1, where the indoor and outdoor environment determining method provided in this embodiment includes the following steps.
Step 101: and shooting the target environment where the target object is positioned by using the structured light camera to obtain a plurality of speckle patterns, wherein the gain and current parameters of a projector used in the shooting process corresponding to the speckle patterns are different.
The speckle pattern may be a speckle image of a face captured by a depth camera in a face recognition scene. The projector is a laser projector in a structured light camera, and is used for projecting a structured light pattern (speckle pattern) to a target scene so as to obtain a speckle pattern through shooting, and the speckle patterns with different qualities can be correspondingly obtained through adjusting the gain and current parameters of the projector. The target environment is the environment where the target object to be shot is located when shooting.
Specifically, before formally photographing a target object, the indoor and outdoor environments where a scene is located can be determined, and in this step, a speckle pattern for judging the indoor and outdoor environments is photographed. In order to select a speckle pattern with better image quality, the embodiment photographs a plurality of speckle patterns with different quality, and in particular, can acquire a plurality of corresponding speckle patterns with different image quality by adjusting gain and current parameters of a projector of a structured light camera during photographing. The adjustment mode may be manual adjustment or automatic adjustment of the camera.
Step 102: a target speckle pattern is selected from the plurality of speckle patterns.
Specifically, after a plurality of speckle patterns of different image quality are acquired, one speckle pattern is selected from the plurality of speckle patterns as a target speckle pattern. The selection manner of the target speckle pattern is not limited in this embodiment, and may be selected randomly or according to a certain standard, such as image quality, shooting order, and the like.
Step 103: determining the indoor or outdoor of the target environment according to the image quality of a predetermined target object corresponding to a first image frame in a target speckle pattern; the higher the image quality, the greater the probability that the target environment belongs to the indoor, and conversely, the greater the probability that the target environment belongs to the outdoor.
In general, the image quality of a photographed speckle pattern is not very high due to the fact that outdoor ambient light is not constant and the influence on a photographed image is large; the indoor light is softer, and the image quality of the shot speckle pattern is better, so that whether the target environment where the target object is located belongs to the indoor or the outdoor can be judged generally according to the image quality, the higher the image quality is, the greater the probability that the target environment is indoor is, and the greater the probability that the target environment is outdoor is conversely.
Specifically, in the process of acquiring a target speckle pattern for a target object to be shot and determining the indoor and outdoor environments to which a target scene belongs, the position of the target object can be determined in the target speckle pattern, and an image frame containing the target object is determined in an image area where the position is located and is recorded as a first image frame.
Step 104: and adjusting shooting parameters of the structured light camera according to the indoor or outdoor determination result of the target environment, and shooting the target object based on the adjusted structured light camera.
The application does not limit specific shooting parameters, and can adaptively adjust the shooting parameters according to the actual target environment when shooting speckle images, so that the camera with the adjusted shooting parameters can obtain higher-quality images in the current target environment.
Specifically, when the target environment where the target object is located is determined to be a room with soft light, the aperture coefficient and the exposure compensation can be adjusted to be in a moderate state; when the target environment where the target object is located is determined to be outdoors where sunlight is strong, parameters such as sensitivity and aperture can be reduced. After the shooting parameters are automatically adjusted, the structured light camera can enter a formal shooting state, at the moment, shooting staff can easily shoot speckle images which can be more suitable for indoor and outdoor light to a certain extent by using the structured light camera after the shooting parameters are adjusted, high-quality shooting images are obtained, and shooting experience is improved.
Compared with the related art, the method has the advantages that the structural light camera is used for shooting the target environment where the target object is located to obtain a plurality of speckle patterns, and the gain and current parameters of the projector used in the shooting process corresponding to the speckle patterns are different; selecting a target speckle pattern from the plurality of speckle patterns; determining the indoor or outdoor of the target environment according to the image quality of a first image frame corresponding to a target object to be shot in a target speckle pattern; the higher the image quality is, the higher the probability of the indoor of the target environment is, and the higher the probability of the outdoor of the target environment is; and adjusting shooting parameters of the structured light camera according to the indoor or outdoor determination result of the target environment, and shooting the target object based on the adjusted structured light camera. According to the scheme, before the target object to be shot is shot, the indoor and outdoor types of the target environment where the target object is located are rapidly judged by the structured light camera, and the shooting parameters of the structured light camera are adjusted based on the judging result, so that the structured light camera is more suitable for shooting the indoor and outdoor types of the target environment, and the shooting task of the target object can be finished with high quality by the structured light camera.
Another embodiment of the present application relates to an indoor and outdoor environment discriminating method, which is an improvement of the foregoing embodiment, and the improvement is that the process of obtaining a plurality of speckle patterns is refined. As shown in fig. 2, the above step 101 may include the following sub-steps.
Sub-step 1011: when the lens of the structured light camera is in an infrared mode, a plurality of infrared images are shot for a target object to be shot, a target infrared image with exposure time meeting a preset requirement is determined from the plurality of infrared images, and a second image frame in which the target object in the target infrared image is located is determined.
Wherein the lens of the structured light camera may be configured in two shooting modes: the device comprises an infrared mode and a speckle mode, wherein the infrared mode is used for shooting to obtain an infrared image, and the speckle mode is used for shooting to obtain a speckle image. The exposure time is a camera parameter set when the infrared image is shot, and one exposure time can obtain the infrared image with one exposure effect.
The exposure time meeting the preset requirement can be the exposure time corresponding to the infrared image of the target object just detected, the exposure time corresponding to the infrared image with the image effect meeting a certain standard, or a preset fixed time. The application does not limit specific preset requirements, and the user can set the specific preset requirements according to actual requirements during operation.
Specifically, when an infrared image is shot, the lens of the structured light camera is adjusted to an infrared mode, and the adjustment can be automatic adjustment of the camera or manual adjustment. And adjusting different exposure time to shoot and obtain a plurality of infrared images with different quality, selecting the infrared image with the exposure time meeting the preset requirement as a target infrared image, determining the position of a target object in the target infrared image, determining an image frame containing the target object in an image area where the position is located, and marking the image frame as a second image frame.
In one example, this sub-step may be implemented as follows.
Step one: when the lens of the structured light camera is in the infrared mode, the preset intermediate exposure time is taken as the initial exposure time, the initial exposure time is respectively increased and decreased by the same stepping value, and a plurality of infrared images are obtained through shooting under the obtained exposure times.
The preset intermediate exposure time can be any exposure time within a certain exposure time range, and the initial exposure time is set only for conveniently and quickly iterating to find the target object on the infrared image.
Specifically, when the lens of the structured light camera is in the infrared mode, an intermediate exposure time t0 is preset for shooting a plurality of infrared images, the exposure time is set in the directions of increasing and decreasing from t0 with the stepping values of k1 and-k 1 respectively, and the plurality of infrared images are shot under the set different exposure times. If the exposure value reaches the limit value kmin or kmax, resetting the exposure time to t0, and readjusting the exposure according to the set stepping value to prevent the exposure adjustment from entering an invalid process without limit reduction or increase in the unmanned scene.
Step two: and determining the infrared image which is detected to contain the target object for the first time in the plurality of infrared images as a target infrared image which meets the requirement of exposure time.
Specifically, in setting the intermediate exposure time t0 and gradually increasing and decreasing the exposure time by a step value, an infrared image at each exposure time is photographed and read. Sequentially sending the obtained infrared images into a target object detection unit, and detecting whether a target object exists in the infrared images; when the infrared image including the target object is detected for the first time, the subsequent infrared image acquisition process may be stopped, and the infrared image including the target object detected for the first time may be determined as the target infrared image.
In addition, if the number of times of resetting the initial exposure time t0 exceeds several times and the target object is not detected yet, in order to enable the operation process to continue, an infrared image may be randomly selected as the target infrared image, and the second image frame may be set as the middle area of the target infrared image.
Sub-step 1012: after the target infrared image is obtained, adjusting a lens of the structured light camera to be in a speckle mode, and shooting a plurality of speckle images aiming at a target object to be shot; the position of the second image frame in the target infrared image is the same as the position of the first image frame in the target speckle pattern.
The infrared image and the speckle image are obtained in the same lens in two shooting modes, the infrared image is shot first, then the lens mode is switched to shoot the speckle image, and the corresponding relation between the infrared image and the speckle image can be determined through hard synchronization or soft synchronization. And determining the position of the target object to be shot in the speckle pattern by determining the target infrared pattern, and further circling an image frame of the target object in the speckle pattern. For ease of calculation, the second image frame in which the target object is located in the speckle pattern may be determined based on the position of the first image frame in the infrared pattern.
Specifically, after obtaining a target infrared image and determining a second image frame on the target infrared image, adjusting a lens of the structured light camera to be in a speckle mode, adjusting gain and current parameters of a projector of the structured light camera during shooting to obtain a plurality of corresponding speckle images with different image quality, and determining the target speckle image from the speckle images. And determining the position of the first image frame in the target speckle pattern according to the determined position of the second image frame in the target infrared pattern, wherein the position of the second image frame in the target infrared pattern is the same as the position of the first image frame in the target speckle pattern.
Compared with the prior art, when the lens of the structured light camera is in the infrared mode, shooting a target object to be shot to obtain a plurality of infrared images, determining a target infrared image with exposure time meeting preset requirements from the plurality of infrared images, and determining a second image frame in which the target object in the target infrared image is located; after the target infrared image is obtained, the lens of the structured light camera is adjusted to be in a speckle mode, a plurality of speckle images are shot for the target object to be shot, and the position of the second image frame in the target infrared image is the same as that of the first image frame in the target speckle image. The method comprises the steps of firstly adopting exposure time to obtain a target infrared image meeting the requirement of the exposure time in a step value scanning mode; and then, the lens mode is switched to be a speckle mode, a plurality of speckle patterns corresponding to the target infrared pattern are obtained under the condition that the lens position is not changed, and the position of the second image frame in the target infrared pattern is designated to be the same as the position of the first image frame in the target speckle pattern, so that the time for determining the position of the target object in the speckle pattern is saved, and resources are saved.
Another embodiment of the present application relates to an indoor and outdoor environment discriminating method, which is an improvement of the foregoing embodiment, and the improvement is that the process of selecting the target speckle pattern is refined. Taking the embodiment shown in fig. 1 as an example, as shown in fig. 3, the above step 102 may include the following substeps.
Substep 1021: and respectively carrying out low-pass filtering processing on the first image frame of each speckle pattern in the plurality of speckle patterns to obtain an optimized first image frame.
The low-pass filtering process can attenuate the space high-frequency part signal of the first image frame, and filter out sharp and obvious-change places in the image.
Specifically, after the position of the first image frame is determined, the first image frame of each speckle pattern in the plurality of speckle patterns is respectively subjected to low-pass filtering processing, that is, optimization processing is performed on the first image frame, and noise data is filtered.
Sub-step 1022: and calculating the contrast of the pixel values in each optimized first image frame, and taking the optimized first image frame with the largest contrast as a target speckle pattern selected from a plurality of speckle patterns.
Specifically, after each first image frame after the low-pass filtering process (after optimization) is obtained, the contrast of the pixel values in each optimized first image frame is calculated. In general, the higher the contrast, the better the speckle quality of the image. Therefore, the optimized first image frame with the largest contrast is taken as the target speckle pattern.
Compared with the prior art, the method and the device have the advantages that the optimized first image frame is obtained by respectively carrying out low-pass filtering processing on the first image frame of each speckle pattern in the plurality of speckle patterns; and calculating the contrast of the pixel values in each optimized first image frame, and taking the optimized first image frame with the largest contrast as a target speckle pattern selected from a plurality of speckle patterns. According to the method, the first image frame is subjected to low-pass filtering optimization processing, and the speckle pattern with the largest contrast ratio is selected from the processed speckle patterns to serve as the target speckle pattern, so that the target speckle pattern meeting certain brightness requirements is rapidly obtained.
Another embodiment of the present application relates to an indoor and outdoor environment determining method, which is an improvement of the foregoing embodiment, and the improvement is that the process of determining whether the target environment belongs to the indoor or outdoor environment is refined. Taking the embodiment shown in fig. 1 as an example, as shown in fig. 4, the above step 103 may include the following substeps.
Substep 1031: and downsampling a first image frame corresponding to the predetermined target object in the target speckle pattern to obtain a third image frame.
Wherein the third image frame is at the same location in the target speckle pattern as the first image frame. The downsampling operation is performed to ensure the visibility of the speckle grains while minimizing the resolution.
Specifically, after determining the position of the first image frame in the target speckle pattern according to the position of the second image frame in the target infrared pattern, performing downsampling operation on the obtained first image frame to obtain a third image frame.
Sub-step 1032: respectively constructing first pixel areas by taking each pixel point in a third image frame as a center, respectively carrying out normalized correlation matching on each first pixel area and a pre-established speckle pattern template, determining a similarity measurement value corresponding to the central pixel point of the first pixel area based on a matching result, and marking the central pixel point with the similarity measurement value larger than a first threshold value as a first-level speckle; the size and the shape of the speckle pattern template are the same as those of the first pixel region, but the specific size and the specific shape are not limited; the speckle pattern template contains only one speckle, and the speckle conforms to a two-dimensional gaussian distribution.
The first pixel area is built by taking each pixel point in the third image frame as a center, and the specific building method is not limited by the application. The speckle in the pre-created speckle template obeys a two-dimensional normal distribution (two-dimensional gaussian distribution) with the brightest point as the center, so that the template constructed by the embodiment imitates the characteristic is also an image with the center pixel point as the center and the gray value obeying the two-dimensional gaussian distribution. This allows a better matching calculation of the template and the third image frame above.
The specific formula for the two-dimensional gaussian function is given as follows:
wherein, sigma is standard deviation, (x, y) corresponds to the coordinates of the pixel point in the template.
Specifically, after downsampling to obtain a third image frame, respectively constructing a first pixel area with each pixel point in the third image frame as a center, wherein the first pixel area can be a rectangular area with n being n; the speckle template can be a speckle pattern with the same size as n x n obtained by the two-dimensional Gaussian function, the template pattern only contains one speckle, and the middle of the image is the center of the speckle and the point with the maximum speckle gray value. Traversing the third image frame after downsampling pixel by pixel, carrying out normalized correlation matching on the first pixel region with n x n and the speckle template by taking the current pixel as the center, obtaining a similarity value of the current pixel based on a matching result, and marking the current pixel as a first-level speckle if the similarity value is larger than a threshold value thresh 1.
Substep 1033: and determining the indoor or outdoor of the target environment according to the distribution condition of the first-level speckle.
In this embodiment, the first-order speckle represents that the pixel points serving as the first-order speckle in the third image frame have higher similarity with the speckle with good quality in the template, so that the larger the number of the first-order speckle, the more speckle with high similarity with the speckle template is proved, and the better the speckle effect is, the higher the image quality is.
Specifically, the present example decides the image quality of the third image frame by calculating the distribution situation of the first-order speckle, for example, how many first-order speckle are, and the distribution (whether or not they are uniform) of these first-order speckle in the third image frame, and determines whether the environment to which it belongs is indoor or outdoor according to the image quality level. For example, the more first order speckle, the more evenly distributed in the third image frame, representing a higher speckle image quality for the third image frame. In the present embodiment, the evaluation principle is followed but the manner of specifically evaluating the image quality is not limited.
In one example, this substep 1033 may be implemented as follows.
Step one: respectively constructing second pixel areas by taking each first-level scattered spot in the third image frame as a center, and recording the first-level scattered spots with gray values larger than all the residual pixel points as second-level scattered spots for each second pixel area;
the second pixel area is constructed by taking the first-order scattered spots as the center, and the application does not limit how to construct the second pixel area and the shape and the size of the constructed second pixel area, and only takes the first-order scattered spots as the center.
Specifically, traversing each first-level scattered spot, searching for a scattered spot gray value within the range of n2 pixels of the current point, and marking the current first-level scattered spot as a second-level scattered spot if the current first-level scattered spot is the brightest point in the neighborhood. I.e. the gray value of the current first-order speckle is the largest in the second pixel area which is built by taking the current first-order speckle as the center, the current first-order speckle is marked as the second-order speckle.
Step two: and determining the indoor or outdoor of the target environment according to the distribution condition of the secondary speckle points.
In this embodiment, when the second-level speckle represents the second-level speckle as the first-level speckle, the second-level speckle is the brightest pixel point in the second pixel region, and the better the speckle effect, the higher the image quality.
Specifically, the image quality of the third image frame is determined by calculating the distribution condition of the secondary speckle, for example, the number of secondary speckle, and the distribution (whether or not the secondary speckle is uniform) of the secondary speckle in the third image frame, and whether the environment is indoor or outdoor is determined according to the image quality. For example, the greater the number of secondary speckle distributions in the third image frame, the higher the contrast of the individual speckle to surrounding pixels, and the better the speckle effect, the higher the image quality of the third image frame. In the present embodiment, the evaluation principle is followed but the manner of specifically evaluating the image quality is not limited.
In one example, this step two may be implemented as follows.
Step (1): respectively constructing a third pixel area and a fourth pixel area by taking each second-level scattered spot in the third image frame as a center, and counting the ratio between the sum of the gray values of the third pixel area and the sum of the gray values of the fourth pixel area corresponding to each second-level scattered spot; wherein the third pixel region is included in the fourth pixel region;
wherein, each group of third pixel area and fourth pixel area is built by taking the same two-level scattered spots as the center.
Specifically, after the second-level scattered spots are determined, a third pixel area and a fourth pixel area are respectively constructed by taking each second-level scattered spot in the third image frame as a center. The specific construction method is not limited by the application. For example, a second-level scattered spot is taken as the center, and a third pixel area and a fourth pixel area with circular radiuses of r1 and r2 (r 1< r 2) are respectively constructed; for example, a third pixel region and a fourth pixel region of a rectangle are respectively constructed by taking one two-level scattered spot as a diagonal intersection of the rectangle, and the diagonals are a1 and a2 (a 1< a 2). And taking each secondary scattered spot as a center, and respectively counting the ratio of the sum of the gray values of the third pixel area and the sum of the gray values of the fourth pixel area corresponding to each secondary scattered spot so as to determine the tertiary scattered spots according to the ratio result.
Step (II): and marking the second-level scattered spots with the corresponding ratio larger than the second threshold value as third-level scattered spots, and determining the indoor or outdoor of the target environment according to the ratio of the total number of the pixel points in the third image frame of the third-level scattered spots.
Specifically, the second threshold value is set to be p1, for example, the current second-level speckle is set to be the center, the ratio of the sum of gray values in the circular area with the radius r1 to the sum of gray values in the circular area with the radius r2 (r 1< r 2) is set to be p0, and if p0> p1, the second-level speckle is marked as the third-level speckle, and the speckle particle is constrained in morphology. And after the three-level scattered spots are obtained, calculating the ratio of the number of the three-level scattered spots in the total number of the pixel points in the third image frame. The larger the duty ratio is, the larger the probability of the corresponding target environment in the room is, otherwise, the larger the probability of the corresponding target environment in the room is.
In one example, when the ratio of the number of three-level scattered spots to the total number of pixels in the third image frame is greater than a third threshold, determining that the target environment belongs to the room, or else, the target environment belongs to the room.
The three-level scattered spots represent high-quality scattered spots, so that the larger the three-level scattered spots occupy in the total number of pixel points in the third image frame, the more the three-level scattered spots represent high-quality scattered spots in the pixel points in the third image frame, the higher the image quality, and the greater the possibility of corresponding to indoor environments.
Specifically, the number of three-level scattered spots is counted, the total number is divided by the total number of pixels in the third image frame, and the larger the three-level scattered spots are, the more corresponding high-quality scattered spots are, the higher the image quality is, and the greater the possibility of corresponding to the indoor environment is. If the obtained probability value is larger than the threshold value p2, the current environment is considered to be indoor, otherwise, the current environment is considered to be outdoor.
Compared with the related art, in the embodiment, the first pixel areas are respectively constructed by taking each pixel point in the third image frame as the center, each first pixel area is respectively subjected to normalized related matching with the pre-established speckle pattern template, the similarity value of the central pixel point of the corresponding first pixel area is determined based on the matching result, and the central pixel point with the similarity value larger than the first threshold value is marked as a first-level speckle; the size and the shape of the speckle pattern template are the same as those of the first pixel region; the speckle pattern template only comprises one speckle, and the speckle accords with two-dimensional Gaussian distribution; according to the distribution condition of the first-level speckle points, determining the indoor or outdoor of the target environment; respectively constructing second pixel areas by taking each first-level scattered spot in the third image frame as a center, and recording the first-level scattered spots with gray values larger than all the residual pixel points as second-level scattered spots for each second pixel area; according to the distribution condition of the second-level speckle points, determining the indoor or outdoor of the target environment; respectively constructing a third pixel area and a fourth pixel area by taking each second-level scattered spot in the third image frame as a center, and counting the ratio between the sum of the gray values of the third pixel area and the sum of the gray values of the fourth pixel area corresponding to each second-level scattered spot; wherein the third pixel region is included in the fourth pixel region; the corresponding second scattered spots with the ratio larger than the second threshold value are marked as third scattered spots, and the indoor or outdoor of the target environment is determined according to the ratio of the total number of the pixel points in the third image frame of the third scattered spots; and when the ratio of the total number of the three-level scattered spots in the total number of the pixel points in the third image frame is larger than a third threshold value, determining that the target environment belongs to the indoor space, or else, determining that the target environment belongs to the outdoor space. According to the technical scheme, the first-stage speckle, the second-stage speckle and the third-stage speckle are selected in a progressive manner, further quality detection is carried out on speckle images, and the indoor or outdoor of a target environment can be determined according to the distribution conditions of the first-stage speckle, the second-stage speckle and the third-stage speckle. And finally, judging whether the target environment belongs to the room or the room according to the ratio of the three-level scattered spots in the total number of pixel points in the third image frame, wherein the judging process is deep layer by layer, so that the accuracy of a judging result is ensured.
Another embodiment of the application is directed to an electronic device, as shown in fig. 5, comprising at least one processor 202; and a memory 201 communicatively coupled to the at least one processor 202; wherein the memory 201 stores instructions executable by the at least one processor 202, the instructions being executable by the at least one processor 202 to enable the at least one processor 202 to perform any one of the method embodiments described above.
Where memory 201 and processor 202 are connected by a bus, the bus may comprise any number of interconnected buses and bridges, the buses connecting together various circuits of one or more of the processor 202 and memory 201. The bus may also connect various other circuits such as peripherals, voltage regulators, and power management circuits, which are well known in the art, and therefore, will not be described any further herein. The bus interface provides an interface between the bus and the transceiver. The transceiver may be one element or may be a plurality of elements, such as a plurality of receivers and transmitters, providing a means for communicating with various other apparatus over a transmission medium. The data processed by the processor 202 is transmitted over a wireless medium via an antenna, which further receives the data and transmits the data to the processor 202.
The processor 202 is responsible for managing the bus and general processing and may also provide various functions including timing, peripheral interfaces, voltage regulation, power management, and other control functions. And memory 201 may be used to store data used by processor 202 in performing operations.
Another embodiment of the present application relates to a computer-readable storage medium storing a computer program. The computer program implements the above-described method embodiments when executed by a processor.
That is, it will be understood by those skilled in the art that all or part of the steps in implementing the methods of the embodiments described above may be implemented by a program stored in a storage medium, where the program includes several instructions for causing a device (which may be a single-chip microcomputer, a chip or the like) or a processor (processor) to perform all or part of the steps in the methods of the embodiments of the application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
It will be understood by those of ordinary skill in the art that the foregoing embodiments are specific examples of carrying out the application and that various changes in form and details may be made therein without departing from the spirit and scope of the application.

Claims (9)

1. An indoor and outdoor environment discriminating method is characterized by comprising the following steps:
shooting a target environment where a target object is located through a structured light camera to obtain a plurality of speckle patterns; the gain and current parameters of the projector used in the shooting process corresponding to the speckle patterns are different;
selecting a target speckle pattern from the plurality of speckle patterns;
determining whether the target environment belongs to the indoor or outdoor according to the predetermined image quality of a first image frame corresponding to the target object in the target speckle pattern; the higher the image quality is, the higher the probability that the target environment belongs to the indoor space is, and the higher the probability that the target environment belongs to the outdoor space is;
according to the indoor or outdoor determination result of the target environment, adjusting shooting parameters of the structured light camera, and shooting the target object based on the adjusted structured light camera;
the determining whether the target environment belongs to the indoor or the outdoor according to the predetermined image quality of the first image frame corresponding to the target object in the target speckle pattern comprises the following steps:
downsampling the first image frame corresponding to the predetermined target object in the target speckle pattern to obtain a third image frame;
respectively constructing first pixel areas by taking each pixel point in the third image frame as a center, respectively carrying out normalized correlation matching on each first pixel area and a pre-established speckle pattern template, determining a similarity value corresponding to the central pixel point of the first pixel area based on a matching result, and marking the central pixel point with the similarity value larger than a first threshold value as a first-level speckle; the size and shape of the speckle pattern template and the first pixel area are the same; the speckle pattern template only comprises one speckle, and the speckle accords with two-dimensional Gaussian distribution;
and determining the indoor or outdoor of the target environment according to the distribution condition of the first-level speckle points.
2. The method of claim 1, wherein capturing, by the structured light camera, the target environment in which the target object is located to obtain a plurality of speckle patterns, comprises:
when the lens of the structured light camera is in an infrared mode, shooting the target object to obtain a plurality of infrared images, determining a target infrared image with exposure time meeting preset requirements from the plurality of infrared images, and determining a second image frame in which the target object is located in the target infrared image;
after the target infrared image is obtained, adjusting a lens of the structured light camera to be in a speckle mode, and shooting the plurality of speckle images for the target object, wherein the position of the second image frame in the target infrared image is the same as that of the first image frame in the target speckle image.
3. The method according to claim 2, wherein when the lens of the structured light camera is in the infrared mode, capturing a plurality of infrared images for the target object, and determining a target infrared image with an exposure time meeting a preset requirement from the plurality of infrared images, includes:
when the lens of the structured light camera is in an infrared mode, taking a preset intermediate exposure time as an initial exposure time, respectively increasing and decreasing the initial exposure time by the same stepping value, and shooting under the obtained multiple exposure times to obtain multiple infrared images;
and determining the infrared image which is detected to contain the target object for the first time in the plurality of infrared images as a target infrared image which meets the exposure time requirement.
4. A method according to any one of claims 1-3, wherein said selecting a speckle pattern from said plurality of speckle patterns comprises:
respectively performing low-pass filtering processing on the first image frame of each speckle pattern in the plurality of speckle patterns to obtain an optimized first image frame;
and calculating the contrast of pixel values in each optimized first image frame, and taking the optimized first image frame with the largest contrast as the target speckle pattern selected from the plurality of speckle patterns.
5. The method according to claim 1, wherein determining whether the target environment belongs to the room or the room according to the distribution condition of the first-order speckle points comprises:
respectively constructing second pixel areas by taking each first-level scattered spot in the third image frame as a center, and recording the first-level scattered spots with gray values larger than all the residual pixel points as second-level scattered spots for each second pixel area;
and determining the indoor or outdoor of the target environment according to the distribution condition of the secondary speckle points.
6. The method of claim 5, wherein determining whether the target environment is indoor or outdoor according to the distribution of the secondary speckle, comprises:
respectively constructing a third pixel area and a fourth pixel area by taking each second-level scattered spot in the third image frame as a center, and counting the ratio between the sum of gray values of the third pixel area and the sum of gray values of the fourth pixel area corresponding to each second-level scattered spot; wherein the third pixel region is included in the fourth pixel region;
and marking the corresponding second-level scattered spots with the ratio larger than a second threshold value as third-level scattered spots, and determining the indoor or outdoor of the target environment according to the ratio of the number of the third-level scattered spots in the total number of the pixel points in the third image frame.
7. The method of claim 6, wherein determining whether the target environment is indoor or outdoor based on the ratio of the number of three-level speckle to the total number of pixels in the third image frame comprises:
and when the ratio of the total number of the three-level scattered spots in the total number of the pixel points in the third image frame is larger than a third threshold value, determining that the target environment belongs to the indoor space, or else, the target environment belongs to the outdoor space.
8. An electronic device, comprising:
at least one processor; the method comprises the steps of,
a memory communicatively coupled to the at least one processor; wherein,,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the indoor and outdoor environment discrimination method according to any one of claims 1 to 7.
9. A computer-readable storage medium storing a computer program, wherein the computer program when executed by a processor implements the indoor and outdoor environment discrimination method according to any one of claims 1 to 7.
CN202211486022.4A 2022-11-24 2022-11-24 Indoor and outdoor environment judging method, electronic equipment and storage medium Active CN115761458B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211486022.4A CN115761458B (en) 2022-11-24 2022-11-24 Indoor and outdoor environment judging method, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211486022.4A CN115761458B (en) 2022-11-24 2022-11-24 Indoor and outdoor environment judging method, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN115761458A CN115761458A (en) 2023-03-07
CN115761458B true CN115761458B (en) 2023-09-01

Family

ID=85337504

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211486022.4A Active CN115761458B (en) 2022-11-24 2022-11-24 Indoor and outdoor environment judging method, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115761458B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103544501A (en) * 2013-10-28 2014-01-29 哈尔滨商业大学 Indoor and outdoor scene classification method based on Fourier transformation
CN106529545A (en) * 2016-09-26 2017-03-22 北京林业大学 Speckle image quality recognition method and system based on image feature description
CN107341481A (en) * 2017-07-12 2017-11-10 深圳奥比中光科技有限公司 It is identified using structure light image
CN214252775U (en) * 2021-03-15 2021-09-21 北京华捷艾米科技有限公司 Structured light emitter, depth camera and depth recognition terminal

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101737518B1 (en) * 2015-10-27 2017-05-18 성균관대학교산학협력단 Method and system for determining optimal exposure time and frequency of structured light based 3d camera

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103544501A (en) * 2013-10-28 2014-01-29 哈尔滨商业大学 Indoor and outdoor scene classification method based on Fourier transformation
CN106529545A (en) * 2016-09-26 2017-03-22 北京林业大学 Speckle image quality recognition method and system based on image feature description
CN107341481A (en) * 2017-07-12 2017-11-10 深圳奥比中光科技有限公司 It is identified using structure light image
CN214252775U (en) * 2021-03-15 2021-09-21 北京华捷艾米科技有限公司 Structured light emitter, depth camera and depth recognition terminal

Also Published As

Publication number Publication date
CN115761458A (en) 2023-03-07

Similar Documents

Publication Publication Date Title
CN113766125B (en) Focusing method and device, electronic equipment and computer readable storage medium
US8582001B2 (en) Exposure control for high dynamic range image capture
US9501834B2 (en) Image capture for later refocusing or focus-manipulation
US7079763B2 (en) Focus control apparatus, image sensor, program and storage medium
CN108076278A (en) A kind of Atomatic focusing method, device and electronic equipment
CN102857688B (en) There is imaging device and the control method thereof of subject measuring ability
JP4364078B2 (en) Imaging method and imaging apparatus
US9066002B2 (en) System and method for utilizing enhanced scene detection in a depth estimation procedure
KR101737518B1 (en) Method and system for determining optimal exposure time and frequency of structured light based 3d camera
CN104092947A (en) Image pick-up apparatus and method of recognizing face
JP4677226B2 (en) Image processing apparatus and method
US8810665B2 (en) Imaging device and method to detect distance information for blocks in secondary images by changing block size
CN114862779A (en) Image quality evaluation method, electronic device, and storage medium
CN115761458B (en) Indoor and outdoor environment judging method, electronic equipment and storage medium
CN114529509B (en) Image noise evaluation method, electronic device, and computer-readable storage medium
EP1286539A1 (en) Camera control
US11716536B2 (en) Control device, image capturing apparatus, and control method for detecting obstacle
WO2022011657A1 (en) Image processing method and apparatus, electronic device, and computer-readable storage medium
CN115242979A (en) Focusing method and system applied to blood shooting, intelligent equipment and storage medium
WO2021223113A1 (en) Metering method, camera, electronic device, and computer-readable storage medium
WO2023087960A1 (en) Projection device and focusing method
WO2024032125A1 (en) Camera monitoring method and apparatus
CN113179371B (en) Shooting method, device and snapshot system
CN114885104B (en) Method for adaptive adjustment of camera, readable storage medium and navigation system
US20230196722A1 (en) Learning apparatus and control method thereof

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant