Disclosure of Invention
The invention aims to provide a remote automatic light control system which is simple in structure and algorithm and high in execution accuracy.
In order to solve the technical problems, the invention adopts the following technical scheme: a remote light automation system, comprising:
the front camera is fixedly arranged in front of the classroom and used for monitoring the change condition of personnel in the classroom and recording videos;
the rear camera is fixedly arranged behind the classroom and used for monitoring the change condition of personnel in the classroom and recording videos;
the side camera is fixedly arranged on the left side or the right side of the classroom and used for monitoring the change condition of personnel in the classroom and recording videos;
the control center is in communication connection with the front camera, the rear camera and the side cameras and comprises a light controller and an image processing and operation unit;
the light switch is only used for controlling the on and off of light in the middle seat area of the classroom;
the classroom is divided into a plurality of seat areas including a middle seat area, and the front camera, the rear camera and the side cameras are used for simultaneously monitoring the change condition of personnel in the classroom and recording videos;
the image processing and operation unit extracts a pair of images at the current time point at intervals from videos recorded by the front camera, the rear camera and the side camera within a set working period, converts the extracted images from an RGB format into an HSV format by using a color space conversion algorithm, judges whether the brightness of all seat areas in each pair of images is lower than a set threshold value, and judges that no light is turned on in a classroom if the brightness of all seat areas in each pair of images is lower than the set threshold value; if not, judging that light is turned on in the classroom;
when the judgment result shows that the light is turned on in the classroom, the image processing and computing unit judges whether people exist in each seat area from the extracted image and judges whether the brightness of the seat area is lower than a set threshold value;
if the seat area is occupied and the brightness of the seat area is lower than a set threshold value, the light controller controls the light corresponding to the seat area to be turned on;
if the seat area is occupied and the brightness of the seat area is not lower than a set threshold value, the light controller does not process the light corresponding to the seat area;
if the seat area is unmanned and the brightness of the seat area is lower than a set threshold value, the light controller does not process the light corresponding to the seat area;
and if the seat area is unmanned and the brightness of the seat area is not lower than a set threshold, the light controller controls the light corresponding to the seat area to be turned off.
The image processing and operation unit extracts pixels in each seat area from the extracted image, and then subtracts the pixels of the seat area in the image corresponding to the front camera from the pixels of the seat area in the image corresponding to the rear camera;
if the pixel difference value of the two is larger than the set upper limit value, judging that the current seat area is unmanned;
if the pixel difference value of the two is smaller than the set upper limit value, subtracting the pixels of the seat area in the image corresponding to the side camera from the pixels of the seat area in the image corresponding to the front camera and the pixels of the seat area in the image corresponding to the rear camera respectively; and if one pixel difference value is larger than the set upper limit value or both the two pixel difference values are smaller than the set lower limit value, judging that the current seat area is unmanned, and if one pixel difference value is larger than the set lower limit value and smaller than the set upper limit value, judging that the current seat area is occupied.
Wherein the classroom is divided into a plurality of seating areas and the coordinate range of each seating area in the video image corresponding to each camera is stored in an image processing and computing unit in advance, and the image processing and computing unit extracts pixels in the corresponding coordinate range from the image according to the coordinate range of each seating area.
Preferably, the image processing and computing unit extracts images from the videos recorded by the front camera, the rear camera and the side camera, then corrects and smoothes and denoises each sub-image, and then extracts pixels in each seating area from each sub-image.
The control center also comprises at least one remote control switch, and the remote control switch is used for controlling the on and off of all lights in a classroom.
Further, this remote light automatic control system includes a plurality of preceding cameras, back camera, side camera and light switch, all installs a preceding camera, a back camera, a side camera and a light switch in every classroom, and the preceding camera, back camera and the side camera in all classrooms all with control center communication connection.
The invention utilizes three cameras in different directions (monitoring cameras are arranged at the front and the back of most of the classrooms of colleges at present, the cameras are also arranged at the left and the right sides of some classrooms, and the existing cameras can be considered to be utilized in practical application) to monitor the change condition of personnel in the classrooms, then the change condition is processed and calculated by images to judge whether a person is in a seat area, and the light corresponding to the seat area is controlled to be turned on and off according to the judgment result, wherein a control center can be arranged in a night duty room far away from the classrooms, thereby realizing the remote automatic control of the light in the classrooms. Compared with the existing light control system, the invention does not need to set a separate local area network for each classroom or provide a control client for each user, and the whole light control system has simpler architecture. In addition, the invention adopts the cameras in three different directions or obtains images, thereby greatly reducing the problem of judgment error caused by shielding, and the algorithm adopted by the invention does not need to carry out a large amount of sample training before being put into practical application, and is simpler to implement and easy to operate.
Detailed Description
The present invention will be further described with reference to the following examples for facilitating understanding of those skilled in the art, and the description of the embodiments is not intended to limit the present invention.
The remote light automatic control system that this embodiment is related to includes:
the front camera is fixedly arranged in front of the classroom and used for monitoring the change condition of personnel in the classroom and recording videos;
the rear camera is fixedly arranged behind the classroom and used for monitoring the change condition of personnel in the classroom and recording videos;
the side camera is fixedly arranged on the left side or the right side of the classroom and used for monitoring the change condition of personnel in the classroom and recording videos;
the control center is in communication connection with the front camera, the rear camera and the side cameras and comprises a light controller and an image processing and operation unit;
the light switch is only used for controlling the on and off of light in the middle seat area of the classroom;
the classroom is divided into a plurality of seat areas including a middle seat area, and the front camera, the rear camera and the side cameras are used for simultaneously monitoring the change condition of personnel in the classroom and recording videos;
the image processing and operation unit extracts a pair of images at the current time point at intervals (for example, 3-5 minutes) from videos recorded by the front camera, the rear camera and the side camera in a set working period (for example, 7-0 point at night), converts the extracted images from an RGB format into an HSV format by using a color space conversion algorithm, judges whether the brightness of all seat areas in each pair of images is lower than a set threshold value, and judges that no light is turned on in a classroom if the brightness is lower than the set threshold value; if not, judging that light is turned on in the classroom;
when the judgment result shows that the light is turned on in the classroom, the image processing and computing unit judges whether people exist in each seat area from the extracted image and judges whether the brightness of the seat area is lower than a set threshold value;
if the seat area is occupied and the brightness of the seat area is lower than a set threshold value, the light controller controls the light corresponding to the seat area to be turned on;
if the seat area is occupied and the brightness of the seat area is not lower than a set threshold value, the light controller does not process the light corresponding to the seat area;
if the seat area is unmanned and the brightness of the seat area is lower than a set threshold value, the light controller does not process the light corresponding to the seat area;
and if the seat area is unmanned and the brightness of the seat area is not lower than a set threshold, the light controller controls the light corresponding to the seat area to be turned off.
It should be noted that, in the above embodiment, the step of determining whether the person exists in each seat area is performed by the image processing and computing unit according to whether the classroom lighting is on, and when the classroom lighting is off, the step of determining whether the person exists in each seat area is not performed, so that the computation load can be greatly reduced, and the computation pressure of the system can be reduced. In addition, in this embodiment, it is not determined whether the classroom is on (whether the classroom is on is determined according to the illumination intensity monitored by the light sensor) by using the light sensor as in the conventional method, but it is determined whether the brightness of all the seat regions in each image is lower than a set threshold, so that the determination method does not need to increase the hardware (light sensor) cost, and is more accurate than the determination method of only arranging one light sensor at a certain position in the classroom.
It should be particularly noted that, in this embodiment, only one light switch for controlling the middle seat area is set in the classroom, and lights in other areas are not set in the classroom any longer, but are remotely controlled by the light control system (if someone is in the classroom, the light control system is used for remote turning on, and if no one is in the classroom, the light control system is used for remote turning off). The advantage that can bring like this can significantly reduce the switch quantity in classroom to be favorable to reducing the switch installation of earlier stage and the maintenance cost of later stage. Of course, such a system architecture also requires that the camera still has a good imaging effect under a condition of poor lighting condition, otherwise, the judgment of whether the seat area is occupied or not may be affected due to too much image noise.
Specifically, in the present embodiment, the image processing and arithmetic unit determines whether or not the seat area is occupied by:
the image processing and operation unit extracts pixels in each seat area from the extracted image, and then subtracts the pixels of the seat area in the image corresponding to the front camera from the pixels of the seat area in the image corresponding to the rear camera;
if the pixel difference value of the two is larger than the set upper limit value, judging that the current seat area is unmanned;
if the pixel difference value of the two is smaller than the set upper limit value, subtracting the pixels of the seat area in the image corresponding to the side camera from the pixels of the seat area in the image corresponding to the front camera and the pixels of the seat area in the image corresponding to the rear camera respectively; and if one pixel difference value is larger than the set upper limit value or both the two pixel difference values are smaller than the set lower limit value, judging that the current seat area is unmanned, and if one pixel difference value is larger than the set lower limit value and smaller than the set upper limit value, judging that the current seat area is occupied.
The principle of the above-mentioned image processing and arithmetic unit for realizing light control is described in detail as follows: assuming that the upper limit value is set to 0.8 and the lower limit value is set to 0.2, the light control principle will be described by taking one seat as an example.
First, assuming that the seat is not occupied, the following may exist in the image captured by the camera: 1. if the person sitting in the previous seat is too high and causes the seat to be blocked in the image shot by the front camera, that is, there is a pixel 1 in the area corresponding to the seat (the pixel formed by the person in the previous seat in the seat), and if there is no person or no person but no blocking is formed in the latter seat, the pixel in the area corresponding to the seat in the image shot by the rear camera is 0 (in general, the classroom seat is a single color and has the same shape, and the seat is regarded as the background of the image, meanwhile, for convenience of understanding, the pixel of the background image is regarded as 0, so the pixel of the seat without blocking is regarded as 0), and thus the difference value (1) obtained by subtracting the pixels of the seat areas in the images corresponding to the front and rear cameras is larger than the set upper limit value. 2. The latter seat is too high, which is similar to the case 1 and will not be described again. 3. The people sitting on the front seat and the back seat are too high, so that the seats in the images shot by the front camera and the back camera are blocked to form pixels 1 in the corresponding areas, the difference value obtained by subtracting the pixels of the seat areas in the images corresponding to the front camera and the back camera is smaller than the set upper limit value, the pixels of the seat areas in the images corresponding to the side cameras are subtracted from the pixels of the seat areas in the images corresponding to the front camera and the pixels of the seat areas in the images corresponding to the back camera respectively, the side cameras are not blocked by the people of the front seat and the back seat, the pixels in the areas corresponding to the seats in the shot images are 0, and the two difference values (both 1) obtained by subtracting are larger than the set upper limit value. 4. And then, two differences (both 0) obtained by subtracting the pixels of the seat area in the image corresponding to the side camera from the pixels of the seat area in the image corresponding to the front camera and the pixels of the seat area in the image corresponding to the rear camera are respectively smaller than the set lower limit value.
Second, assuming that the seat is occupied, the situation in the image taken by the camera is as follows: regardless of whether the surrounding is blocked or not, pixels 1 exist in the seat area in the images shot by the front camera and the rear camera, and since the area of the side surface of the human body is narrower than that of the front surface (assuming that the ratio of the two is 0.7), pixels 0.7 exist in the seat area in the images shot by the side camera, and two difference values (both 0.3) obtained by subtracting the pixels of the seat area in the images shot by the side camera and the pixels of the seat area in the images shot by the front camera and the rear camera are both larger than a set lower limit value and smaller than a set upper limit value.
The upper limit value 0.8, the lower limit value 0.2 and the human body side-to-front ratio of 0.7 are only used for describing the invention, but are not limited to the above, and the values can be adjusted according to actual conditions in actual application.
In the above-listed cases, there is a special case that is not included in the case where the current seat is not occupied, but the persons seated in the front seat, the rear seat, and the side seats are too high, which causes a case where the seat is blocked in the images photographed by the front, rear, and side cameras, which may be judged as being occupied. It should be noted that, first, the probability of the above-described situation occurring is low. Secondly, the present embodiment is calculated for the divided seat area, rather than a single seat, and the side seat that can shield the current seat on the side face is usually not separated from the current seat by an aisle, that is, the side seat and the current seat are usually located in the same seat area, and in addition, the front and rear seats are actually occupied by people, so that although the current seat is misjudged, the accuracy of judging whether the whole seat area is occupied or not is not affected.
It should be understood by those skilled in the art that, in the present embodiment, a classroom should be divided into a plurality of seat areas in advance and the coordinate ranges of the seat areas in the video image corresponding to each camera head should be stored in the image processing and computing unit in advance, and the image processing and computing unit can extract pixels in the corresponding coordinate ranges from the image according to the coordinate ranges of the seat areas.
In addition, as one of the preparation works before pixel extraction, the image processing and computing unit may extract the image from the video recorded by the front camera, the rear camera, and the side camera, then correct and smooth the noise reduction process for each sub-image, and then extract the pixels in each seat region from each sub-image.
As an optional scheme, a remote control switch can be further arranged at the control center, so that an operator on duty at the control center can check the personnel condition in the classroom in real time through videos shot by the camera, if the condition that light is leaked due to system errors (the classroom is unmanned and the light is not closed), the operator on duty can turn off all light in the classroom through the remote control switch, and when the light control cannot be implemented due to system downtime, maintenance or upgrading, the light in the classroom can be turned on remotely through the remote control switch at the control center.
Finally, it should be noted that, in practical applications, the remote automatic light control system may include a plurality of front cameras, rear cameras, side cameras, and light switches, where one front camera, one rear camera, one side camera, and one light switch are installed in each classroom, the front cameras, the rear cameras, and the side cameras of all the classrooms are all in communication connection with the control center, and lights of all the classrooms may be remotely controlled through the same control center.
In the embodiment, the invention utilizes three cameras in different directions (monitoring cameras are installed in front of and behind most classrooms of colleges at present, cameras are installed in some classrooms even on the left side and the right side, and the existing cameras can be utilized in practical application) to monitor the change condition of personnel in the classroom, and judges whether classroom light is turned on or not, whether a person is in the lighted seat area or not and whether the lighted seat area is lighted according to the pixel of the seat area in the image by extracting and calculating, and then controls the corresponding light to be turned on and off according to the judgment result, wherein a control center can be arranged in a night duty room far away from the classrooms, thereby realizing remote automatic control of the classroom light. Compared with the existing light control system, the embodiment does not need to set a separate local area network for each classroom or provide a control client for each user, and the whole light control system is simpler in structure. In addition, because the invention adopts the cameras in three different directions to obtain the images, the problem of judgment error caused by shielding is greatly reduced, and the accuracy of the system execution behavior is ensured.
Some descriptions of the present invention have been simplified to facilitate understanding of the improvement of the present invention over the prior art by those of ordinary skill in the art, and some other elements have been omitted from this document for clarity, and those omitted elements should be recognized by those of ordinary skill in the art to constitute the content of the present invention.