revised chapter 2 based on Oscar's feedback-ongoing
code for applying rectification on images