All-optical technique to measure the pyroelectric coefficient in electro-optic crystals