Mean Square Error-Based Approach for the Detection of Focal Position of a Lens