Experiments with parfocal motorized zoom lens

0 Comments

Motorized zoom camera C1_PRO_X18 has two independent stepper motors for Zoom and Focus control. More specifications can be found in the documentation area. By design, this varifocal lens means the focus will be lost after the magnification motor is moved. However, the lens has linear rail reference points and it is possible to calibrate the lens so it will behave like much more expensive models.

Parfocal is a type of lens that stays in focus when magnification is changed [wiki]

Calibration

It would be better to automate the calibration process, but for simplicity, clarity and to avoid possible mistakes let’s do it the manual way.

Get a software package to control lens optical trail from Github, open any program to preview live camera view, and capture 10-20 points across full zoom range where sharpness is the best.

Save key points to txt file and import to favorite graphing software (Libre Office works just fine) to verify smooth graphs.

The graph above shows a few calibration curves at different distances, but for this experiment, we need only one. At this point, Python code will handle motion respecting the calibration curve.

Motion script

Full code is uploaded to the Github repository. After accurate calibration sweep script should result in a smooth zoom transition from wide to narrow view angle without loosing sharp focus.

Issues and drawbacks

While this script adds professional lens features, it should be used as a starting point for developing application-specific code.

  • Probably the biggest limitation – calibration works only for a fixed distance.
  • Another drawback – lens will change optical train geometry along with ambient temperature, thus sharp focus will be lost.
  • The initial script version relies on accurate calibration by hand. For standalone operation, this should be automated by implementing a more reliable focus detection algorithm than Laplacian transformation.

Leave a reply

Your email address will not be published.