Correction of magnetograms to estimate the magnetic field strength