The planar oxygen isotope effect coefficient measured as a function of hole doping in the Pr- and La-doped YBa2Cu3O7 (YBCO) and the Ni-doped La1.85Sr0.15CuO4 (LSCO) superconductors quantitatively and qualitatively follows the form originally proposed by Kresin and Wolf [Phys. Rev.B 49, 3652 (1994)], which was derived for polarons perpendicular to the superconducting planes. Interestingly, the inverse oxygen isotope effect coefficient at the pseudogap temperature also obeys the same formula. These findings allow the conclusion that the superconductivity in YBCO and LSCO results from polarons or rather bipolarons in the CuO2 plane. The original formula, proposed for the perpendicular direction only, is obviously more generally valid and accounts for the superconductivity in the CuO2 plane