# Color Visual Secret Sharing for QR Code with Perfect Module Reconstruction
## 3 The Proposed VSS-QR
### VSS-QR Encoder  
Given a secret QR code \(\mathbf{H}\), the encoder generates three shares \(\mathbf{S}_{1},\ \mathbf{S}_{2},\ \mathbf{S}_{3}\). To ensure perfect reconstruction of \(\mathbf{H}\) at the decoder, we need to design the set of colors for encoding B/W secret modules. Let \(\mathcal{E}_{1}\) and \(\mathcal{E}_{0}\) be the two sets of colors for W/B secret modules, respectively. We intend to ensure that, a white secret module is constructed as white module and a black secret module is constructed as a module with a secondary color (such as cyan, magenta or yellow). To this end, we design \(\mathcal{E}_{1}\) and \(\mathcal{E}_{0}\) as follows. The set \(\mathcal{E}_{1}\) is designed as \(\mathcal{E}_{1}=\{\mathsf{R},\ \mathsf{G},\ \mathsf{B}\}\) since all three primary colors are needed in order to generate a white module. To design \(\mathcal{E}_{0}\), we need to determine the reconstructed color for black secret module. For example, if the black secret module should be reconstructed as magenta, then we set \(\mathcal{E}_{0}=\{\mathsf{R},\ \mathsf{B}\}\). In summary, let \(\mathbf{H}(x,\ y)\) and \(\mathbf{T}(x,\ y)\) be the secret module and reconstructed module at position \((x,\ y)\), respectively. Then we set  
Figure 3: The overall block diagram. \[\mathcal{E}_{0}=\left\{ \begin{array}{l}\left\{\texttt{G},\texttt{B}\right\}, \texttt{if}\ \textbf{T}(x,\ y)=\texttt{C},\\ \left\{\texttt{R},\texttt{B}\right\},\texttt{if}\ \textbf{T}(x,\ y)=\texttt{M},\\ \left\{\texttt{R},\texttt{G}\right\},\texttt{if}\ \textbf{T}(x,\ y)=\texttt{Y}, \end{array} \right. \tag{5}\]  
if \(\textbf{H}(x,\ y)=0\). If the color for the reconstructed module is not specified, then one may randomly select \(\mathcal{E}_{0}\) from the set \(\left\{\texttt{G},\texttt{B}\right\},\left\{\texttt{R},\texttt{B}\right\}, \left\{\texttt{R},\texttt{G}\right\}\). Once designed, the two sets \(\mathcal{E}_{0}\) and \(\mathcal{E}_{1}\) remain fixed during the encoding process. For clarity, let us focus on only one module in the secret QR code **H** and the reconstructed QR code **T**. To share a black module \(\textbf{H}(x,\ y)=0\), we must ensure that the two colors in \(\mathcal{E}_{0}\) appear at least once in the three shares \(\textbf{S}_{1}(x,\ y),\ \textbf{S}_{2}(x,\ y),\ \textbf{S}_{3}(x,\ y)\). Let \(p\sim\mathcal{P}\) denotes random selecting an element from the set \(\mathcal{P}\) and assigning it to \(p\), and let \(\mathcal{P}\setminus\mathcal{Q}\) denotes the difference set between two sets \(\mathcal{P}\) and \(\mathcal{Q}\). Then we have  
\[\textbf{S}_{1}(x,\ y) \sim \mathcal{E}_{0}, \tag{6}\] \[\textbf{S}_{2}(x,\ y) \sim \mathcal{E}_{0},\] (7) \[\textbf{S}_{3}(x,\ y) \sim \mathcal{E}_{0}\backslash\left\{\textbf{S}_{1}(x,\ y)\right\}. \tag{8}\]  
This operation can ensure that the stacking result of the three shares is a secondary color, i.e., \(\cap_{i=1}^{3}\textbf{S}_{i}(x,\ y)\in\left\{\texttt{C},\texttt{M},\texttt{Y}\right\}\). To share a white module \(\textbf{H}(x,\ y)=1\), we must ensure that the three colors in \(\mathcal{E}_{1}\) appear at least once in the three shares \(\textbf{S}_{1}(x,\ y),\ \textbf{S}_{2}(x,\ y),\ \textbf{S}_{3}(x,\ y)\). We may use the following operations:  
\[\textbf{S}_{1}(x,\ y) \sim \mathcal{E}_{1}, \tag{9}\] \[\textbf{S}_{2}(x,\ y) \sim \mathcal{E}_{1}\backslash\left\{\textbf{S}_{1}(x,\ y)\right\},\] (10) \[\textbf{S}_{3}(x,\ y) \sim \mathcal{E}_{1}\backslash\left\{\textbf{S}_{1}(x,\ y),\textbf{S} _{2}(x,\ y)\right\}. \tag{11}\]  
These operations can ensure that the stacking result of the three shares is white color, i.e., \(\cap_{i=1}^{3}\textbf{S}_{i}(x,\ y)=\texttt{W}\). For example, if we select \(\mathcal{E}_{0}=\left\{\texttt{R},\texttt{B}\right\}\) and \(\mathcal{E}_{1}=\left\{\texttt{R},\texttt{G},\texttt{B}\right\}\), then for \(\textbf{H}(x,\ y)=0\), we may get \(\textbf{S}_{1}(x,\ y)=\texttt{R}\), \(\textbf{S}_{2}(x,\ y)=\texttt{R}\), \(\textbf{S}_{3}(x,\ y)=\texttt{B}\) and \(\cap_{i=1}^{3}\textbf{S}_{i}(x,\ y)=\texttt{M}\).