Campus safety intelligent protection method, system, device and storage medium
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-05
- Publication Date
- 2026-08-11
AI Technical Summary
[0003]本申请主要解决的技术问题是提供校园安全智慧防护方法、系统、设备及存储介质,解决了非法入侵事件往往发生在非开放时段或监控盲区,仅靠人力难以实现全天候、无死角的有效监管的技术问题
[0014]上述方案,检测区域视频中是否存在移动物体轮廓,若存在,则对移动物体轮廓进行轨迹拟合,生成连续位移路径线段;分析连续位移路径线段是否跨越电子围栏的边界,若是,则生成越界触发信号;基于所述越界触发信号调取对应的高清抓拍序列帧,并对所述高清抓拍序列帧中的人脸区域进行特征提取,得到人脸特征码;将人脸特征码与访客预约数据库中的授权名单进行比对匹配,若未发现匹配项,则判定为陌生人侵入,并基于判定结果向保安室终端推送弹窗告警信息,解决了非法入侵事件往往发生在非开放时段或监控盲区,仅靠人力难以实现全天候、无死角的有效监管的技术问题,实现了在判定是否越界时,不是简单依据目标是否进入某一划定区域,而是基于路径线段的起止点空间位置变化与电子围栏边界进行几何关系分析,只有当轨迹穿越边界线时才触发告警,有效排除了沿围墙外侧平行行走或短暂靠近等非入侵行为的干扰,降低了误报发生概率。
Smart Images

Figure CN122551470A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image technology, and in particular to intelligent campus security protection methods, systems, devices, and storage media. Background Technology
[0002] In current campus security management practices, traditional video surveillance systems primarily rely on manual monitoring and post-incident review for security. In this model, security personnel need to monitor multiple surveillance feeds for extended periods, making them highly susceptible to fatigue or distraction, potentially missing crucial moments of unusual activity. Especially in the perimeter areas of the campus, illegal intrusions often occur during off-peak hours or in blind spots, making 24 / 7, comprehensive monitoring difficult with manpower alone. Furthermore, existing systems' alarm mechanisms are mostly based on simple motion detection triggers, unable to distinguish between human bodies and other moving objects (such as tree shadows or small animal movements), resulting in a high false alarm rate and severely impacting the efficiency and reliability of emergency response. Summary of the Invention
[0003] The main technical problem addressed in this application is to provide intelligent campus security protection methods, systems, equipment, and storage media. It solves the technical problem that illegal intrusion incidents often occur during non-open hours or in blind spots of monitoring, making it difficult to achieve effective 24 / 7 monitoring without blind spots by relying solely on manpower.
[0004] To address the aforementioned technical problems, this application proposes a smart campus security protection method, comprising the following steps: Collect video of the area of the electronic fence and detect whether there is a moving object outline in the video. If so, perform trajectory fitting on the moving object outline to generate continuous displacement path segments. Analyze whether the continuous displacement path segment crosses the boundary of the electronic fence; if so, generate an over-boundary trigger signal. Based on the boundary trigger signal, the corresponding high-definition capture sequence frame is retrieved, and the face region in the high-definition capture sequence frame is extracted to obtain the face feature code. The facial recognition code is compared with the authorized list in the visitor reservation database. If no match is found, it is determined that an unauthorized person has intruded, and a pop-up alarm message is pushed to the security room terminal based on the determination result.
[0005] Furthermore, the process involves acquiring video footage of the electronic fence area and detecting the presence of moving object outlines within the video. If an outline is found, trajectory fitting is performed on the moving object outline to generate continuous displacement path segments, including: The video of the region is processed frame by frame to extract and convert images to grayscale, resulting in a grayscale image sequence; background subtraction is performed based on the grayscale image sequence to obtain a difference image; If the pixel value in the difference image exceeds a set threshold, it is determined to be a suspected moving object region, and edge detection is performed on the suspected moving object region to obtain the moving contour edge points. Match and associate the moving contour edge points of the same moving object in adjacent frames to obtain the associated contour point sequence of the moving object in multiple frames of images; Linear segments are fitted to the associated contour point sequence in chronological order. By calculating the linear distance and direction between adjacent associated contour point sequences, continuous displacement path segments are obtained.
[0006] Furthermore, the step of performing background subtraction based on the grayscale image sequence to obtain a difference image includes: Pixel values are counted for each frame in the grayscale image sequence to obtain the average pixel value of each frame. The average pixel values of all frames are sorted, and the average pixel value in the middle of the sort is selected as the background reference pixel value. Subtract the background reference pixel value from each pixel value of each frame in the grayscale image sequence to obtain a preliminary difference image for each frame. The initial difference image is subjected to noise filtering. By setting a pixel difference threshold, pixels in the initial difference image whose pixel difference is less than the pixel difference threshold are set to zero, and the filtered difference image is obtained. The filtered difference image is binarized by setting a binarization threshold. Pixels with pixel differences greater than the binarization threshold are set to 255, and pixels with differences less than or equal to the binarization threshold are set to 0, thus obtaining the difference image.
[0007] Furthermore, the analysis determines whether the continuous displacement path segment crosses the boundary of the electronic fence; if so, a boundary crossing trigger signal is generated, including: The coordinate points of the preset electronic fence boundary are read to obtain the fence boundary coordinate points, and the start and end points of the continuous displacement path segment are extracted to obtain the path start coordinates and path end coordinates. Based on the coordinate points of the fence boundary, the position lateral determination is performed on the coordinates of the starting point and the ending point of the path to obtain the starting point lateral value and the ending point lateral value, wherein the starting point lateral value and the ending point lateral value are positive or negative. The signs of the starting point lateral value and the ending point lateral value are compared to determine whether their signs are opposite. If they are, it is determined that the continuous displacement path segment intersects with the boundary of the electronic fence, and a cross-boundary status identifier is obtained. Based on the cross-boundary status identifier, the intersection coordinates of the continuous displacement path segment and the fence boundary coordinate points are calculated to obtain the boundary crossing point coordinates. Based on the coordinates of the boundary crossing point, the corresponding camera acquisition time and camera number are obtained, and the boundary crossing point coordinates, acquisition time and number are encapsulated to obtain the boundary crossing trigger signal.
[0008] Furthermore, the step of retrieving the corresponding high-definition capture sequence frame based on the boundary trigger signal, and extracting features from the face region in the high-definition capture sequence frame to obtain a face feature code includes: Based on the camera number and timestamp in the boundary trigger signal, the video storage unit in the camera is used to retrieve frame data to obtain a high-definition capture sequence frame, and the high-definition capture sequence frame is used to perform frame-by-frame face scanning to obtain a face detection box. Based on the face detection box, the high-definition capture sequence frames are cropped to obtain candidate face images. A sharpness score is calculated for each image in the candidate face images, and the image with the highest sharpness score is selected as the optimal face image. Facial key points are located in the optimal face image to obtain the coordinates of the facial key points, and feature vector encoding is performed on the optimal face image based on the coordinates of the facial key points to obtain the face feature code.
[0009] Furthermore, the step of cropping the high-definition captured sequence frames based on the face detection bounding box to obtain candidate face images includes: The coordinate information of the face detection box is extracted, and the coordinate information is used to extract pixels of the image region within the face detection box in the high-definition capture sequence frame to obtain the initial face image region. The initial face image region is then subjected to edge smoothing processing to obtain the face image after edge smoothing. The face image after edge smoothing is normalized and scaled according to a preset standard face size to obtain a candidate face image with uniform size.
[0010] Furthermore, the step of pushing pop-up alarm information to the security room terminal based on the judgment result includes: Based on the determination result, the boundary crossing point coordinates, trigger timestamp, camera number, and the optimal face image in the boundary crossing trigger signal are grouped into a data packet to obtain an alarm data packet. The alarm data packet is then pushed to the security room terminal through the network communication interface to obtain a pop-up alarm message.
[0011] This invention also provides a smart campus security protection system, comprising: The acquisition module is used to acquire video of the area of the electronic fence and detect whether there is a moving object outline in the video. If so, the moving object outline is fitted with a trajectory to generate a continuous displacement path segment. The analysis module is used to analyze whether the continuous displacement path segment crosses the boundary of the electronic fence. If so, it generates an over-boundary trigger signal. The extraction module is used to retrieve the corresponding high-definition capture sequence frame based on the boundary trigger signal, and to extract features from the face region in the high-definition capture sequence frame to obtain the face feature code. The matching module compares the facial feature code with the authorized list in the visitor reservation database. If no match is found, it is determined that an intruder has entered the site, and a pop-up alarm message is pushed to the security room terminal based on the determination result.
[0012] The present invention also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of any of the above methods.
[0013] The present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of any of the above methods.
[0014] The above scheme detects whether there is a moving object outline in the video area. If so, it performs trajectory fitting on the moving object outline to generate a continuous displacement path segment. It analyzes whether the continuous displacement path segment crosses the boundary of the electronic fence. If so, it generates a boundary crossing trigger signal. Based on the boundary crossing trigger signal, it retrieves the corresponding high-definition capture sequence frame and extracts features from the face region in the high-definition capture sequence frame to obtain a face feature code. It compares and matches the face feature code with the authorized list in the visitor reservation database. If no match is found, it is determined that a stranger has intruded, and a pop-up alarm message is pushed to the security room terminal based on the determination result. This solves the technical problem that illegal intrusion incidents often occur during non-open hours or in blind spots of monitoring, and it is difficult to achieve effective all-weather, all-round supervision by manpower alone. It realizes that when determining whether a boundary has been crossed, it is not simply based on whether the target has entered a certain designated area, but based on the geometric relationship analysis of the spatial position change of the starting and ending points of the path segment and the boundary of the electronic fence. An alarm is only triggered when the trajectory crosses the boundary line, effectively eliminating interference from non-intrusive behaviors such as walking parallel to the outside of the wall or briefly approaching, and reducing the probability of false alarms. Attached Figure Description
[0015] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0016] Figure 1This is a schematic diagram of the steps of a campus security smart protection method in one embodiment of the present invention; Figure 2 This is a structural block diagram of a campus security intelligent protection system according to an embodiment of the present invention; Figure 3 This is a schematic block diagram of the structure of a computer device according to an embodiment of the present invention.
[0017] The objectives, features, and advantages of this invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0018] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0019] Specifically, the campus security smart protection method in this embodiment includes the following steps: like Figure 1 As shown, Figure 1 This invention provides a smart campus security protection method, comprising the following steps: Step S1: Collect video of the area of the electronic fence and detect whether there is a moving object outline in the area video. If there is, perform trajectory fitting on the moving object outline to generate continuous displacement path segments.
[0020] Specifically, after acquiring video footage of the electronic fence area, the process of detecting the presence of moving object outlines is achieved by continuously acquiring monitoring images from cameras. These images are transmitted to the processing unit frame by frame. Background modeling and differencing are performed on each frame to separate areas that show significant differences from the static background; these areas are the suspected locations of moving objects. Edge extraction is then performed within these difference areas to obtain a set of boundary points for the object's shape, forming preliminary outline data. Since the outlines in a single frame may be incomplete due to lighting changes or noise interference, matching and association with similar targets from previous and subsequent frames are necessary. Based on positional and shape similarity, the outlines of the same object at different times are connected. This process organizes the originally discrete outline fragments into a temporally continuous trajectory. Based on this, straight line segments are fitted using the displacement relationship between the center points of adjacent outlines. Multiple consecutive straight line segments are connected end-to-end to ultimately form a complete continuous displacement path segment. This path segment reflects the target's actual walking route over a period of time; its generation depends on the previously extracted moving object outlines and serves as the basic input for subsequent judgments regarding whether the electronic fence boundary has been crossed. For example, within the surveillance field of view outside the side wall of the school gate, a cat running quickly will also produce a moving silhouette, but its trajectory is a short arc and does not touch the set boundary, so the system can exclude the alarm; when someone climbs over the wall to enter the campus, the path segment formed will clearly pass through the virtual line segment corresponding to the electronic fence, and only then will the next action be triggered.
[0021] Step S2: Analyze whether the continuous displacement path segment crosses the boundary of the electronic fence. If so, generate an over-boundary trigger signal.
[0022] Specifically, when determining whether a continuous displacement path segment crosses the boundary of an electronic fence, the system first obtains the starting and ending coordinates of the path segment and reads multiple sets of coordinate points from a pre-defined electronic fence boundary, forming a closed set of boundary segments. The system then calculates whether the path segment intersects with each fence boundary segment to confirm an actual intersection. If an intersection exists, the system further analyzes the positional relationship between the starting and ending points relative to the fence area to determine whether the movement is from the outside in or from the inside out. Only when the path segment actually crosses the boundary and the direction is from the outside in is it considered a valid boundary crossing. At this point, the system generates a boundary crossing trigger signal, including a timestamp, camera number, and intersection location information. For example, on the east side of the school fence, if someone climbs over and enters the campus, their trajectory line crosses the virtual fence line. The system detects the intersection and confirms the direction, immediately triggering an alarm. However, if a student leaves the school normally through the gate, although they also cross the boundary, their direction is opposite, and the intrusion criteria are not met, so no signal is triggered.
[0023] Step S3: Based on the boundary trigger signal, retrieve the corresponding high-definition capture sequence frame, and extract features from the face region in the high-definition capture sequence frame to obtain the face feature code.
[0024] Specifically, based on the timestamp and camera number in the boundary crossing trigger signal, the system retrieves consecutive image frames within 1.5 seconds before and after that moment from the video storage area of the corresponding device, forming a high-definition capture sequence frame. These image frames originate from the original footage recorded by the front-end camera at the time of the event, possessing high resolution and clarity. Subsequently, a face detection algorithm is executed on each frame to locate the presence of a face region and extract image blocks containing facial information. For multiple frames containing faces, the pixel area and average edge gradient of the face region in each image are calculated as a quality score, and the frame with the highest score is selected for subsequent processing. Next, keypoint localization is performed on the selected image to obtain the coordinates of the corners of the eyes, nose, and mouth, etc. These points are then used as a reference to divide local regions, and texture feature vectors are extracted from each region. Finally, multiple local features are concatenated and fused to generate a fixed-length numerical array, which is the face feature code. For example, when someone climbs over the east wall, the system retrieves video clips before and after the incident, selects the clearest frontal or half-profile image for encoding, ensuring usable biometric data can be obtained even if the target does not actively cooperate.
[0025] Step S4: Compare the facial feature code with the authorized list in the visitor reservation database. If no match is found, it is determined that a stranger has intruded, and a pop-up alarm message is pushed to the security room terminal based on the determination result.
[0026] Specifically, the generated facial recognition codes are compared one by one with the pre-entered authorized list in the visitor reservation database. Each list record contains the facial recognition codes and basic information of approved individuals. The comparison process uses Euclidean distance to calculate the numerical difference between the two. If the minimum distance is less than a set threshold, it is considered a successful match. If no matching item is found after traversing all records, it is determined that there is no match. At this time, the system determines that the individual is not within the authorized personnel range and triggers a stranger intrusion judgment. Based on this judgment result, an alarm data packet is automatically generated, which includes the intrusion time, camera number, location of the intrusion, and corresponding facial recognition code. This data packet is transmitted to the security room monitoring terminal through the internal network and activates the screen pop-up prompt function, forcibly displaying warning information on the main interface. For example, if someone climbs over the wall and is identified by the system, and their facial code has no corresponding record in the database, a pop-up window will appear on the duty personnel's operation interface, accompanied by an audio reminder, to ensure timely detection of abnormal situations.
[0027] In a specific embodiment, the step of acquiring area video of the electronic fence and detecting whether there is a moving object outline in the area video, and if so, performing trajectory fitting on the moving object outline to generate continuous displacement path segments, includes: The video of the region is processed frame by frame to extract and convert images to grayscale, resulting in a grayscale image sequence; background subtraction is performed based on the grayscale image sequence to obtain a difference image; If the pixel value in the difference image exceeds a set threshold, it is determined to be a suspected moving object region, and edge detection is performed on the suspected moving object region to obtain the moving contour edge points. Match and associate the moving contour edge points of the same moving object in adjacent frames to obtain the associated contour point sequence of the moving object in multiple frames of images; Linear segments are fitted to the associated contour point sequence in chronological order. By calculating the linear distance and direction between adjacent associated contour point sequences, continuous displacement path segments are obtained.
[0028] Specifically, after acquiring video of the area covered by the electronic fence, the system first decomposes the video stream frame by frame, extracting each image and converting the color images to grayscale to reduce computational complexity, thus forming a sequence of grayscale images arranged chronologically. Next, background modeling techniques are used to perform difference operations on this sequence, typically subtracting the current frame from a dynamically updated background template at the pixel level to obtain a difference image reflecting the changed areas. In the difference image, if the pixel value at a certain location exceeds a preset threshold, that point is considered to belong to an active area, and multiple adjacent high-value pixels connected together constitute a suspected moving object region. Edge detection processing is then performed on these regions, commonly using the Sobel operator or the Canny method to extract contour boundaries, obtaining a set of discrete moving contour edge points. Since edge points in a single frame can only describe the instantaneous shape, correlation analysis is needed using similar structures in subsequent frames. By comparing the position, size, and shape similarity of contours between adjacent frames, it is determined whether they belong to the same moving target, and then the edge points scattered in different frames are connected to form a sequence of associated contour points that evolves over time. When this sequence can be tracked in multiple consecutive frames, it indicates the existence of a stable moving target. Based on this, line segment fitting is performed on adjacent related contour point sequences according to chronological order. Specifically, every two consecutive points are connected by a straight line, and the straight-line distance and direction of travel between them are calculated. These line segments are then connected end-to-end to form a complete path trajectory. The final output continuous displacement path segment is the actual walking route of the target within the monitoring field of view. For example, if someone climbs over the outer wall of the north gate of the school at night, and the camera continuously records, the system extracts the continuously changing area caused by the human movement. After the above process, a path segment is generated from outside the wall to inside the school, which serves as the basis for subsequent judgment on whether the boundary has been crossed.
[0029] In a specific embodiment, the step of performing background subtraction based on the grayscale image sequence to obtain a difference image includes: Pixel values are counted for each frame in the grayscale image sequence to obtain the average pixel value of each frame. The average pixel values of all frames are sorted, and the average pixel value in the middle of the sort is selected as the background reference pixel value. Subtract the background reference pixel value from each pixel value of each frame in the grayscale image sequence to obtain a preliminary difference image for each frame. The initial difference image is subjected to noise filtering. By setting a pixel difference threshold, pixels in the initial difference image whose pixel difference is less than the pixel difference threshold are set to zero, and the filtered difference image is obtained. The filtered difference image is binarized by setting a binarization threshold. Pixels with pixel differences greater than the binarization threshold are set to 255, and pixels with differences less than or equal to the binarization threshold are set to 0, thus obtaining the difference image.
[0030] Specifically, firstly, each frame of the grayscale image sequence is read, and the average brightness value of all pixels in each frame is calculated, i.e., the pixel mean of each frame. These pixel means reflect the overall brightness changes of the image at different times. The pixel means of all frames are arranged in ascending order, and the value in the middle is taken as the background reference pixel value. This method avoids interference from extreme lighting changes (such as headlights sweeping across the image or clouds obscuring the sun) and is more stable and reliable than directly averaging. After obtaining this reference value, it is used to perform a point-by-point subtraction operation with the corresponding pixel in each frame of the sequence. That is, the grayscale value of each pixel in the current frame is subtracted from the background reference pixel value to obtain a preliminary difference result, forming a preliminary difference image for each frame. Due to sensor noise and minor jitter in the actual environment, these differences will contain a large number of meaningless small fluctuations, thus requiring further processing. A small pixel difference threshold, such as 15-20 gray levels, is set. Pixels with absolute values less than this threshold in the initial difference image are uniformly set to zero, while the rest retain their original values. This filters out low-amplitude noise, resulting in a filtered difference image. Next, to highlight effective motion areas, binarization is performed on the image. A binarization threshold, typically between 30 and 40, is set above the noise level but below the typical motion response. Pixels in the filtered image with values greater than this threshold are set to 255 (white), representing areas of significant change, while those less than or equal to the threshold are set to 0 (black), ultimately generating a clear black-and-white difference image. This image clearly indicates the range of changes that may be caused by moving objects in the current frame. For example, in a monitoring scenario of the south wall of a school, the background is stable at night. The system collects 900 frames of continuous 30-second video, calculates the mean value of each frame to obtain the median value as a baseline. When someone climbs over, their body outline appears as a highlighted area after difference. After filtering and binarization, a complete human-shaped block is formed, becoming the basic input for subsequent edge detection and contour extraction.
[0031] In a specific embodiment, the step of analyzing whether the continuous displacement path segment crosses the boundary of the electronic fence, and if so, generating a boundary crossing trigger signal, includes: The coordinate points of the preset electronic fence boundary are read to obtain the fence boundary coordinate points, and the start and end points of the continuous displacement path segment are extracted to obtain the path start coordinates and path end coordinates. Based on the coordinate points of the fence boundary, the position lateral determination is performed on the coordinates of the starting point and the ending point of the path to obtain the starting point lateral value and the ending point lateral value, wherein the starting point lateral value and the ending point lateral value are positive or negative. The signs of the starting point lateral value and the ending point lateral value are compared to determine whether their signs are opposite. If they are, it is determined that the continuous displacement path segment intersects with the boundary of the electronic fence, and a cross-boundary status identifier is obtained. Based on the cross-boundary status identifier, the intersection coordinates of the continuous displacement path segment and the fence boundary coordinate points are calculated to obtain the boundary crossing point coordinates. Based on the coordinates of the boundary crossing point, the corresponding camera acquisition time and camera number are obtained, and the boundary crossing point coordinates, acquisition time and number are encapsulated to obtain the boundary crossing trigger signal.
[0032] Specifically, multiple coordinate points of the electronic fence boundary are read from the configuration file. These points are connected sequentially to form a closed or multi-segment virtual boundary line, representing the actual protection range of the campus perimeter. Simultaneously, the starting and ending coordinates of the continuous displacement path segment corresponding to the current target are extracted. These two points represent the initial and final positions of the moving object during tracking. To determine whether it crosses the boundary, the relative orientation of these two endpoints with respect to the fence boundary needs to be determined. Using the straight line of the fence boundary as a reference, the vertical distance from the starting coordinates to this line is calculated and its sign is retained. If it is located outside the fence, it is recorded as a negative value; if inside, it is a positive value, yielding the starting lateral value. The ending coordinates are processed in the same way to obtain the ending lateral value. When the signs of these two lateral values are opposite, it indicates that the starting and ending points of the path are located on opposite sides of the boundary, meaning that the path segment is highly likely to cross the fence area. In this case, an intersection is determined, and a cross-boundary status marker is generated. This marker serves as the trigger condition for subsequent precise calculations. Next, the system proceeds to the intersection confirmation stage. Utilizing the line segment intersection algorithm from analytical geometry, the continuous displacement path segment is treated as a finite straight line segment. This segment is compared one by one with each segment of the fence boundary to determine if an actual intersection point exists. If one exists, the planar coordinates of that point are recorded, which are the boundary crossing point coordinates. These coordinates indicate the specific location of the intrusion, such as near the south section of the fence at the east gate of the school. Subsequently, the camera ID and timestamp at the time of the incident are combined with this information from the original video capture unit and packaged together with the boundary crossing point coordinates to form a complete boundary crossing trigger signal. For example, if a person climbs over the wall from outside the school into the teaching area one night, with their trajectory starting outside and ending inside, the lateral value at the starting point being negative and the ending point positive (different signs), the system determines this as a boundary crossing and calculates that the crossing point is within the coverage area of surveillance camera number 3. A trigger signal containing the time, location, and device ID is then generated to drive subsequent face capture and alarm processes.
[0033] In a specific embodiment, the step of retrieving the corresponding high-definition capture sequence frame based on the boundary trigger signal, and extracting features from the face region in the high-definition capture sequence frame to obtain a face feature code includes: Based on the camera number and timestamp in the boundary trigger signal, the video storage unit in the camera is used to retrieve frame data to obtain a high-definition capture sequence frame, and the high-definition capture sequence frame is used to perform frame-by-frame face scanning to obtain a face detection box. Based on the face detection box, the high-definition capture sequence frames are cropped to obtain candidate face images. A sharpness score is calculated for each image in the candidate face images, and the image with the highest sharpness score is selected as the optimal face image. Facial key points are located in the optimal face image to obtain the coordinates of the facial key points, and feature vector encoding is performed on the optimal face image based on the coordinates of the facial key points to obtain the face feature code.
[0034] Specifically, the camera ID and timestamp contained in the boundary violation trigger signal are analyzed. These two data items are directly associated with the specific monitoring device and the time of the event. The camera ID is used to locate the front-end network camera or its connected video storage unit. Then, using the timestamp as the center, a 3-second time window is formed by looking back 1.5 seconds and forward 1.5 seconds. Within this interval, consecutive raw image frames are retrieved from the storage medium. These frames are typically recorded at 25 frames per second, totaling approximately 75 frames, forming a high-definition capture sequence. After acquiring this sequence, face detection is performed frame by frame. A sliding window combined with a classifier is used to scan each image to identify whether there are regions matching facial morphological features, and the locations are marked with rectangles, thus obtaining face detection boxes. This box records the coordinate range of the face in the image, including the top left corner and width and height dimensions. Subsequently, the original image is cropped based on these face detection boxes, and the image regions within the boxes are extracted separately to form a set of candidate face images, which may contain multiple facial images of the same person with different poses or resolutions. Since some frames may be blurry, occluded, or angularly offset, the best quality image needs to be selected for subsequent encoding. To this end, a sharpness score is calculated for each candidate face image. The Laplacian operator is commonly used to perform convolution operations on the image, and the standard deviation of its gradient distribution is extracted as the evaluation value. A higher value indicates sharper edges and a clearer image. The scores of all candidate images are compared, and the image with the highest score is selected as the optimal face image. Next, the feature generation stage begins. Facial keypoint localization is performed on the image. Using template matching or multi-part regression methods, at least five fixed points, such as the corners of the eyes, the tip of the nose, and the corners of the mouth, are identified, and their precise positions in the image coordinate system are obtained—the facial keypoint coordinates. Finally, the image is normalized and corrected based on these coordinates, and then local regions are divided to extract texture features. For example, histograms of oriented gradients (HOG) are used to describe the edge distribution patterns of each block, and all local features are concatenated into a fixed-length numerical vector, which is the face feature code. For example, when someone climbs over a wall and is captured by camera number 4, the system retrieves video clips from before and after the incident, selects the clearest frontal facial image, and encodes it to ensure that even if the target does not actively cooperate, it can still output effective biometric data that can be used for comparison.
[0035] In a specific embodiment, the step of cropping the high-definition captured sequence frames based on the face detection bounding box to obtain the candidate face image includes: The coordinate information of the face detection box is extracted, and the coordinate information is used to extract pixels of the image region within the face detection box in the high-definition capture sequence frame to obtain the initial face image region. The initial face image region is then subjected to edge smoothing processing to obtain the face image after edge smoothing. The face image after edge smoothing is normalized and scaled according to a preset standard face size to obtain a candidate face image with uniform size.
[0036] Specifically, the process of cropping regions from high-definition captured frames based on face detection bounding boxes to obtain candidate face images is a fundamental step for subsequent feature extraction. The system first reads the coordinate information of the face detection bounding boxes generated in the previous step. This information includes the horizontal and vertical coordinates of the top-left corner of the rectangle in the image, as well as the width and height of the box. These values are output by the face detection algorithm and directly correspond to specific pixel positions in the original image. Using these coordinate parameters, each image frame containing a face is located in the high-definition captured frame sequence, and the set of pixels covered by the bounding box is extracted to form the initial face image region. Since the edges of the original detection boxes may have slight deviations from the actual facial contours, or jagged boundaries may appear due to compression artifacts, the extracted image region needs edge smoothing. Specifically, a Gaussian filter is applied to the image, and a 3×3 or 5×5 weighted kernel is set to perform a weighted average operation on each pixel and its neighborhood. This weakens abrupt grayscale changes, making the facial contour transition more natural, resulting in a smoothed face image. This processing helps reduce interference from edge noise in subsequent scoring. Next, to standardize the input format and avoid instability in feature encoding due to size differences, the smoothed images need to be normalized. The system scales the images according to a preset standard face size, such as 128×128 pixels. If the original image is larger than the target size, bilinear interpolation is used to reduce the resolution while preserving the main structure; if it is smaller than the standard size, it is appropriately enlarged to prevent excessive information loss. During scaling, the aspect ratio is kept constant to avoid stretching and distorting the face, and excess areas are filled with black. Finally, a set of candidate face images of consistent size and clear boundaries are output as input data for the next step of clarity scoring and optimal image selection. For example, in the surveillance footage of the west gate of a school, if someone climbs over the wall at night, the system detects multiple face frames in consecutive frames passing through the camera's field of view, crops out the corresponding areas, and forms a standardized set of small images after smoothing and normalization, making it easier to compare which frame is most suitable as a feature sample.
[0037] In a specific embodiment, the step of pushing pop-up alarm information to the security room terminal based on the determination result includes: Based on the determination result, the boundary crossing point coordinates, trigger timestamp, camera number, and the optimal face image in the boundary crossing trigger signal are grouped into a data packet to obtain an alarm data packet. The alarm data packet is then pushed to the security room terminal through the network communication interface to obtain a pop-up alarm message.
[0038] Specifically, the system reads the boundary crossing point coordinates, trigger timestamp, and camera number from the boundary crossing trigger signal corresponding to the event. This data, already encapsulated in previous steps, represents the specific location and precise time of the intrusion, as well as the number of the monitoring device responsible for data collection. Simultaneously, it retrieves the previously selected optimal facial image, which is the frame best reflecting the target's facial features after clarity optimization. The above four items—boundary crossing point coordinates, trigger timestamp, camera number, and optimal facial image—are packaged according to a predefined data structure to form a complete alarm data packet. This data packet is encapsulated in standard binary or JSON format to ensure reliable transmission between different systems. Subsequently, this data packet is sent to the designated receiving port of the security room terminal via the campus LAN network communication interface. Upon receiving the data, the terminal automatically parses the content and triggers a pop-up display mechanism on the front-end interface, forcibly displaying an alarm window on the main monitoring screen, showing the intrusion time, location, associated camera number, and a thumbnail of the optimal facial image, constituting the final pop-up alarm information. For example, when camera number 5 detects someone climbing over the east wall and their identity does not match, the system immediately packages the crossing point, time, device number, and a captured half-profile image, and pushes it to the computer screen in the duty room to remind security personnel to take timely action.
[0039] Please see Figure 2 , Figure 2 This is a schematic diagram of the framework of an embodiment of the campus security intelligent protection system of this application. Figure 2 As shown, the campus security intelligent protection system includes a data acquisition module 1, which is used to acquire video of the area of the electronic fence and detect whether there is a moving object outline in the video. If so, the moving object outline is fitted with a trajectory to generate a continuous displacement path segment. An analysis module 2 is used to analyze whether the continuous displacement path segment crosses the boundary of the electronic fence. If so, an over-boundary trigger signal is generated. An extraction module 3 is used to retrieve the corresponding high-definition capture sequence frame based on the over-boundary trigger signal and extract features from the face region in the high-definition capture sequence frame to obtain a face feature code. A matching module 4 is used to compare the face feature code with the authorized list in the visitor reservation database. If no match is found, it is determined that a stranger has intruded and a pop-up alarm message is pushed to the security room terminal based on the determination result.
[0040] Reference Figure 3This invention also provides a computer device whose internal structure can be as follows: Figure 3 As shown, the computer device includes a processor, memory, display screen, input device, network interface, and database connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores the operating system, computer programs, and database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The database stores the data corresponding to this embodiment. The network interface is used to communicate with external terminals via a network connection. When the computer program is executed by the processor, it implements the above-described method.
[0041] Those skilled in the art will understand that Figure 3 The structures shown are merely block diagrams of some structures related to the present invention and do not constitute a limitation on the computer devices on which the present invention is applied.
[0042] An embodiment of the present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-described method. It is understood that the computer-readable storage medium in this embodiment can be a volatile readable storage medium or a non-volatile readable storage medium.
[0043] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the present invention and embodiments can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual-rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM, etc.
[0044] In some embodiments, the functions or modules of the apparatus provided in this disclosure can be used to perform the methods described in the above method embodiments. The specific implementation can be referred to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.
[0045] The description of the various embodiments above tends to emphasize the differences between the various embodiments. The similarities or similarities between them can be referred to, and for the sake of brevity, they will not be repeated here.
[0046] In the several embodiments provided in this application, it should be understood that the disclosed methods and apparatus can be implemented in other ways. For example, the apparatus implementations described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection of devices or units may be electrical, mechanical, or other forms.
[0047] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment, depending on actual needs.
[0048] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0049] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods of various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0050] If the technical solution of this application involves personal information, the product using this technical solution has clearly informed the user of the personal information processing rules and obtained the user's voluntary consent before processing the personal information. If the technical solution of this application involves sensitive personal information, the product using this technical solution has obtained the user's separate consent before processing the sensitive personal information, and also meets the requirement of "express consent". For example, at personal information collection devices such as cameras, clear and prominent signs are set up to inform users that they have entered the scope of personal information collection and that personal information will be collected. If an individual voluntarily enters the collection scope, it is deemed that they have agreed to the collection of their personal information; or on the personal information processing device, with clear signs / information informing users of the personal information processing rules, authorization is obtained from the individual through pop-up information or by asking the individual to upload their personal information; wherein, the personal information processing rules may include information such as the personal information processor, the purpose of personal information processing, the processing method, and the types of personal information processed.
Claims
1. A campus security intelligent protection method, characterized in that, Includes the following steps: Collect video of the area of the electronic fence and detect whether there is a moving object outline in the video. If so, perform trajectory fitting on the moving object outline to generate continuous displacement path segments. Analyze whether the continuous displacement path segment crosses the boundary of the electronic fence; if so, generate an over-boundary trigger signal. Based on the boundary trigger signal, the corresponding high-definition capture sequence frame is retrieved, and the face region in the high-definition capture sequence frame is extracted to obtain the face feature code. The facial recognition code is compared with the authorized list in the visitor reservation database. If no match is found, it is determined that an unauthorized person has intruded, and a pop-up alarm message is pushed to the security room terminal based on the determination result.
2. The campus safety smart protection method of claim 1, wherein, The process involves acquiring video footage of the electronic fence area and detecting the presence of moving object outlines within the video. If an outline is found, trajectory fitting is performed on the moving object outline to generate continuous displacement path segments, including: The video of the region is processed frame by frame to extract and convert images to grayscale, resulting in a grayscale image sequence; background subtraction is performed based on the grayscale image sequence to obtain a difference image; If the pixel value in the difference image exceeds a set threshold, it is determined to be a suspected moving object region, and edge detection is performed on the suspected moving object region to obtain the moving contour edge points. Match and associate the moving contour edge points of the same moving object in adjacent frames to obtain the associated contour point sequence of the moving object in multiple frames of images; Linear segments are fitted to the associated contour point sequence in chronological order. By calculating the linear distance and direction between adjacent associated contour point sequences, continuous displacement path segments are obtained. 3.The campus security intelligent protection method according to claim 2, characterized in that, The step of performing background subtraction based on grayscale image sequences to obtain difference images includes: Pixel values are counted for each frame in the grayscale image sequence to obtain the average pixel value of each frame. The average pixel values of all frames are sorted, and the average pixel value in the middle of the sort is selected as the background reference pixel value. Subtract the background reference pixel value from each pixel value of each frame in the grayscale image sequence to obtain a preliminary difference image for each frame. The initial difference image is subjected to noise filtering. By setting a pixel difference threshold, pixels in the initial difference image whose pixel difference is less than the pixel difference threshold are set to zero, and the filtered difference image is obtained. The filtered difference image is binarized by setting a binarization threshold. Pixels with pixel differences greater than the binarization threshold are set to 255, and pixels with differences less than or equal to the binarization threshold are set to 0, thus obtaining the difference image. 4.The campus security intelligent protection method according to claim 1, characterized in that, The analysis determines whether the continuous displacement path segment crosses the boundary of the electronic fence. If so, an over-boundary trigger signal is generated, including: The coordinate points of the preset electronic fence boundary are read to obtain the fence boundary coordinate points, and the start and end points of the continuous displacement path segment are extracted to obtain the path start coordinates and path end coordinates. Based on the coordinate points of the fence boundary, the position lateral determination of the starting point coordinates and the ending point coordinates of the path is performed to obtain the starting point lateral value and the ending point lateral value, wherein the starting point lateral value and the ending point lateral value are positive or negative. The signs of the starting point lateral value and the ending point lateral value are compared to determine whether their signs are opposite. If they are, it is determined that the continuous displacement path segment intersects with the boundary of the electronic fence, and a cross-boundary status identifier is obtained. Based on the cross-boundary status identifier, the intersection coordinates of the continuous displacement path segment and the fence boundary coordinate points are calculated to obtain the boundary crossing point coordinates. Based on the coordinates of the boundary crossing point, the corresponding camera acquisition time and camera number are obtained, and the boundary crossing point coordinates, acquisition time and number are encapsulated to obtain the boundary crossing trigger signal. 5.The campus security intelligent protection method according to claim 1, characterized in that, The process of retrieving the corresponding high-definition capture sequence frame based on the boundary trigger signal, and extracting features from the face region in the high-definition capture sequence frame to obtain a face feature code includes: Based on the camera number and timestamp in the boundary trigger signal, the video storage unit in the camera is used to retrieve frame data to obtain a high-definition capture sequence frame, and the high-definition capture sequence frame is used to perform frame-by-frame face scanning to obtain a face detection box. Based on the face detection box, the high-definition capture sequence frames are cropped to obtain candidate face images. Then, a sharpness score is calculated for each image in the candidate face images, and the image with the highest sharpness score is selected as the optimal face image. Facial key points are located in the optimal face image to obtain the coordinates of the facial key points, and feature vector encoding is performed on the optimal face image based on the coordinates of the facial key points to obtain the face feature code.
6. The campus security intelligent protection method according to claim 5, characterized in that, The step of cropping the high-definition captured sequence frames based on the face detection bounding box to obtain candidate face images includes: The coordinate information of the face detection box is extracted, and the coordinate information is used to extract pixels of the image region within the face detection box in the high-definition capture sequence frame to obtain the initial face image region. The initial face image region is then subjected to edge smoothing processing to obtain the face image after edge smoothing. The face image after edge smoothing is normalized and scaled according to a preset standard face size to obtain a candidate face image with uniform size.
7. The campus security intelligent protection method according to claim 6, characterized in that, The step of pushing pop-up alarm information to the security room terminal based on the judgment result includes: Based on the determination result, the boundary crossing point coordinates, trigger timestamp, camera number, and the optimal face image in the boundary crossing trigger signal are grouped into a data packet to obtain an alarm data packet. The alarm data packet is then pushed to the security room terminal through the network communication interface to obtain a pop-up alarm message.
8. A campus security smart protection system, characterized in that, include: The acquisition module is used to acquire video of the area of the electronic fence and detect whether there is a moving object outline in the video. If so, the moving object outline is fitted with a trajectory to generate a continuous displacement path segment. The analysis module is used to analyze whether the continuous displacement path segment crosses the boundary of the electronic fence. If so, it generates an over-boundary trigger signal. The extraction module is used to retrieve the corresponding high-definition capture sequence frame based on the boundary trigger signal, and to extract features from the face region in the high-definition capture sequence frame to obtain the face feature code. The matching module compares the facial feature code with the authorized list in the visitor reservation database. If no match is found, it is determined that an intruder has entered the site, and a pop-up alarm message is pushed to the security room terminal based on the determination result.
9. A computer device, comprising: The method includes a memory and a processor that are coupled to each other. The memory stores program instructions, and the processor executes the program instructions to implement the campus security smart protection method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The system stores program instructions that can be executed by a processor, the program instructions being used to implement the campus security intelligent protection method according to any one of claims 1 to 7.