## 3 Main Scheme
### Algorithm III. Meaningful Shares Scheme
[Method 3] Favor encryption**

**Input:**\(N\) secret images \(S_{0},\ S_{1},\ \ldots,\ S_{N-1}\), \(n\) meaningless shares \(C_{0},\ C_{1},\ \ldots,\ C_{n-1}\), \(n\) camouflage images \(D_{0},\ D_{1},\ \ldots,\ D_{n-1}\), all of them with size \(w\times h\), and a positive integer \(p\). **Output:**\(n\) meaningful shares \(M_{0},\ \ldots,\ M_{n-1}\) with size \(w\times h\). 1. Let \(X=\left\lceil n/2\right\rceil\), \(Y=\left\lceil n/2\right\rceil\), and randomly select a pixel \((i,j)\{0\leq i\leq w,\ 0\leq j\leq h\}\). 2. Define a number \(d=\) random \((0,\ 1)\), which is \(1\) with probability \(\gamma\). 3. **If \(d=0\) then** For \(k=0\) to \(p\)do** For \(r=0\) to \(n-1\)do \(M_{r}((i+k\times w/p)\ \%\ w,j)=C_{r}((i+k\times w/p)\ \%\ w,j)\). **else** For \(k=0\) to \(p\)do \(r=0\) to \(n-1\)do \(M_{r}((i+k\times w/p)\ \%\ w,j)=D_{r}((i+k\times w/p)\ \%\ w,j)\). **For \(k=0\) to \(p\)do** If \((M_{0}((i+k\times w/p)\%w,\ j)\oplus...\ \oplus M_{n-1}((i+k\times w/p)\%w,\ j)\
eq S_{0}((i+k \times w/p)\%w,\ j))\), then

Let \(f=\) random \((0,n-1)\). \(M_{f}((i+k\times w/p)\ \%\ w,\ j)=\overline{M_{f}((i+k\times w/p)\ \%\ w,\ j)}\). 4. **Repeat Steps 1-3 until all pixels are processed in \(n\) meaningful shares, then**return\(M_{0},M_{1},\ldots,\ M_{n-1}\). **Algorithm 5. [Method 3] Favor encryption**

Figure 9: The flow chart of Method 3 Steps 1-3. Last, we would like to introduce Method 4. Because Method 2 only considers whether the result is black pixels for the \(Z^{th}\) image, it is unable to fully restore all the black pixels for all secret images. In order to restore the black pixels of all secret images completely (perfect black), we propose Method 4: Perfect black encryption. Algorithm 6 shows Method 4 as follows. ```
Input:\(N\) secret images \(S_{0},\ S_{1},\ \ldots,\ S_{N-1}\), \(n\) meaningless shares \(C_{0},\ C_{1},\ \ldots,\ C_{n-1}\), \(n\) camouflage images \(D_{0},\ D_{1},\ \ldots,\ D_{n-1}\), all of them with size \(w\times h\), and a positive integer \(p\). Output:\(n\) meaningful shares \(M_{0},\ldots,\ M_{n-1}\) with size \(w\times h\). 1. Let \(X=\lceil n/2\rceil\), \(Y=\lceil n/2\rceil\), and randomly select a pixel \((i,j)\{0\leq i\leq w,\ 0\leq j\leq h\}\). 2. Define a number \(d=\) random \((0,\ 1)\), which is \(1\) with probability \(\gamma\). 3. If\(d=0\)then For\(k=0\)to\(p\)do For\(r=0\)to\(n-1\)do \(M_{r}((i+k\times w/p)\ \%w,j)=C_{r}((i+k\times w/p)\ \%w,j)\). else For\(k=0\)to\(p\)do For\(r=0\)to\(n-1\)do \(M_{r}((i+k\times w/p)\ \%w,j)=D_{r}((i+k\times w/p)\ \%w,j)\). For\(k=0\)to\(p\)do If\(M_{0}((i+k\times w/p)\%w,\ j))\oplus...\ \oplus M_{X-1}((i+k\times w/p)\%w,\ j)\
eq 1\), then Let \(f=\) random\((0,X-1)\). \(M_{f}((i+k\times w/p)\ \%w,\ j)=\overline{M_{f}((i+k\times w/p)\ \%w,\ j)}\). If\(M_{X}((i+k\times w/p)\%w,\ j))\oplus...\ \oplus M_{n-1}((i+k\times w/p)\%w,\ j)\
eq 0\), then Let \(g=\) random\((X,n-1)\). \(M_{g}((i+k\times w/p)\ \%w,\ j))=\overline{M_{g}((i+k\times w/p)\ \%w,\ j)}\). 4. Repeat Steps 1-3 until all pixels are processed in \(n\) meaningful shares, then return \(M_{0},M_{1},\ldots,\ M_{n-1}\). ```

**Algorithm 6** [Method 4] Perfect black encryption

The time complexity of Method 4 is \(O(whn)\). Figure 11 shows the flow chart of Method 4 Steps 1-3. Note that, since we made the pixels participating in the camouflage appear black when restoring the first \(X\) shares and the last \(Y\) shares, these two shares will look similar if \(X=2\) or \(Y=2\). See Figure 12, the experimental results of Method 4, for an example (where \(N=5\), \(Y=2\)). Therefore, we give another experimental result (\(N=8\)) for this method. Figure 13 shows the new experimental results. Figure 10: Experimental results by Method 3 for \((5,5)\) with \(p=45\), \(\gamma=0.5\). (**a,b**) Restored images \(R_{0}\), \(R_{1}\) (**c–g**) Shares \(M_{0},\ldots,M_{4}\). ### Algorithm IV. Secret Reconstruct Scheme

In this subsection, Algorithm IV is introduced, which decrypts the recovered image. To restore \(G_{1}\), we pool the first \(X\) shares together and apply an XOR operation to them.