The refractive index \( \mu \) is given by:
\[
\mu = \frac{\text{Real Depth}}{\text{Apparent Depth}}.
\]
Let the real depth of the bubble be \( x \, \text{cm} \). When viewed from one side, the apparent depth is \( 12 \, \text{cm} \), and when viewed from the opposite side, the apparent depth is \( 24 - x \, \text{cm} \).
From the refractive index formula:
\[
\mu = \frac{x}{12} \quad \text{(from one side)},
\]
\[
\mu = \frac{24 - x}{4} \quad \text{(from the opposite side)}.
\]
Equate the two expressions for \( \mu \):
\[
\frac{x}{12} = \frac{24 - x}{4}.
\]
Simplify:
\[
4x = 12(24 - x).
\]
\[
4x = 288 - 12x.
\]
\[
16x = 288 \quad \implies \quad x = 18 \, \text{cm}.
\]
Substitute \( x = 18 \, \text{cm} \) into \( \mu = \frac{x}{12} \):
\[
\mu = \frac{18}{12} = \frac{3}{2}.
\]
\[
\boxed{\frac{3}{2}}
\]