Yubo

From Psych 221 Image Systems Engineering
Revision as of 09:13, 13 December 2019 by imported>Student221
Jump to navigation Jump to search

Introduction

Autofocus is one of the three basic camera auto-algorithms enabled in most consumer photography cameras, with the other two being auto-exposure and auto-white balance. Out of the three, both autofocus and auto-exposure requires a feedback mechanism to adjust physical characteristics of the camera lens or sensors, respectively. In the case of autofocus, the software will evaluate whether or not the captured image is in focus, and will adjust the lens position for subsequent captures if it is not.


This project will focus specifically on simulating the VCM focuser. The VCM focuser implemented in this project utilizes exclusively contrast detection, and does not use phase detection. In a VCM focuser, the camera is attached in a VCM barrel with springs on one side of the barrel, and a magnet on the other. The magnet is controlled using an electric current. When the magnet is inactive, the springs will hold the lens at the rest position, which usually focuses at infinity. When the magnet is activated, depending on the current, will move the lens to specified positions within the barrel.


This project attempts to provide a virtual focuser implementation and a basic autofocus algorithm to evaluate. There are many different focuser types, many of which have been covered in the lectures. There are many benefits to creating a virtual focuser. First, it allows the tweaking of physical focuser characteristics, without having to rely on an abundance of physical focuser modules. Second, it abstracts away the reliance on hardware when evaluating autofocus algorithms. This enables camera software developers to perform system and regression tests on a cloud environment without having to set up a static and controlled scene.

Lecture 1 defines a scene to be in focus when it satisfies the lens maker equation (thin lens approximation):

When the object is out of focus, the 'blurriness' of the scene is affected by the aperture size. The area of the blur itself is known as the circle of confusion.

There are many ways to adjust focus. In lecture one, we discussed the light field camera. With this method, the camera is able to adjust focus after the image has taken, and thus does not require an autofocus algorithm to be run while we are taking the image. Lecture two covers two more techniques in adjusting focus by physically moving the lens towards and away from the sensors: VCM, and MEMs technology. The lectures also mention a method of autofocusing called Phase Detection. This project however, will be implementing another method of auto-focus called Contrast detection. The main difference is that phase detection utilizes the phase of incoming rays, whereas contrast detection only adjusts focus based on pixel sensor information.

A neat in-class demonstration was shown to demonstrate the idea of phase detection autofocus:

An image is generally more focused if it contains higher frequency components. As shown in lecture 1, this project will utilize the Discrete Fourier Transform of the image. We will implement an algorithm to weigh the DFT such that the final 'focus score' will be higher, if the image contains more higher frequency signals.

Definition of Terms

Here is a list of commonly used terminology in this project, and their meaning:

  • Convergence: The autofocus algorithm is said to be converged if it confidently believes the current image achieves a sufficiently high level of focus and detail, and the algorithm will exit with success.
  • Convergence point: Focuser position where the image is converged.
  • Convergence region: Smallest range that the autofocus algorithm can be confident the convergence point lies within.
  • Focuser Position: Abstract integer between 0-255 that represents the position of the lens in the focuser barrel. In contrast, lens position references the physical location of the lens in the focuser barrel.
  • Lens Position: The physical position of the lens in the focuser barrel. In constrast, focuser position is the abstract integer value of the lens position in the focuser barrel.

Architectural Design

This section describes the high level design of the project, why certain decisions are made, any assumptions, and literary sources used. The project will make use of a main program, and two modules: the focus simulator, and the autofocus algorithm.

At initialization, the focus simulator will accept the physical conditions of the scene and focuser. These include parameters such as distance of scene away from the camera, and camera properties such as aperture size and focal length. It will also accept a focuser position value between 0-255 (8 bit integer). This input value will be provided by the autofocus algorithm to adjust the lens position within the focuser barrel. This module will then output an image of what the captured image would look like at the lens position specified by the focuser position.

The autofocus algorithm will accept the output image from the focus simulator as an input. On the first capture. The module itself will output a state and a value between 0-255. The state determines if the algorithm considers the image in focus, and if it isn’t, the output value will determine where the next focuser position will be. The image is considered to be converged when it is sufficiently sharp and in focus on the target object. Similarly, the position of the lens in the focuser barrel that produces the converged image is called the convergence point.

See below for a diagram showing the relationships between the units:

File:ArchitecturalDiagram.png

Results

Future Improvements

References

Appendix A - Robustness Test Results