- #1

- 1,789

- 4

## Main Question or Discussion Point

Hi

For a control systems project this semester, my friends and I are working on a closed feedback image focusing system. Using a webcam, an image of a black and white checkerboard is acquired by a computer program. Then, the amount of defocus (blur) in the image is measured and quantified in terms of a scalar, which is sent (via a parallel port interface) to a stepper motor controller which actuates a stepper motor that rotates the focusing knob of the webcam thus changing the focal length until the image captured is properly focused.

So far, we have made the parallel port interface, the stepper motor controller and a fairly decent mounting arrangement. We have also theoretically analyzed the images captured by the camera. However, we are not able to get a very good estimator of the blur or defocus in the image.

The first approach we used was to convert all the images to grayscale and use a Sobel Edge detection filter on them. Then, we generate a scalar [itex]x_{i}[/itex] for each image [itex]i = 1,\ldots,n[/itex], given by

[tex]x_{i} = \sum_{j = 1}^{j_{max}}|E_{ij}|^2[/tex]

where [itex]E_{ij}[/itex] is the vector of edges of image [itex]i[/itex] returned by the edge detector (in MATLAB).

We assume that the scalar is a good estimator of the sharpness of the image. If the scalar has a large value, then possibly the blur is low and vice versa.

This approach worked for a bunch of images, and we were able to plot the values to confirm that the scalar attained its maximum for the best focused image. But for another bunch of images, the scalar peaked at an image that was clearly not the best focused image.

The other approach we thought of was to inject Gaussian Blur into the images and then do a correlation analysis of the images to determine what values of mean and variance for the Gaussian estimate the "actual" blur nicely. Then we would generate a scalar based on these parameters to actuate the motor suitably.

While our hardware work is mostly completed, we're struggling to come up with a simple solution to the algorithm. Any suggestions and advice would be greatly appreciated! We have less than a week for our presentation :-(

Thanks in advance!

For a control systems project this semester, my friends and I are working on a closed feedback image focusing system. Using a webcam, an image of a black and white checkerboard is acquired by a computer program. Then, the amount of defocus (blur) in the image is measured and quantified in terms of a scalar, which is sent (via a parallel port interface) to a stepper motor controller which actuates a stepper motor that rotates the focusing knob of the webcam thus changing the focal length until the image captured is properly focused.

So far, we have made the parallel port interface, the stepper motor controller and a fairly decent mounting arrangement. We have also theoretically analyzed the images captured by the camera. However, we are not able to get a very good estimator of the blur or defocus in the image.

The first approach we used was to convert all the images to grayscale and use a Sobel Edge detection filter on them. Then, we generate a scalar [itex]x_{i}[/itex] for each image [itex]i = 1,\ldots,n[/itex], given by

[tex]x_{i} = \sum_{j = 1}^{j_{max}}|E_{ij}|^2[/tex]

where [itex]E_{ij}[/itex] is the vector of edges of image [itex]i[/itex] returned by the edge detector (in MATLAB).

We assume that the scalar is a good estimator of the sharpness of the image. If the scalar has a large value, then possibly the blur is low and vice versa.

This approach worked for a bunch of images, and we were able to plot the values to confirm that the scalar attained its maximum for the best focused image. But for another bunch of images, the scalar peaked at an image that was clearly not the best focused image.

The other approach we thought of was to inject Gaussian Blur into the images and then do a correlation analysis of the images to determine what values of mean and variance for the Gaussian estimate the "actual" blur nicely. Then we would generate a scalar based on these parameters to actuate the motor suitably.

While our hardware work is mostly completed, we're struggling to come up with a simple solution to the algorithm. Any suggestions and advice would be greatly appreciated! We have less than a week for our presentation :-(

Thanks in advance!

Last edited: