A Novel Secure Occupancy Monitoring Scheme Based on Multi-Chaos Mapping

: Smart building control, managing queues for instant points of service, security systems, and customer support can beneﬁt from the number of occupants information known as occupancy. Due to interrupted real-time continuous monitoring capabilities of state-of-the-art cameras, a vision-based system can be easily deployed for occupancy monitoring. However, processing of images or videos over insecure channels can raise several privacy concerns due to constant recording of an image or video footage. In this context, occupancy monitoring along with privacy protection is a challenging task. This paper presents a novel chaos-based lightweight privacy preserved occupancy monitoring scheme. Persons’ movements were detected using a Gaussian mixture model and Kalman ﬁltering. A speciﬁc region of interest, i.e., persons’ faces and bodies, was encrypted using multi-chaos mapping. For pixel encryption, Intertwining and Chebyshev maps were employed in confusion and diffusion processes, respectively. The number of people was counted and the occupancy information was sent to the ThingSpeak cloud platform. The proposed chaos-based lightweight occupancy monitoring system is tested against numerous security metrics such as correlation, entropy, Number of Pixel Changing Rate (NPCR), Normalized Cross Correlation (NCC), Structural Content (SC), Mean Absolute Error (MAE), Mean Square Error (MSE), Peak to Signal Noise Ratio (PSNR), and Time Complexity (TC). All security metrics conﬁrm the strength of the proposed scheme.


Introduction
The widespread use of visual surveillance indicates that it is not only indispensable as a security measure, but also valuable in providing an accessible solution for other applications such as smart buildings management, occupancy systems, and retail traffic analysis. Visual occupancy counting techniques have several advantages over other methods such as Radio Frequency (RF) and Passive Infrared (PIR)-based methods [1][2][3][4][5][6][7]. In comparison to other traditional technologies, including RF and PIR-based, the camera-based occupancy system is affordable due to decreasing prices of the camera and vision-based technologies [1][2][3][4][5][6][7]. Moreover, a video-based solution is considered as one of the most feasible solutions that can be easily deployment in indoor settings [4]. The aforementioned advantages have made camera-based people counting systems to become the most widely used

Background and Related Knowledge
The symmetric key-based distribution uses the same key for data encryption and decryption.
The key that is used to encrypt the confidential digital information must be sent to the recipient through a proper secure digital channel. The asymmetric public-key encryption uses separate keys for encryption and decryption of digital content. It is evident from previous research [11][12][13][14][15][16][17] that the secure communication can be achieved through encryption. Encryption uses cryptographic primitives and is responsible for changing the confidential data into an unintelligible form. In the case of images, pixels are converted into such a form that does not convey any meaningful information [12][13][14][15][16]. The flow charts for image encryption and decryption schemes are shown in Figures 1 and 2. From Figures 1 and 2, one can see that a cryptographic algorithm and primitives are applied for image encryption. In image encryption, random numbers are generated through random phenomena and image pixels are substituted with some random number during the confusion stage of an algorithm. The substitution process scrambles the pixels of the original image and increases the entropy which makes it suitable to transmit it through a public/insecure network. However, substitution-only methods are not secured and some more steps should be added to secure an image [11,[18][19][20][21][22].

Plain digital image
Cryptographic algorithm Cryptographic primitives Encrypted digital data  Encryption of image pixels is an important step for protecting the integrity and privacy of individual in an image through two steps known as confusion and diffusion, which was initially introduced by Claude Shannon in 1949 [23,24]. This was one of the groundbreaking works providing a foundation for protecting critical information. Both confusion and diffusion have been widely used for protecting digital images. During the confusion stage, image pixels are permuted through some random number generators (RNG). However, due to low security, researchers are proposing new schemes that are based on both confusion and diffusion. In diffusion, pixels values are also changed through some mechanism, for example, XOR operations and substitution boxes (S-Boxes) [25][26][27][28][29][30][31]. Since last decade, research on the Substitution Boxes (S-Boxes) design has gained special attention from the cryptographers. A number of S-Boxes are available in literature that is used as a confusion step [32][33][34][35][36]. Some of the S-boxes are based on chaos theory, which is highly sensitive to initial conditions and by changing the starting conditions will change the entire attractor [36]. Chaotic systems are deterministic if the original keys are known to an authorized person. Such a system produce highly random numbers, which could be employed in the design of S-Boxes and then can be deployed in encryption algorithms.
Researchers have proposed several encryption algorithms that provide a solution for confidentiality. Commonly used schemes are Advanced Encryption Standard (AES), Rivest-Shamir-Adleman (RSA), Data Encryption Standard (DES), and International Data Encryption Algorithm (IDEA), but these algorithm are not well-suited for images/videos, as they are mainly used for text encryption [37][38][39][40][41][42][43][44][45]. The major reasons why these algorithms are not suited for video/images are as follows. (i) Traditional methods such as AES, etc., require high computation. Moreover, images are typically larger in volume and highly correlated, thus AES, DES, etc. are not suited for images. (ii) DES and AES algorithms cause real-time latency and therefore do not work in real-time scenarios.
Video encryption is scrambling of video content in such as a way that an intruder is incapable of obtaining the video content with a meaningful quality. Such requirement strongly demand innovative techniques for achieving the desired level of video/image security. Conventional cryptographic techniques are not efficient for real-time data processing [37][38][39][40][41][42][43][44][45]. Therefore, to fulfill such requirements, selective/partial encryption is becoming a popular choice for cryptographers. When partial encryption-based techniques are employed, one is able to encrypt only a part of the data and therefore computational complexity of the scheme is significantly reduced. This enables us to achieve the required level of video security while drastically reducing the amount of data that needs to be processed. Such characteristics make partial/selective encryption particularly useful in real-time applications [46][47][48][49]. This work has the following main contributions.
1. A detailed background of chaos theory is provided. 1. Chaos and Region-of-Interest-based new image encryption scheme with the person(s) counter algorithm is proposed.
2. Extensive security analysis including statistical and key space tests in a real-world environment are presented in this article.
The rest of paper is organized as follows. An introduction to chaotic maps and its application in image encryption is provided in Section 2.The proposed scheme is explained in Section 3. Experimental analysis and security test are discussed in Section 4. Finally, conclusions and future work are given in Section 5.
From previous literature, it is well-known that a close relationship exists between chaotic maps and cryptography [46][47][48][49]. Encryption based on these techniques (for example, logistic and tent maps) share similar characteristics such as strong reliance on initial conditions and difficult prediction of the outputs. Mathematically, the logistic map is written as where x n ∈ (0, 1), µ ∈ (0, 4]; however, for obtaining random numbers, the range of µ must be ∈ (3.5699456, 4]. Xiang et al. [50] used the logistic chaotic map and develop a lightweight encryption method. The proposed method was applied to the text of blocks and were shuffled randomly through the random sequences generated from the logistic map. The scheme was fast and computationally efficient. However, the proposed scheme was proven to be insecure due to its low keyspace. Many authors have critically examined this scheme [50] and reported that due to the lower key space Xiang et al. scheme is susceptible to cryptographic attacks. Pareek et al. [51] proposed a simple and secure chaos-based cryptographic algorithm utilizing two logistic maps. An external key was produced with the logistic map and image was encrypted through several rounds of permutation and random sequences were applied for achieving a reliable, and secret data. The proposed scheme was secure but it was also proved insecure due to lower keyspace [52]. Khan et al. [52] proposed a secure system based on quantum dynamical spinning and rotation using quantum cryptography for higher security. The proposed scheme has good computational speed when compared to other traditional cryptosystems [52]. The computational speed of a quantum-based system is approximately 100 times faster than classical computers. Mainly, Khan et al. work is based on a spinning operator. In this work, keys were encrypted, and subsequently, the digital image is encoded. The proposed cryptosystem was validated with numerous statistical tests [52]. Wang et al. [53] proposed an algorithm based on zigzag transform and deoxyribonucleic acid (DNA) coding. The cryptosystem was dependent on the initial values for the chaotic dynamical system, the (DNA) coding, and zigzag transform, and from the generated random numbers, images were encrypted. The test image was scrambled using zigzag transformation before pixel sorting. The image is further diffused through DNA-based random numbers and was bit-wise XORed with chaos-based random numbers. The security of the proposed scheme was further strengthened by adding an extra layer of security using a hybrid technique and therefore system was strongly resistant against any differential attack. Behnia et al. [37] presented a new encryption based on multiple chaotic maps. Digital images were scrambled through the proposed method using coupled lattice maps and one-dimensional chaotic map. The proposed system has higher keyspace and sufficient security. However, the system showed low sensitivity to the initial conditions.
Gao et al. [54] proposed a secure scheme based on a hyperchaotic map and scrambled the contents of the plain image. Due to the use of hyperchaos maps, the randomness in the proposed scheme was increased compared to other chaotic maps. The proposed scheme used a matrix shuffling process which permuted the pixels of images followed by a diffusion process using a hyperchaotic map. Ahmad et al. [55] presented a survey on chaos and non-chaos schemes. In a chaos-based scheme, pixels positions were shuffled using Bernoulli's shift map; subsequently, the map is employed to modify the original pixels of the digital images. Jawad et al. outlined that chaos-based schemes have higher keyspace and images were highly secured than non-chaos based schemes. The other study, Jawad et al. [56] proposed a novel scheme for digital multimedia security using lightweight cryptography and random numbers obtained from Chebyshev and Intertwining maps. The chaotically coupled combination of the maps added confusion and diffusion property to the presented scheme. The proposed cryptosystem had good statistical security results. Zhang et al. [57] proposed a symmetric key-based secure scheme for image encryption. The system was combined using linear and nonlinear coupled lattices. The combination of linear and nonlinear lattices overwhelmed the issues of the periodic windows. The proposed scheme uses a combination of permutation and diffusion of the pixels. Mirzaei et al. [58] proposed a new scheme based on parallel steps for confusion and diffusion. Image pixels were divided into four equal blocks. Chaotic maps were employed to shuffled the image blocks. In the final phase, all blocks were encrypted and each pixel is distorted using random numbers obtained from chaotic maps. All security tests validated the proposed system. Belazi et al. [59] proposed a scheme based on improved scrambling techniques. The cryptosystem consists of novel method for scrambling. The suggested technique employed several chaotic maps such logistic map, S-box and a number of permutation functions.
Recently, Masood et al. [60] proposed a novel scheme for secure communication. Confusion and diffusion were carried out using chaotic maps and all required security steps were followed, which were initially proposed by Claude Shannon in 1949 [23,24]. This cryptosystem utilised the complex values created through a complex Mandelbrot set of fractals which was originally developed by Benoit Mandelbrot. The Mandelbrot fractals generated complex random numbers. In the proposed scheme, imaginary numbers were neglected while the real numbers were utilized in the encryption algorithm. The random numbers were multiplied with a sequence produced from Fibonacci series. An extra security layer was added through chaotic Kaplan Yorke map and fractals. The Mandelbrot fractals used in Masood et al. scheme is written as According to recent research [60], over a thousand papers based on chaos were published until to date. It is, however, unfortunate that many of these techniques are susceptible to a number of attacks [60]. Additionally, many techniques are either computationally extensive or impractical due to low keyspace.

The Proposed Chaos-Based Secure Occupancy Scheme
Intertwining and Chebyshev chaotic maps exhibit desirable characteristics such as a positive Lyapunov exponent, zero correlation in the total field, and an equiprobable distribution, and therefore it can be used for video/image encryption. The proposed scheme utilizes both Intertwining and Chebyshev chaotic maps because they offer the aforementioned desirable properties and a larger keyspace which resist brute force attacks. Intertwining map can be written as [61] (1), where A n , B n and C n ∈ (0, 1), 0 ≤ λ ≤ 3.999, |α| > 33.5, |β| > 37.9, |γ| > 35.7. The Key space of Intertwining map is (10 60 ≈ 2 200 ) which is greater than traditional Logistic map and tent maps. Compared to other maps, random number generated through Intertwining Logistic map is distributed more evenly [61]. Chebyshev map can be defined as [62,63] T µ (z) = cos(µ × arc cos(z)), where µ = 0, 1, 2, ..., and z ∈ [−1, 1]. Huang suggested µ = 4 for less computation and efficient use of Chebyshev map. In the proposed scheme, we utilize µ = 4 and such type of Chebyshev function can be written as The main goal of the proposed scheme is the detection of an object in a video sequence, followed by encryption and then counting of the objects. Flow chart of the encryption process used in the scheme is shown in Figure 3. The pseudo-random key streams are generated using the scheme proposed in our previous research [10].

Plain images
Cryptographic algorithm

Cryptographic primitives
Encrypted digital data Pseudo randomness key stream generator using dynamical system User key To obtain an image it is necessary to use background modeling. For moving object detection, there are a plethora of methods available in the literature each having its own advantages and disadvantages. In our case, we used Gaussian Mixture Model (GMM) technique due to its accuracy and real-time applicability. Mathematically, GMM is written as In Equation (6), x t is incoming pixel value at a time t, w j,t is weight of j th distribution at time t, and η(x t , φ j,t , ∑ j,t ) is probability Gaussian distribution function. Based on value of w/σ, K distribution is sorted and the background model can be written as follows, Each Gaussian which is greater than the threshold T is classified as background. More details about GMM can be found in [2]. For every Gaussian variable with a value larger than T, a background is classified.
The Kalman filter is widely popular and used extensively in signal estimation, navigation systems, and control systems. Essentially, the Kalman filter is used to provide optimal estimation in the form of mathematical equations. The results are optimal despite the presence of Additive White Gaussian Noise (AWGN). In the proposed method, the Kalman filter is used to forecast the position of moving object. This is followed by tracking of the person as the frames continue. In discrete-time, the Kalman filter with a state transition given byX at k is written aŝ where A is n × 1 system state transition vector; B represents the control parameter, which relates u k with stateX k ; and W k is a vector representing additive noise. Mathematically, measurement Z in terms of stateX k can be defined as where H relates the measured vector Z to the state vectorX k , whereas V k is measured noise. Therefore, in essence, the Kalman filter is responsible for estimating the next state given the current state and the noise values, which allows for prediction. Figure 2 highlights the process flow of the filter. One can see from Figure 2 that the Kalman filter is an iterative technique used for prediction and correction of state variables.

Detail Steps of the Proposed Occupancy Scheme:
Step 1: A series of frames are acquired with the use of the single overhead camera. For the sake of simplicity, the algorithm uses grayscale frames by converting RGB frames to grayscale.
Step 2: The background is denoted as B. It is challenging to obtain a fixed background due to changes in the environment's illumination levels. To remedy this, GMM is used in the proposed system. In this case, GMM work as a foreground detector. There are two main parameters of GMM, i.e., the threshold α and the Gaussian number (K). Values for these parameters are set as 0.7 and 3, respectively.
Step 3: Generally, algorithms confuse shadows as objects, determining them to be the foreground. Therefore, for every frame, shadows must be removed. This is achieved by converting the frame's color space to YCbCr. Then, apply morphological closing and opening operations. Mathematically, closing (PC) and opening (PO) are written as PC = Erode(Dilate(P), K r ), PO = Dilate(Erode(P), K r ), here K r denotes the kernel.
Step 4: The threshold defines where the background ends and the foreground begins. Subtract the current frame PO from B, which identifies the objects in motion that exists in the foreground that is the ROI.
Step 5: The seed values for Intertwining and Chebyshev maps are selected as a secret key.
Step 6: Iterate the Intertwining and Chebyshev maps H × W times, which is the same size as the size of ROI bound obtained in step 4. Pixels in ROI is shuffled using random indices obtained through Intertwining maps.
Step 7: The shuffled data matrix is diffused using the random matrix obtained through Chebyshev map. XORed operation is applied on shuffled ROI and random chaos valued obtained from Chebyshev. Lastly, the Advanced Encryption Standard (AES) substitution is applied to get the encrypted ROI.
Step 8: The Kalman filter estimate, the position of moving objects, and the Hungarian cost matrix ψ are obtained, which assigns the costs between the track and detection D.
Step 9: Finally, the number of people in the encrypted domain is counted.

Experimental Test and Security Analysis
The Logitech camera (2.0 megapixels) was installed in T10 office at Glasgow Caledonian University, United Kingdom. The frame size of the Logitec camera was set to a low value for efficient computation, i.e., 180 × 320 pixels. The camera was installed 1.7 meters above the ground. The video was processed for occupancy counting using the aforementioned steps in the proposed method. Each frame is encrypted for obtaining higher security. A plaintext image frame selected ROI encrypted complete image and encrypted ROI are shown in Figure 4, respectively. From Figure 4, one can see that the privacy of an individual is secure, and the desired region is encrypted; however, it is compulsory to prove the encryption strength through mathematical security parameters. Security measures are carried out and discussed in very detail.

Histogram Analysis
Histogram analysis is one of the most significant security measures that represents the occurrence of the pixels in a defined range. The uniformity of pixels validates that the confidential information is encrypted; thus, the eavesdropper will have no clue of the original information. The histogram is applied to the plain text image. The peaks of the plain image pixels are compared to the uniform and equally distributed pixels of the encrypted image shown in Figure 5. The regular distribution of pixels that are shown in Figure 5 depicts that the proposed scheme is secure.

Correlation Coefficient Analysis
The correlation coefficient defines the distribution of the pixels in a plain and encrypted digital image. Pixels that are similar to each other show that they are highly correlated with each other. Such pixels that are not similar to each other show that the pixels have a lower correlation. Such tests highlight lower correlation in encrypted image. Mathematically, the correlation coefficient is written as where as δ XY in the aforementioned Equation (10) is covariance of the random variables X and Y, δ 2 X and δ 2 Y are the variance that in the random variable X and Y. Each term is defined as follows, where µ X and µ Y are the expected values of the random variables X and Y. The correlation coefficient values are between −1 and 1. The value 1 indicates the maximum value of correlation and shows that a digital plain and the encrypted image is similar. In contrast, a value "−1" shows that the encrypted image is negative of the original image. Ideally, the correlation value should be near 0. A value near to zero depicts that the suggested scheme is highly secure. Plain digital image values for the horizontal, diagonal, and vertical directions are 0.9086, 0.8313, and 0.9053, respectively, with a mean value for all three directions is 0.8817. For encrypted image values for, horizontal, diagonal, and vertical directions are 0.0005, −0.0047, and 0.1313, respectively, with the calculated mean value is 0.042, which is close to 0 as shown in the Table 1. The evaluated values are also compared to several existing algorithms and it can be seen the proposed system perform better. Furthermore, image pixels are examined for a plain and encrypted images that are shown in Figures 6 and 7 in horizontal, diagonal, and vertical directions, respectively. It is clear from correlation plots that encrypted image is highly scattered and therefore reveals that encrypted pixels are not similar.

Peak to Signal Noise Ratio
The quality of an encrypted image can be evaluated through the peak to signal noise ratio (PSNR) test. PSNR can be written as where I max in the above Equation (14) is the highest value of the pixel in the test image. For a good cryptosystem, a low value of PSNR is required, which depicts a significant difference between plain and encrypted images. The effectiveness of the proposed technique is evaluated using PSNR in decibel. The average value should be equal to 9.50 (dB), while for the proposed scheme is 9.26 (dB), which is less than 9.50 (dB), indicating a higher quality of encryption.

Mean Square Error
To assess the proposed scheme further, Mean Square Error (MSE) test is performed. MSE can be written as In the preceding Equation (15), M × N is the cumulative size of the image consisting of total pixels equal to 180 × 320. P i,j and C i,j are plain and cipher digital image at i th row and j th column. In the condition of mean square error (MSE), it is necessary to attain higher value. We studied the mean square error (MSE) test on the proposed scheme and computed its value which is equal to 7775.0. Moreover, the proposed system is also compared to the standards of AES, AES-CBC, AES-Counter, AES-Feedback and AES-Stream. The MSE test values are equal to 4600, 4637, 4938, 4577, and 4911 for AES, AES-CBC, AES-Counter, AES-Feedback, and AES-Stream, respectively, as shown in Table 2. These values are smaller than the proposed scheme values and therefore through MSE test a higher security of the proposed scheme is validated.

Entropy Analysis
The output encrypted image should be highly random which can be evaluated through entropy test. Mathematically, entropy is written as where p(x j ) is the probability mass function for the event x j . The b in the above Equation (16) indicates the logarithmic base. X is the random variable which takes n outcomes. For an ideal encryption scheme, value of entropy should be close to 8. The proposed scheme, entropy value is 7.99 ≈ 8. The value of 7.99 highlights that the proposed system is highly robust against differential attack. Moreover, the proposed system has higher entropy values than other traditional schemes (Table 3).

Mean Absolute Error
Mean absolute error (MAE) is the other security parameter that is used to investigate the probability of the differential attack. In other words, it determines the maximum difference between a plain image and the encrypted image. MAE is written as whereas M × N is the total size of an image. The C i,j in the Equation (17) depicts the secure cipher image at ith row and jth column, whereas P i,j is the plain image at ith row and jth column. The greater the value of mean absolute error (MAE), the less chance of occurrence of a successful attack. A value of 114 is accomplished after the test parameter, which shows that the proposed scheme has sufficient strength of opposing attack. The computed values is compared to several existing algorithms which is shown in Table 4. One can see from Table 4 that proposed system has lower MAE that highlight the security of the proposed scheme.

Number of Pixel Changing Rate
The test is used to find the sensitivity of pixel change rate when plain image or key is slightly changed. For analyzing Number of Pixel Change Rate (NPCR), consider C 1 (i, j) and C 2 (i, j), which are encrypted and the plaintext was only a pixel different. NPCR can be computed as where as: V i,j = 0 C 1(i,j) = C 2(i,j) 1 C 1(i,j) = C 2(i,j) The NPCR in the proposed scheme was more than 99% that indicates higher security of the proposed system.

Normalized Cross Correlation
The Normalized Cross-Correlation (NCC) is one of the essential security measures which is used for testing the security of an encryption algorithm. This test is mainly dependent on two parameters: (i) mean and (ii) variance. NCC is calculated as whereas in the above Equation (19), the var is a variance between x and y, mean x and mean y are the average values between x and y, respectively. The output range of NCC is between [1, −1]. The value of 1 indicates that the pixels are highly correlated to each other. In contrast, a value less than 1 shows that the pixels are dissimilar, and the proposed system is secure. The achieved value for the proposed system is (0.6883 < 1) depicts sufficient security and resistance against differential attacks.

Time Complexity of the Proposed System
It is crucial to have a good cryptosystem and must use the least resources and should be computationally efficient. Such a cryptographic algorithm which are computationally inefficient and requires much time for encryption/decryption, cannot be used as a real-time security solution. We have carried out the time complexity test of the proposed cryptosystem and the processing time was only 8.6 msec. The examination is carried out on MATLAB 2019(a) with a system having 8GB RAM. The calculated computational time for the proposed system is compared to several existing systems as shown in the in Table 5 that highlight the real-time applicability of the proposed system.

Structural Content
Similarity between plain image and cipher image is calculated via Structural Content (SC) test. It determine the similarity between the plain and encrypted image. Mathematically, SC is written as whereas O i,j and E i,j in Equation (20) are original and encrypted images at ith row and jth column, respectively. The value of SC is between (1, −1). A value less than 1 indicates that the proposed system is secure while a value close to 1 highlights that the scheme is insecure for digital images. In the proposed scheme, SC is 0.6257 which is less than 1 and therefore it indicates higher security of the proposed scheme.

Conclusions
This paper presents a novel privacy preserved occupancy monitoring system. The number of people can be counted along with the Region of Interest (ROI) based encryption. Such ROI-based encryption offers improved computation speed. Intertwining and Chebyshev maps are used to encrypt moving objects in the foreground which drastically improve the performance. The results show that the chaotic maps used in this paper are highly sensitive to the initial seed parameters. Such properties of chaos maps protect an attacker from numerous attacks. The proposed scheme is tested in a real-time office environment and the security is proved via a number of security parameters is reported in this research. These parameters include entropy, correlation, mean square error, mean absolute error, peak to signal noise ratio, number of pixel change rate, normalized cross correlation, and structural content. Results from these tests confirm the usefulness of the proposed technique in real-time environment and verify a higher level of security. Our future goal is to test the proposed method with other chaotic maps, and furthermore compare it with a number of other conventional encryption schemes.