Ionization correction factors for planetary nebulae – I. Using optical spectra