Autofocus for a Digtal Camera Using Spectrum Analysis

Autofocus for a Digtal Camera Using Spectrum Analysis

AUTOFOCUS FOR A DIGTAL CAMERA USING SPECTRUM ANALYSIS By AHMED FAIZ ELAMIN MOHAMMED INDEX NO. 084012 Supervisor Dr. Abdelrahman Ali Karrar THESIS SUBMITTED TO UNIVERSITY OF KHARTOUM IN PARTIAL FULFILMENT FOR THE DEGREE OF B.Sc. (HON) IN ELECTRICAL AND ELECTRONICS ENGINEERING (CONTROL ENGINEERING) FACULTY OF ENGINEERING DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING JULY 2013 DICLARATION OF ORIGINALITY I declare that this report entitled “AUTOFOCUS FOR A DIGTAL CAMERA USING SPECTRU ANALYSIS “is my own work except as cited in the references. The report has not been accepted for any degree and is not being submitted concurrently in Candidature for any degree or other award. Signature: _________________________ Name: _________________________ Date: _________________________ I DEDICATION To my Mother To my Father To all my great Family II ACKNOWLEDGEMENT Thanks first and foremost to God Almighty who guided me in my career to seek knowledge. I am heartily thankful to my parents who helped me, encouraged me, always going to support me and stand close to me at all times. All thanks and appreciation and respect to my supervisor Dr. Abd- Elrahman Karrar for his great supervisory, and his continued support and encouragement. Many thanks to my colleague Mazin Abdelbadia for his continued diligence and patience to complete this project successfully. Finally, all thanks to those who accompanied me and helped me during my career to seek knowledge. III ABSTRACT The purpose of a camera system is to provide the observer with image information. A defocused image contains less information than a focused one. Therefore, focusing is a central problem in such a system. When the scene changes a lot it is desirable to perform focusing automatically to liberate the operator from this duty. In this thesis I present new method or new technique to obtain an autofocus system. This method is a passive method. It’s based on analyzing a captured image by the camera using frequency domain analysis. The analysis based on taking the Discrete Cosine Transform (DCT) for the image to calculate the energy. This energy is a direct indication to the focus degree or the sharpness for that image. After calculating the energy, it sent to the controller using serial protocol. The controller drives a stepper motor which adjusts the camera lens according to the energy value. The project goals have been met successfully and the auto focusing system was designed and implemented using spectrum analysis. IV المستخلص الغرض من نظام الكامٌرا هو توفٌر اكبر قدر من العلومات عن الصورة للمصور.الصورة الغٌر مركزة تحتوي على معلومات أقل من الصورة المركزة . لذلك، التركز هو المشكلة المركزٌة فً مثل هذا النظام .عندما ٌتغٌر المشهد أكثر من المرغوب فٌه من اﻷحرى أداء التركٌز تلقائٌا لتحرٌر المصور من هذا الواجب. فً هذه اﻷطروحة أقدم طرٌقة جدٌدة أو أسلوب جدٌد للحصول على نظام ضبط تلقائً للصورة .وٌعتبر هذا اﻷسلوب وسٌلة سلبٌة النوع. اﻷسلوب ٌعتمد على تحلٌل الصور الملتقطة بواسطة الكامٌرا باستخدام تحلٌل مجال التردد.ٌستند التحلٌل على أخذ تحوٌل جٌب التمام المنفصل للصورة لحساب الطاقة .هذه الطاقة هً إشارة مباشرة إلى درجة التركٌز أو الحدة لتلك الصورة .بعد احتساب الطاقة , ترسل إلى وحدة التحكم باستخدام بروتوكول تسلسلً .وحدة التحكم تحرك محرك السائر الذي ٌضبط عدسة الكامٌرا وفقا لقٌمة الطاقة. وقد تم تحقٌق أهداف المشروع بنجاح وتم تصمٌم نظام التركٌز التلقائً وتنفٌذها باستخدام تحلٌل الطٌف. V TABLES OF CONTENTS DICLARATION OF ORIGINALITY ____________________________________________ I DEDICATION_____________________________________________________________ II ACKNOWLEDGEMENT_____________________________________________________ III ABSTRACT _______________________________________________________________ IV V _____________________________________________________________________المستخلص TABLES OF CONTENTS ____________________________________________________ VI LIST OF FIGURES ________________________________________________________ IX LIST OF TABLES ___________________________________________________________ X LIST OF ABBREVIATIONS __________________________________________________ XI 1 Introduction _______________________________________________________________ 1 1.1 Introduction _____________________________________________________________ 1 1.2 Project Background _______________________________________________________ 1 1.3 Problem statement ________________________________________________________ 2 1.4 Motivation ______________________________________________________________ 2 1.5 Objectives ______________________________________________________________ 2 1.6 Thesis layout ____________________________________________________________ 3 2 LITERATURE REVIEW _____________________________________________________ 4 2.1 Introduction ______________________________________________________________ 4 2.2 Methods of focusing________________________________________________________ 4 2.2.1 Manual focus__________________________________________________________ 5 2.2.2Automatic focus (Autofocus) ______________________________________________5 2.2.2.1 Active AF___________________________________________________ 5 2.2.2.2Passive AF_________________________________________________________7 2.3 Digital Images_____________________________________________________________________8 2.3.1Types of Digital Images:____________________________________________________9 2.3.1.1 Black and White Images:______________________________________________9 2.3.1.2 Color Images:_______________________________________________________9 2.3.2 Color Terminology:______________________________________________________10 2.3.3 JPEG__________________________________________________________________10 VI 2.4 Image Frequency analysis______________________________________________________11 2.4.1DFT__________________________________________________________________12 2.4.2 DFT in image processing________________________________________________12 2.5 The Discrete Cosine Transform__________________________________________________13 2.5.1 The One-Dimensional DCT________________________________________________ 14 2.5. 2 The Two-Dimensional DCT________________________________________________15 2.6 Focusing Energy of an image:__________________________________________________ 15 3 METHODOLOGY_________________________________________________________16 3.1 Introduction:_________________________________________________________________16 3.2 image processing system:_______________________________________________________16 3.2.1 Get snap shot:____________________________________________________________16 3.2.2 Frequency analysis (The DCT):_______________________________________________16 3.2.3 Energy calculation: _______________________________________________________17 3.2.4 Sending the energy: ______________________________________________________17 3.3 The controller:_______________________________________________________________17 3.3.1 Serial Interface:_________________________________________________________ 17 3.3.2 Motor Driver ___________________________________________________________18 3.3.2.1 A very basic stepper motor_____________________________________________19 3.3.2.2 Bipolar stepper motor_________________________________________________20 3.3.2.3 Step Modes_________________________________________________________ 20 3.3.2.4 Driver Technology Overview____________________________________________21 3.4 Overall system flow chart:_____________________________________________________ 23 4 IMPLEMENTATION & RESULTS___________________________________________24 4.1 Introduction _____________________________________________________________ 24 4.2 System implementation ____________________________________________________24 4.2.1 Hardware components __________________________________________________24 4.2.1.1 The Atmega32 Microcontroller_________________________________________ 24 4.2.1.2 Stepper motor______________________________________________________25 VII 4.2.1.3 Power Mosfets_______________________________________________________25 4.2.1.4 Serial interface ______________________________________________________26 4.2.1.5 MAX232 ___________________________________________________________ 26 4.2.1.6 Web Cam ___________________________________________________________27 4.2.1.7The overall hardware circuit_____________________________________________27 4.2.2 Software components _______________________________________________________28 4.2.2.1 MATLAB_____________________________________________________________ 28 4.2.2.2 Codevision AVR________________________________________________________28 4.2.2.3 Proteus______________________________________________________________28 4.2.2.4 Virtual serial port emulator______________________________________________ 29 4.2.2.5 Hyper terminal _______________________________________________________30 4.3 The results____________________________________________________________________31 4.3.1 Frequency analysis results ___________________________________________31 4.3.2 Brightness effects__________________________________________________32 4.3.3 Monochromatic image______________________________________________ 34 4.3.4 Energy calculation results____________________________________________34 4.3.5 Final result of the project____________________________________________37 4.4 Discusion______________________________________________________________38 4.4.1 Energy calculation error______________________________________________39 4.4.2 Mechanical Issue____________________________________________________40 5 CONCLUSION AND FUTURE WORK_______________________________________41

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    61 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us