1 Introduction

The COVID-19 pandemic has made us realize the importance of the Internet and multimedia technologies. The complete communication system worldwide has moved to the Internet using multimedia data. They have been the actual source of data transmission and information exchange (Wong et al. 2021). It is imperative to say that the trend is far from over. Thus, a reason to think more about the security, authenticity, robustness and illegal copying of the documents exchanged through open online media. Popular image processing software can modify digital multimedia documents quickly and professionally. This has aided in the creation of various image forgery attacks. Authentication has been necessary for tamper detection and owner identification in many human-centric applications, including forensic analysis, insurance processing, surveillance systems, radiography imaging, journalism, etc. Data hiding plays a critical role in thwarting unwanted activities carried out with advanced technologies.

Technically, hidden data communication can be achieved through cryptography, watermarking and steganography with a motive to provide information security. Confidentiality and security of the information are the souls of data communication. Complete data hiding systems can be put into two categories: information hiding and encryption. Generally, watermarking is applied to hide or embed a message in a cover image so that authenticity and copyright can be proved when asked for (Fkirin et al. 2021). The watermark applied can be visible or invisible. On the other hand, steganography has the power to conceal a hidden secret message in a covered medium, making it impossible for an attacker to discover its presence. The hidden message is used for various purposes, including secret data sharing, secure correspondence and authentication. Cryptography does not hide the secret data but encrypts the original data through a secret key and then sends it to the receiver.

The objective of any data hiding scheme is better to feature robustness, imperceptibility, security and hiding capacity. However, it is arduous to extract the maximum out of each mentioned feature at any point in time. There have to be pareto-optimal solutions to maintain each property at its optimum level. An increase in the amount would lead to a decrease in the other. Also, at times, the development of a data hiding scheme is lead considering the field of application. In some fields, robustness is preferred, while some prioritize high security and imperceptibility. As suggested by Abraham et al. (2004), robustness is generally required for a system where the chance of unwanted malicious attacks is high. High visual quality or capacity is not always required since a watermark can be either visible or invisible within watermarking.

In this paper, an emphasis has been put on designing a robust data hiding scheme that follows the Gestalt principle governing color proximity. It states “things that are close together appear to be more related than things that are spaced farther apart”. The relationship between items cannot be predicted in a precise way. Thus, a fuzzy model has been designed to counter the imprecise nature of color proximity related to a group of pixels. The degree of proximity may vary from expert to expert. Therefore, to model an ambiguous nature of proximity in a real-world scenario, fuzzy sets (Zadeh 1965) and logic have been applied rather than conventional logic. The proximity between the pixels is measured through fuzzy logic by simulating not only the difference between the intensity of the pixels but also the distance apart they lie. Additionally, the scheme is also formulated to address the problem of tampering coincidence (Lee and Lin 2008) which causes a great hindrance in the path of recovery of the secret data after tampering. When both the blocks containing original and recovery data are tampered, it becomes difficult to extract the hidden information. To counter this problem, authors have embedded copies of the secret message at random blocks. As a result, even after tampering with a specific region, the message could be possibly obtained from some other blocks. Consequently, a second chance to reconstruct the hidden secret data or image should be applied in case of deleting a specific region and recovering secret data. The main contributions of the proposed scheme are as follows:

  1. i)

    A novel steganographic procedure has been built with fuzzy logic to hide secret data.

  2. ii)

    Fuzzy rule-based controller is designed that can efficiently compute proximity relationship between pixels based on two properties, color difference and closeness.

  3. iii)

    Two copies of secret data are hidden separately at random positions according to the secret key to avoid tampering coincidence problem.

  4. iv)

    Color difference and closeness between a pair of pixels is modeled through fuzzy linguistic variables.

  5. v)

    Data hiding scheme formulated is semi-fragile and recoverable with high visual quality measured by PSNR (dB) and SSIM than recent state-of-the-art schemes.

In this paper, few key terms that will come across more often are explained here and a list of notations used are illustrated in Table 1 for easy readability.

  1. i)

    Cover Image: The original image used for embedding of secret message.

  2. ii)

    Message: Secret data that are sent by the sender to the receiver.

  3. iii)

    Stego Image: The image obtained after hiding the message.

  4. iv)

    Robustness: The capability of an image to resist attacks.

  5. v)

    Imperceptibility: The strength of a steganographic technique to hide the message in a way that is not identifiable by a naked eye or image statistic.

Table 1 List of notations

The rest of the paper is organized as follows: Sect. 2 carries a data hiding related work relevant to this paper. In Sect. 3, the preliminary concept of fuzzy logic is discussed. The proposed embedding and extraction procedures are provided in Sect. , followed by experimental results and comparisons in Sect. S5. In the end, a conclusion is drawn in Sect. 6.

2 Related work

The relevant investigation regarding hidden data communication has progressed over time. In the literature, many data-hiding-based authentication methods have been reported by many researchers recently. Three main characteristics distinguish authentication methods: (1) data generation for authentication, (2) data generation for recovery and (3) the data embedding process used. In multimedia authentication, fragile data hiding schemes incorporating Least Significant Bit (LSB) replacement are commonly used. For any data hiding scheme, imperceptibility is a major concern. The message must be embedded in such a way that its presence is not tracked either statistically or visually (Yang et al. 2022).

In steganography, the information required for communication to the receiver is embedded in the cover image by a sender. On receiving, a receiver segregates the confidential data. Two types of motivations can be used to design a steganographic process: reversible and irreversible. In the former, both the cover and message can be recovered precisely, while in the latter, only the message is recovered without error.

The most widely used reversible schemes are based on histogram shifting and error expansion (Jia et al. 2019; Lee et al. 2019). Most reversible methods are unaware of the importance of security and robustness considerations in certain situations. The least significant bit (LSB) technique is one of the most straightforward and widely used spatial image steganographic methods. The hidden data are inserted directly into the host image using LSB-based spatial domain techniques, which modify the least significant bits of selected pixels without distorting the visual quality of the original cover image. Earlier LSB steganography research (Chandramouli and Memon 2001; Sutaone and Khandare 2008) focused solely on designing the device to maximize payload capability by using the majority of the cover image pixels. The research issue became more oriented after that to develop sophisticated, robust LSB-based cryptography-steganography that can withstand such steganalysis attacks (Patel and Meena 2016; Rajendran and Doraipandian 2017; Shafi et al. 2018). Learning methods, for example, were used to optimize LSB substitution (Maity and Kundu 2009; Dadgostar and Afsari 2016).

Hidden bits can also be integrated into a cover image using transform domain values. The secret bits are concealed under the sub-band frequency coefficients in transform domain methods (Valandar et al. 2020). In the field of steganography, a variety of transform domain methods are used, with the most common schemes being the Discrete Fourier Transform (DFT), Discrete Cosine Transform (DCT), Discrete Wavelet Transform (DWT) and variations in these basic transforms. In the field of DFT steganography, various image systems have been proposed (Khashandarag et al. 2011; Haibo 2008). The paper (Seki et al. 2005) shows a steganographic image scheme with hidden data embedded in the jpeg encoder. In steganography based on DCT, the cover image is divided into non-overlapping (\(8 \times 8\)) pixel blocks. A similar modified DWT scheme for embedding hidden bits in between wavelet coefficients was discussed by Samer et al. (2017). Compared to the traditional DWT approach, Diamond Encoding (DE) in DWT is proposed here to improve protection and reduce image distortion.

The true motive for steganography is to share data in an undetectable way. Researchers experimented with various ways to improve imperceptibility in the steganographic system. Chang et al. (2008) used a 2-level quantization method along with a genetic algorithm in which three bits are additionally embedded over image blocks with high fidelity to try to maximize payload power. For the embedding operation, this method uses the most suitable regions or features in the cover image (Balasubramanian et al. 2014; Hamid et al. 2012a, b). Local features are derived based on image segmentation that can be used to differentiate noisy areas, with the embedding focused in the noise areas (Niimi et al. 1999). A threshold value is used to pick the high frequency pixels of the cover and then the LSBM Revisited algorithm is used to conceal hidden data (Mungmode et al. 2016). However, finding the optimal local solution requires many computational stages, which slows down the search for specific embedding locations. As a result, the genetic algorithm is highly resistant to image manipulation.

A fuzzy logic-based method focuses more on visual consistency preservation to enhance stego-media imperceptibility at the expense of increased modeling complexity. Fuzzy techniques have been used in a variety of ways, for example, a Fuzzy Inference System (FIS) with HVS is used in a study (Chang et al. 2008) to make decisions based on local statistical, texture and brightness information-based feature vectors. The method will specify the semantic rules for the embedding process using these features from cover image sub-regions. Also, at a higher embedding rate, the principle helps to minimize stego image distortions. Few recent investigator (Jagadeesh et al. 2016; Tang et al. 2021, 2022) illustrates a different fuzzy-based approach. Before the actual embedding operation, the cover pixel selection is based on fuzzy pixel classification and the secret message is converted to a mode of fuzzy data. Kiani et al. (2009) clarify another fuzzy-based watermarking technique that employs a fuzzy-c clustering algorithm based on transform domain derivative features in various directions. Fuzzy logic can improve steganographic schemes in various ways, particularly when the image textures are vague and/or ambiguous. It benefits the system by quickly identifying appropriate image patterns and reducing irreversible complexities. This will ultimately aid practical applications that make use of sufficient imperceptibility. Some of the earlier work relies on a correlation-based cover selection method, image block similarity (Sajedi and Jamzad 2008) and statistical measures features.

2.1 Review of Ashraf et al. (2020) Scheme

Based on human perception, Ashraf et al. formulated a rule-based interval type-2 fuzzy logic system to calculate a similarity measure of the surrounding pixels. LSB approach was considered to find the pixel values with high similarity measures. A \(3 \times 3\) window of pixels corresponding to the central pixel was taken into account for similarity calculation. The complete procedure involved five steps: calculation of gray level pixel difference, conversion of the value to type-2 fuzzy, setting up the inference engine, defuzzification and lastly, similarity calculation. The authors employed a similarity threshold to choose the best pixel for embedding. At the time of embedding, the actual pixel value was converted to a binary bitstream where k number of bits were replaced with the secret message. Experimental results demonstrated a good payload of 0.25 bpp on average for the standard images with an image quality of 51.58 dB. It has the scope of enhancing the visual quality of the image. This scheme has neither been tested for the color images nor any geometrical or non-geometrical attacks.

From the overview of the discussion mentioned above, fuzzy logic has been put to its strength in this paper to design a robust data hiding scheme to model the vague nature associated with the features of an image.

3 Preliminaries

The universal set can be described so that all elements are categorized as members or nonmembers based on a predefined characteristic feature. If U denotes the universe set and x denotes the general elements, the characteristic function \(F_X(x)\) maps all members of U into the set \(\{0, 1\}\). The classical sets can be represented mathematically as membership functions by the following expression:

$$\begin{aligned} F_X(x) = {\left\{ \begin{array}{ll} 1 &{} \text {if }x \text { belongs to X}\\ 0 &{} \text {if }x \text { does not belong to X.} \end{array}\right. } \end{aligned}$$

Fuzzy set: It is a set on which a mathematical model can be constructed to represent imprecise or vague situation. It derives a degree of association of domain elements to its fuzzy set. Fuzzy sets considers all possible values that can exist between 0 and 1 that is yes or no. It does not directly make a distinction between those that are part of the collection and those that are not. Fuzzy set tags a membership number which defines the extent of association of an object in a set. Let \(x \in X\) be an element present in a fuzzy set \({\tilde{A}}\). The degree of membership of x in \({\tilde{A}}\) is indicated by \({\mu }_{{\tilde{A}}}(x)\). Subsequently, the fuzzy set is represented in terms of ordered pair \({\tilde{A}} = {(x, {\mu }_{{\tilde{A}}}(x)/x \in X)}\).

Fuzzy number: A number which is imprecise in nature such that it belongs to real number \(\Re \) and have the weight, i.e., membership value between the range [0, 1]. It is convex and continuous in nature.

For example, Let \({\tilde{A_1}}\) and \({\tilde{A_2}}\) be two fuzzy numbers in \(\Re \) with membership functions \({\mu }_{\tilde{A_1}}(x)\) and \({\mu }_{\tilde{A_2}}(x)\), respectively. Then, according to Dubois (1980) and Zadeh (1978)

$$\begin{aligned} \mathrm{{pos}}(\tilde{A_1}*\tilde{A_2}) = \mathrm{{sup}}\{\mathrm{{min}}({\mu }_{\tilde{A_1}}(x),{\mu }_{\tilde{A_2}}(y)),x,y\in \Re ,x*y\}\nonumber \\ \end{aligned}$$

where pos represents possibility, \(*\) is any one of the relations \(>,<,=,\le ,\ge \) and \(\Re \) represents set of real numbers.

A basic unit of a fuzzy number that conforms to the above description can be depicted graphically in Fig. 1. The numbers \(a_1\), \(a_2\), \(a_3\) and \(a_4\) plotted in the given figure are real numbers whose membership values are calculated. The membership function determines whether the fuzzy number \({\tilde{A}}\) is continuous or discrete. A continuous fuzzy number can be represented by a special class of triangular fuzzy numbers (Roy and Bhaumik 2018), trapezoidal fuzzy numbers and Gaussian fuzzy numbers.

Fig. 1
figure 1

General representation of a fuzzy number

Triangular fuzzy number (TFN): A TFN \({\tilde{A}}\) = \((a_1, a_2, a_3)\) (refer Fig. 2) has three parameters \(a_1,a_2,a_3\), where \(a_1<a_2<a_3\) and is characterized by the membership function \({\mu }_{{\tilde{A}}}\), given by Eq. (3).

$$\begin{aligned} {\mu }_{{\tilde{A}}}(x) = {\left\{ \begin{array}{ll} \frac{x-a_1}{a_2-a_1} &{} \text {for } a_1 \le x \le a_2\\ \frac{a_3-x}{a_3-a_2} &{} \text {for } a_2 \le x \le a_3\\ 0 &{} \text {otherwise} \end{array}\right. } \end{aligned}$$
Fig. 2
figure 2

Triangular fuzzy number representation

Linguistic variables: The concept of linguistic variables is crucial to the growth of fuzzy set theory (Bhaumik et al. 2020). Fuzzy logic is mainly used to measure and reason out imprecise or ambiguous words found in our languages. Linguistic or fuzzy variables are the terminology used to describe these terms. For example, temperature could be denoted as a linguistic variable such as very hot, hot, cold, and very cold.

Fuzzy rule-based system: Expert information is incorporated into the Mamdani fuzzy rule-based structure in the form of linguistic variables in this paper. The fuzzy rules are made up of input and output variables that take values from term sets that represent the meanings of each linguistic term. Every rule is a condition-action statement with a human-readable interpretation. It has the structure of disjunctive normal form fuzzy rule, which has the following form:

$$\begin{aligned} \text {If } X_1 \text { is } \tilde{A_1} \text { and... } X_n \text { is } \tilde{A_n} \text { then } Y \text { is } B. \end{aligned}$$

4 Proposed scheme

TThe proposed data hiding scheme can be confined to two stages. The first stage consists of block segregation, fuzzy proximity calculation, block proximity gradation with interval threshold and data embedding. Figure 3 depicts the flowchart of the stages considered in the designed embedding technique. During the second stage, secret data extraction, authentication, post-processing and self-recovery are performed.

4.1 Block segregation

In the designed scheme, a color image of size \((M \times N)\) is taken into account and split into three separate channels of red, green and blue. Each channel is further partitioned into non-overlapping blocks of size \((b \times b)\). The blocks are used to measure the proximity relationship among the pixels present within the blocks. In the literature, authors have used similarity to measure the relationship between the pixels. However, Wuerger et al. (1995) have iterated in their research that proximity is not dependent only on the Euclidean properties of the pixels in contention. The proximity between the pixels follows the law of proximity as defined in the Gestalt grouping law. This simple rule states that objects close together are more likely to be grouped than those further apart objects. Thus, in the proposed research, while calculating the proximity of pixel (\(\chi \)), importance has been given to the difference in intensity (colordiff) and distance (closeness) as well.

$$\begin{aligned} \chi (P_i,P_j)= & {} \alpha {\varDelta }_\mathrm{{RGB}}(P_i,P_j) + (1-\alpha )\psi (P_i,P_j) \end{aligned}$$
$$\begin{aligned} {\varDelta }_\mathrm{{RGB}}(P_i,P_j)= & {} \sqrt{(R_j - R_i)^2 + (G_j - G_i)^2 + (B_j - B_i)^2}\nonumber \\ \end{aligned}$$
$$\begin{aligned} \psi (P_i,P_j)= & {} \sqrt{(x_j - x_i)^2 + (y_j - y_i)^2} \end{aligned}$$

Consider a pixel \(P_i\) and \(P_j\) with location \((x_i,y_i)\) and \((x_j,y_j)\), respectively, in a block as shown in Fig. 4. The proximity of pixel \(P_i\) in reference to pixel \(P_j\) is given by Eq. (5). Here, \({\varDelta }_\mathrm{{RGB}}(P_i,P_j)\) represents the difference in intensity values of red, green and blue channels as provided in Eq. (6). The closeness of two pixels is measured in terms of Euclidean distance between them through Eq. (7). The parameter \(\alpha \) is the bias weight added to control the relative importance among the color difference and closeness.

Fig. 3
figure 3

Flowchart of the stages in the proposed embedding technique

4.2 Fuzzy proximity calculation

To calculate proximity, a fuzzy rule-based controller is prepared with four functions namely (i) Fuzzification, (ii) Fuzzy rule base, (iii) Fuzzy inference mechanism and iv) Defuzzification. The perceptual analysis of proximity may vary from expert to expert, as has been shown by Demirci (2006) in its paper for similarity calculation. Thus, it is best to use fuzzy rule-based logic to deal with the imprecise nature of proximity between the pixels. To calculate proximity between the pixels, two factors, color differences (colordiff) and closeness, are considered input for fuzzification. Each factor is represented as a fuzzy set with fuzzy linguistic variables as lowmedium and high. There are several membership functions to model these linguistic terms, as trapezoidal, Gaussian, triangular, etc., however, the triangular fuzzy number is chosen to represent the stated linguistic terms due to its simplicity and symmetric representation. Also, during the experimental analysis, the triangular membership function maintained high visual quality with good PSNR than the other stated membership functions. According to Eq. (6), the minimum and maximum values that it can hold are 0 and \(255\sqrt{3}\), respectively, since the difference in a color channel between two pixels is in the range [0, 255]. In the same way, closeness has the value in the range [\(1, \sqrt{2}(b-1)\)]. Both these factors are modeled as shown in Fig 5.

Fig. 4
figure 4

Non-overlapping block of size (\(b \times b\))

Fig. 5
figure 5

Membership functions for fuzzy set colordiff and closeness

After fuzzification, a fuzzy inference engine is set up which performs according to certain rules. The fuzzy inputs generated after fuzzification are combined with rule base to produce a degree of association between two pixels. This association measures how strong a proximity exists. So, given n inputs such that \(x_1 \in X_1\), \(x_2 \in X_2\),..., \(x_n \in X_n\) and one output \(y \in Y\), the \(i^{th}\) fuzzy rule according to Eq. (4) is represented as

\(R_i:\) If \(x_1\) is \(\tilde{A_1}, x_2\) is \(\tilde{A_2},...,x_n\) is \(\tilde{A_n}\) Then y is \({\tilde{B}}\)

The set of inputs in the rule base is also called antecedent and output as consequent. The best fuzzy rules that performed well for the proposed work are illustrated in Table 2. The consequent is generated in the form of \(\chi \), which is denoted by the linguistic term LowMedium and High. The triangular fuzzy number of the consequent is shown in Fig. 6 with overlapping in the interval \([0-100]\) with 0 being the minimum and 100 as the maximum.

Table 2 Fuzzy rules

The actions of an individual rule are superimposed to construct a fuzzy output set as the final production. The fuzzy output is generated by combining the outputs of the rules that have been shot. On the fuzzy output, the following defuzzification methods generate a crisp value. The crisp value is the point of the output membership function that divides the region in half, as the name implies. Maxima methods and area-based methods are two popular defuzzification techniques. The centroid method is a common area-based defuzzification technique.

Fig. 6
figure 6

Membership functions for proximity of pixels (\(\chi \))

Fig. 7
figure 7

Proximity calculation network

In this way, for each \(P_i\) present in a block, we calculate the proximity pixels \(\chi (P_i,P_j)\) such that \(j=1,2,...,b^2;j\ne i\). The proximity calculation network of pixels in a block is demonstrated in Fig. 7. At last, the cumulative proximity of pixel \({\chi }_\mathrm{{cpr}}(P_i)\) is computed by Eq. (8).

$$\begin{aligned} {\chi }_\mathrm{{cpr}}(P_i) = \frac{\sum _{j=1}^{b^2} pr(P_i,P_j)}{b^2 -1}; j \ne i \end{aligned}$$

Now, the proximity of the block (\(\xi \)) in whole is determined by Eq. (9) as follows:

$$\begin{aligned} \xi = \frac{1}{b^2}\sum _{i=1}^{b^2} {\chi }_{cpr}(P_i) \end{aligned}$$

Accordingly, the proximity of each block needs to be determined.

4.3 Block proximity gradation with interval threshold

After calculation of block proximity (\(\xi \)), the blocks are graded as strong (S), moderate (M) and weak (W) based on proximity value, \(\xi \), using interval threshold. In the literature, a threshold value is generally precise, which has the advantage of partitioning an item into either of two sets. However, in this paper, an interval threshold has been selected for the study. An interval threshold contains an interval number between assigned ranges to partition a given item into any of three explicitly defined sections. Let \(t = [t^-,t^+]\) be an interval threshold in the range [0, 1] such that \(0<t^-,t^+<1\). A parameter \(\epsilon \) is introduced to extend a degree of elasticity within the interval threshold so that threshold values \(t^-\) and \(t^+\) do not behave rigidly. The value of \(\epsilon \) may vary from image to image. Now, the interval threshold becomes \(t = [{t^-}+\epsilon ,{t^+}+\epsilon ]\). Before categorization, the value of \(\xi \) is normalized between 0 and 1. A block(i) is graded as given in Eq. (10) and represented in Fig. 8.

$$\begin{aligned} \mathrm{{block}}(i) = {\left\{ \begin{array}{ll} S &{} \text {if } \xi \le (t^- +\epsilon ) \\ W &{} \text {if } \xi \ge (t^+ +\epsilon ) \\ M &{} \text {otherwise} \end{array}\right. } \end{aligned}$$
Fig. 8
figure 8

Proximity calculation network

4.4 Data embedding

For data embedding, similar graded blocks are grouped to hide data in the LSB. Blocks categorized as strong, moderate and weak are embedded with 1, 2 and 3 bits, respectively. Moreover, a set of three secret keys, \({Key}_S\), \({Key}_M\) and \({Key}_W\), are generated to determine the sequence of blocks for data hiding in the corresponding red, green and blue channel. A secret image considered for embedding within the cover image is converted into a binary bitstream. Each bit of the secret image is embedded twice in the appropriate channels of two different blocks specified through secret keys to overcoming the problem of tampering coincidence (Molina-Garcia et al. 2020). This helps to recover the secret hidden image after tampering with better accuracy and visual quality.

Fig. 9
figure 9

Example of Data Embedding

Let us consider an example shown in Fig. 9(i) where 16 blocks are graded as S, M or W. Accordingly, the blocks are grouped as per the assigned gradation. After that, corresponding secret keys are used to shuffle the sequence of blocks in respective groups (Fig. 9ii). New sequence obtained are marked as \(S^{'}(Key_S)\), \(M^{'}(Key_M)\) and \(W^{'}(Key_W)\). Finally, the secret data bits are double embedded in pairs, starting from 1-bit insertion to 3-bit insertion. Also, the order of insertion is maintained in color channels too. As given in Fig. 9(iii), the first secret bit 1 is embedded in the red channel of 4th block and the green channel of 10th block. The second bit, 0, is embedded in the blue and red channel of 15th and 6th blocks, respectively. Further, 2-bit embedding (0, 1) is carried out in two channels, such as the red and green channels of blocks 14th and 11th. Similarly, 3-bit embedding (0, 1, 0) is done in all three channels of a block, but in sequence, as appears, during data hiding such as blue, red and green channel of block 16th and 8th. Thus, in this way, total data embedding of secret data is completed and, finally, the stego image is generated. A pseudocode of the given technique is provided in Algorithm 1.

figure a

4.5 Data extraction

At the time of extraction, the stego image is passed through a fuzzy model and a block proximity matrix is generated, similar to data embedding. Data extraction from the LSB bit of channels is done in the same sequence and blocks as generated by the shared secret keys. Since a bit was double embedded during embedding, two vectors \(O_1\) and \(O_2\) are taken to maintain the copies of embedded bits. A extracted secret image is formed using either \(O_1\) or \(O_2\).

Further, a comparison is made between \(O_1\) and \(O_2\) to find any dissimilarity. For a dissimilarity, post-processing is applied as follows: A position i where a mismatch is found between \(O_1\) and \(O_2\), three positions prior and three positions after i is checked to predict the pattern of 1 and 0. Accordingly, the recovered secret image is composed of enhanced features.

5 Experimental results and comparison

The performance and efficiency of the proposed scheme are tested on a set of standard images collected across four databases, namely the UCID database (UCID 2017), USC-SIPI database (USC-SIPI 2017), Kodak database and STARE database (STARE 2017). Out of each database, four popular images of size \((512 \times 512)\) are chosen to create a variation and unbiasedness during comparison (Fig. 10). This will help assess the proposed scheme in a different environment with appropriate parameters and features. The experimental simulations are conducted in MATLAB on a Windows platform with 4GB RAM and a 2.6 GHz Intel core i5 processor. The results are computed for structural similarity index measurement (SSIM), peak signal-to-noise ratio (PSNR) and universal quality index (Q-Index). These three parameters help to analyze the performance of stego images. It shows the amount of perceptual effect caused due to a change in the number of bits of the original cover image. Other parameters such as standard deviation (SD), correlation coefficient (CC), normalize correlation coefficient (NCC) and bit error rate (BER) are computed to measure the distortion in stego images.

Fig. 10
figure 10

Set of considered cover images from standard databases for experiment

5.1 Quality of stego image and payload

After data hiding of the secret bits, as mentioned in the previous section, the quality of the stego image is checked through the parameters PSNR and Q-Index. PSNR is a measurement tool that is shown to be composed of the error squared value as the key component based on Eqs. (11) and (12). Here, M and N represent the resolution and C depicts the number of channels of the image. \(I_c(i,j,k)\) and \(I_s(i,j,k)\) are the intensity value of cover and stego image, respectively, at coordinates (ij) and channel k. The difference in pixel values at the same coordinates and channels generates the error value. If there are more variations in the pixel values between the two images, PSNR will produce a smaller value, but if there are more differences in the pixel values, PSNR will produce a higher value. Q-Index, the universal image quality index, is used to judge distortion caused relative to three combination factors: loss of luminance distortion, contrast distortion and correlation.

$$\begin{aligned} \mathrm{{MSE}}= & {} \frac{1}{M \times N \times C}\sum _{i=1}^{M}\sum _{j=1}^{N}\sum _{k=1}^{C}(I_c(i,j,k) - I_s(i,j,k))^2\nonumber \\ \end{aligned}$$
$$\begin{aligned} PSNR= & {} 10log_{10}\left( \frac{MAX^{2}}{MSE}\right) \end{aligned}$$

To measure the quality and payload of the stego image, a precise analysis has been conducted on three different sizes of the cover image: (\(64 \times 64\)), (\(128 \times 128\)) and (\(512 \times 512\)). The results obtained are revealed in Tables 34 and 5. On observation, it can be stated that the PSNR value lies between 64 dB and 68 dB and Q-Index maintains a consistent quality of 0.9999. This acknowledges the high quality of the stego image obtained after data hiding. The average PSNR of the stego image acquired is 66 dB.

Table 3 Capacity, PSNR, Q-index and payload values of \((64 \times 64)\) stego images
Table 4 Capacity, PSNR, Q-Index and Payload values of \((128 \times 128)\) stego images
Table 5 Capacity, PSNR, Q-Index and Payload values of \((512 \times 512)\) stego images

Also, Tables 34 and 5 show the capability and payload achieved in each of the three cases described. The number of positions where secret data can be embedded is referred to as capacity. In the proposed scheme, S blocks store 1-bit data, M blocks store 2-bit data and W blocks store 3-bit data in the appropriate channels. So, the embedding capacity can be calculated by Eq. (13). Similarly, the payload is referred to as bits per pixel (bpp), i.e., a number of secret bits embedded per pixel. For a designed data hiding scheme, Eq. (14) measures the payload of an image. The highest embedding capacity of 31858 is obtained for ucid00022 image of size (\(512 \times 512\)) against PSNR 65.09 dB. The proposed scheme delivers a maximum payload of 0.05 bpp and a minimum of 0.02 bpp. On average, the payload reached is 0.03 bpp for the developed technique. The payload varies from image to image, mainly due to the generation of different numbers of S, M and W blocks.

$$\begin{aligned} Capacity= & {} \left( \sum S \times 1 \right) + \left( \sum M \times 2 \right) + \left( \sum W \times 3 \right) \nonumber \\ \end{aligned}$$
$$\begin{aligned} Payload= & {} \frac{Capacity}{M \times N \times C} \; bpp \end{aligned}$$
Fig. 11
figure 11

Performance of image databases in terms of PSNR and Payload for different image sizes

Table 6 Comparison of PSNR values with state-of-art schemes for the stego images
Fig. 12
figure 12

Graphical comparison of PSNR between existing schemes and the proposed scheme

A graphical representation of the performance of the studied image databases is depicted in Fig. 11. The graph presents the average PSNR collected by the four image databases for the average payload achieved on a considered set of images. It can be observed that none of the databases shows any unexpected behavior during data hiding. With an increase in payload, the PSNR has decreased relatively less, which admits the significance of the proposed scheme. The UCID and USC-SIPI image databases have considerably produced a high payload compared to other databases.

Further, a comparison is drawn in Table 6 for PSNR and payload with state-of-the-art techniques present in the literature. This comparison is done only for the common color images of “Aeroplane,” “Baboon,” “Boat” and “Peepers” matched with the mentioned recent schemes and follows LSB techniques for data embedding. A comparative study suggests that in terms of PSNR, the proposed scheme has gained high performance; however, the payload remains a concern. Additionally, a graphical comparison is presented in Fig. 12 to show the PSNR achieved by each state-of-the-art scheme for the compared images. It can be clearly noticed that none of the schemes provided many variations in PSNR with changes in images.

Table 7 SSIM, NCC and BER of \((512 \times 512)\) stego images under different databases
Table 8 Comparison of SSIM values with state-of-art schemes for the stego images

As suggested by Setiadi (2020) that SSIM is a better measure of imperceptibility in all aspects, Table 7 presents the values obtained for SSIM, NCC and BER for the stego images of size (\(512 \times 512\)) under considered image databases. SSIM is another tool to assess the imperceptibility of the image. The calculation of SSIM considers three main factors, specifically luminance, contrast and structure of the image. The range of SSIM lies between \(-1\) and \(+1\). SSIM value close to 1 implies a high similarity of the stego image with the compared image in all three dimensions. NCC and BER point to the correlation and error in terms of actual change in bits in the stego image, respectively, compared to the cover image. For the Table 7, it is evident that average SSIM value obtained is 0.9999. This relates to the high imperceptibility maintained by the designed scheme even after a significant embedding of secret bits. It can also be verified with the NCC value of 0.9999 gained throughout the experiment. The BER achieved is between 0.00044 and 0.00083, which is quite appreciable compared to the number of bits embedded in the stego image. A comparison of SSIM values obtained from the proposed scheme with existing techniques is provided in Table 8. The proposed scheme has demonstrated better imperceptibility than all the compared schemes.

5.2 Robustness analysis

It is implicit that data communication media undergo some illegal alterations by unauthorized users, either intentionally or unintentionally. So, it becomes imperative for a data hiding scheme to tolerate such image processing attacks for security. The designed scheme has been tested with nine different distortions comprising seven unique attacks to test robustness and security. Performance of the stego image on the application of various attacks is shown in Fig. 13. The figure displays CI, STI, ESI, RSI, RCI, and comparison metrics PSNR, NCC and BER. It is apparent from the figure that the designed scheme has resisted attacks such as Salt & Peeper, constant average, copy-move forgery, cropping, contrast and opaqueness significantly. However, the designed scheme has some limitations for the rotation attack. The highest and lowest NCC values observed between SI and RSI are 0.9815 and 0.9049. The secret image was extracted from the tampered stego image with acceptable NCC and BER values. Moreover, it is also evident that the original cover image was recovered in all the cases.

Analyzing further, Table 9 provides a comparison of CI and RCI in terms of standard deviation (SD), correlation and SSIM values under different possible attacking conditions. It is observed from the table that at a high rate of tamper, the difference in SD is high as well, which is expected due to variations in the average pixel value of the image. Moreover, the correlation and SSIM of the recovered cover image compared to the original cover image points to the fact that values are inversely proportional to the amount of distortion. The average correlation and SSIM obtained for the considered attacks are 0.8431 and 0.7454, respectively. These results uphold the effectiveness of the proposed scheme.

5.3 Self-recovery evaluation of secret image

At the time of embedding, copies of secret bits were embedded to counter the problem of tampering coincidence, so that secret bits are recovered properly after image processing attacks. During extraction, the secret image constructed with vector \(O_1\) is ESI. However, post-processing is done with vectors \(O_1\) and \(O_2\) to recover a secret image (RSI) with greater visual quality and structure. Table 10 shows the enhancement achieved by RSI in terms of PSNR and SSIM. After post-processing, the recovered secret image has average visual quality of PSNR 2.40 dB higher than the extracted secret image. Furthermore, there is an approximately \(17\%\) increase in SSIM compared to earlier extracted secret images (ESI).

Fig. 13
figure 13

Effects of proposed scheme under different attacks

Table 9 Comparison of cover image and recovered cover image under different attacking environment
Table 10 Recovery evaluation of secret image in terms of PSNR and SSIM

5.4 Steganalysis

Steganalysis is the method of detecting the presence of a hidden message in a suspected image. Steganalysis is less concerned with the existence of the covert message than with the traces left behind by data embedding. As a result, it is difficult to devise a data hiding scheme that is both imperceptible and resistant to these attacks. A steganalyst can perform this identification in various ways, but visual and statistical attacks are the most common. The efficacy of the built scheme is demonstrated in this paper using histogram attacks and RS analysis.

5.4.1 Histogram attack

To analyze the frequency distribution of the cover and stego “Baboon” picture, histogram attacks were chosen as one of the statistical attacks. Figure 14 depicts the frequency distribution of red, green and blue channels present in colored cover and stego image. It is clear from the comparison that the difference in the histograms of the two images is negligible. The consistency maintained for the amount of distortion induced by the embedding algorithm is evident. The obtained histograms do not display any sharp rise or variations that could reveal information on data hiding.

5.4.2 RS analysis

Fridrich et al. (2001) developed the RS steganalysis method used in this paper. This approach is highly effective against most forms of LSB steganography and it takes advantage of the fact that, contrary to common opinion, the bit planes of an image produced using LSB steganography methods are highly correlated. A discrimination function is applied to determine the noisiness of a group of pixels. Regular (R) and singular (S) are the groups where noise levels rise and fall, respectively. The flipping functions are M and -M. The theory is that regardless of which flipping function is used, the number of R and S groups in a standard image would be the same. The RS value is derived using Eq. (15).

$$\begin{aligned} \frac{(|R_M - R_{-M}| + |S_M - S_{-M}|)}{(R_M + S_M)} \end{aligned}$$
Fig. 14
figure 14

Histogram analysis of color Cover and Stego image

Table 11 Recovery evaluation of secret image in terms of PSNR and SSIM

The experimental value obtained after RS steganalysis on four USC-SIPI stego images is provided in Table 11. From the data, it is ascertained that \(R_M \cong R_{-M}\) and \(S_M \cong S_{-M}\). The RS value for all the images is nearly equal to zero. This implies that the difference in a group of pixels is significantly less even after data embedding, which is imperative for a data hiding scheme with high security.

5.5 Comparison with Ashraf et al. (2020)

Compared to the technique demonstrated by Ashraf et al. (2020) using interval Type-2 Fuzzy and LSB substitution, the proposed scheme built using Type-1 Fuzzy and LSB substitution performed well in terms of visual quality and SSIM. The average visual quality achieved for the proposed scheme is 66.57 dB which is 14.99 dB higher than Ashraf et al. (2020). Furthermore, the SSIM procured for all the images is better than the compared scheme. But, the payload is limited to 0.03 bpp, which is relatively less than the embedding capacity of Ashraf et al. (2020). The developed scheme could resist non-geometrical attacks in addition to the ability to recover the confidential data even after tampering, which is not evident in the compared scheme. Due to the use of type-I fuzzy for proximity calculation, the proposed technique’s time complexity is less and simpler.

6 Computational complexity

The computational complexity of the described protocol is \({\mathcal {O}}(b^2MN)\). According to Algorithm 1, it has three main subsections: line no. 3–6, line no. 7–16 and line no. 17–19. The first subsection has the time complexity of \({\mathcal {O}}(3)\), while the next subsection has the complexity of \({\mathcal {O}}(z \times b \times b \times b \times b)\). Finally, the time complexity of the last section is denoted by \({\mathcal {O}}(z)\). So, the computation time

$$\begin{aligned} T(M,N)&= {\mathcal {O}}(z) + {\mathcal {O}}(z \times b \times b \times b \times b) + {\mathcal {O}}(z) \\&= {\mathcal {O}}(z \times b^4) \\&= {\mathcal {O}}\left( \frac{M \times N}{b^2} \times b^4 \right) , \text {since, }z = \frac{M \times N}{b \times b} \\&= {\mathcal {O}}(b^2MN) \end{aligned}$$

7 Conclusion

This paper proposes a robust scheme for data hiding by incorporating fuzzy logic and interval threshold. The designed scheme starts with block segregation followed by proximity calculation using Mamdani rule-based fuzzy logic. Based on block proximity and interval threshold, a block is graded strong, moderate or weak where secret data are hidden. A secret bit is replicated at two random blocks and channels generated through a shared secret key to recover the secret data with high visual quality. To show the efficacy of the proposed scheme, various experiments, analyses and comparisons are made. The perceptual transparency and visual quality of the stego image were measured by PSNR, Q-Index and SSIM. Experimental results have justified that the designed scheme maintained high PSNR, SSIM and Q-Index. On average, the proposed scheme exhibited PSNR of 66.95 dB, payload 0.03 and SSIM 0.9999. The suggested scheme could also resist different image processing attacks, with a significant amount of recovery of the secret images. As the payload capacity of the proposed technique is relatively low, the future study will focus on increasing the embedding capacity and resilience to various geometrical attacks. Few shortcomings that exist in terms of the visual quality of the recovered secret image shall also be looked upon to overcome.