Design of an image acquisition system for the detection of occlusal dental problems

52 1 0
Design of an image acquisition system for the detection of occlusal dental problems

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

TABLE OF CONTENTS Cover i Mission ii Schedule iii Guarantee v Acknowledgments vi Table of contents vii List of figures ix List of tables x Abstract xi CHAPTER INTRODUCTION 1.1 Problem Statement 1.2 Objectives 1.3 Research Content .2 1.4 Limitations .2 1.5 Thesis Report Outline CHAPTER MATERIALS AND METHODS .4 2.1 Overview of Human Teeth 2.2 Dental Anatomy .5 2.3 Dental Problems 2.4 Radiographic Views 2.5 Near-Infrared Laser and Tooth Enamel 2.6 Image Processing Methods 11 2.6.1 Histogram Equalization 11 2.6.2 Otsu’s Method 12 2.7 Hardware .15 2.7.1 Infrared Camera 15 2.7.2 Infrared Light 16 2.7.3 Microcontroller 17 2.7.4 Power Supply 18 2.8 Software 21 CHAPTER DESIGN AND CALCULATION 22 vii 3.1 Calculation of The Image Acquisition System 22 3.1.1 Block Diagram of An Acquisitive Device 22 3.1.2 The 5-Volt Power Supply 22 3.1.3 Case Designs for The Image Acquisition System 24 3.2 Devices Connection .26 CHAPTER ASSEMBLY OF THE IMAGE ACQUISITION SYSTEM .27 4.1 Power Supply 27 4.1.1 Assembly of The Power Supply 28 4.1.2 Inspection of The Power Supply 28 4.2 Enclosure of The Image Acquisition System 29 4.3 Image Acquisition System Software .30 CHAPTER RESULTS AND DISCUSSION .32 5.1 Results 32 5.1.2 The Power Supply 32 5.1.3 Result Images Acquisition 34 5.2 Instruction 38 5.2.1 Setup Instruction 38 5.2.2 Operating Instruction 38 5.3 Discussions 39 5.3.1 Advantages 39 5.3.2 Disadvantages .39 CHAPTER CONCLUSIONS AND FUTURE WORK 40 6.1 Conclusions 40 6.2 Future Works 40 REFERENCES 41 APPENDIX 43 viii LIST OF FIGURES Figure The names of human teeth Figure 2 The anatomy of human tooth Figure The bitewing view Figure The full mouth view Figure The occlusal view Figure The periapical view Figure The attenuation coefficient of dental enamel (filled circles) water (open circles) versus wavelength 11 Figure Original Image 12 Figure The Image is processed with Histogram Equalization method 12 Figure 10 Camera(F) 5MP For Raspberry Pi with two infrared LEDs 15 Figure 11 The connection of camera and Raspberry 19 Figure 12 The circuit of a diode bridge .21 Figure 13 The output waveform of the diode bridge 21 Figure 14 The circuit of bridge rectification 21 Figure 15 The output of bridge rectification 21 Figure 16 The regulator circuit diagram .22 Figure 17 The power supply circuit diagram 22 Figure Block diagram of the system 22 Figure The power supply circuit diagram 24 Figure 3 The design of the raspberry case 25 Figure The front side (a) and backside (b) of the camera holder 25 Figure The probe of the image acquisition device 26 Figure Block diagram showing the connection of parts of the system .26 Figure The power supply 28 Figure The inspection of the output voltage .29 Figure The side view of the device 29 Figure 4 The top view of the device 30 Figure The position of NIR LEDs .30 Figure The flowchart of the image acquisition system .31 Figure Testing the Infrared LED 32 Figure Image of the tooth under visible light 34 Figure The images with two different NIR wavelengths 940nm and 850nm 35 ix LIST OF TABLES Table Infrared LEDs Comparison Table 16 Table The consumption power of the circuit 23 Table The Comparison of popular integrated circuit 23 Table Electronic component of the power supply board 27 Table The Output/Inputs voltage testing 33 Table The comments of the real tooth 36 Table The comments of the sample tooth 37 Table Accuracy of the system refers to a visual ability of normal human eyes 38 Table Comparison of Raspberry Camera 43 Table Infrared LEDs 44 Table The different between raspberry models 44 DEPARTMENT OF ELECTRONICS - BIOMEDICAL ENGINEERING x ABSTRACT The traditional methods of detection of the tooth caries such as radiographs are frequently ineffective in detecting initial lesions of the enamel Moreover, Patients usually reject x-rays for health reasons Therefore, we must find a safer resolution for this work In this project, we are going to fabricate a design of an image acquisition system for the detection of occlusal dental problems The goal of this project is to test the diagnostic advantage of a new device in combination with a prototype camera for detecting tooth caries in life images by using a laser source near-infrared (760 nm) The results show how the image acquisition system looks like and the output images of the image acquisition system The near-infrared device provides information about the exact location of the lesion, as well as indicating the severity of the lesion in enamel but cannot precisely determine the depth of the lesion in dentine Regarding future works, we want to improve some aspects of the project, such as the shape, the accuracy of output images, auto-detection ability DEPARTMENT OF ELECTRONICS - BIOMEDICAL ENGINEERING xi Chapter INTRODUCTION CHAPTER INTRODUCTION 1.1 PROBLEM STATEMENT It is believed that health plays an essential role in our life Nowadays, because of awareness of its value, many people can spend vast amounts of money on health care services The cardiovascular system, immune system, digestive system are concerned the most With scientific and technological advances, those things will be handled easier by doctors in the next decades During the past centuries, the concern of tooth’s health rockets rapidly There are many known problems with the human teeth that were explored by scientists Caries (also known as tooth decay) are a significant infectious disease process that causes ruin the structure of teeth The decayed area is known as cavities, which was made by the metabolism process of bacteria It damages a tooth’s enamel (the surface outside of teeth) In the first term of the process, we probably feel nothing but teeth’ condition will be getting worse day by day Without any treatment, patients will feel painful, hard to eat foods, or even it leads to death The past 60-year period witnessed many considerable improvements in dental hygiene They can be divided into two main types based on their purpose The first one is for teeth’s caring, with inventions of usage of fluoride in dentifrices and rinses The second one is inventions for tooth decay detection In this thesis, we strongly concentrate on detection methods which relate to our major the most There are many methods to detect cavities, such as the visual ability of trained doctors, usage of Xray (Tomography), and optical methods Visual ability based on a doctor is the most basic Method that just provides us a result for reference Tomography seems to be an efficient method with advances in modern technology But not many patients would like to utilize it because of the risks We all know the risks of X-ray to our body, especially to the head area; therefore, we tend to deny radiation treatments The last Method takes many advantages of the two above methods, so over the past thirty years, there has been an effort to develop optical methods for detection and imaging of dental decay It looks as if there are many benefits we can get from optical methods For those reasons, we want to fabricate an image acquisition system taking advantage of the optical method This thesis shows that NIR light at 760nm can be used to obtain photographs of early occlusal caries lesions, which make up the bulk of newly formed lesions Photos were obtained from extracted human molars and pre-molars, and we are going to test in varying tooth conditions DEPARTMENT OF ELECTRONICS - BIOMEDICAL ENGINEERING Chapter INTRODUCTION 1.2 OBJECTIVES In this project, our group focuses on the image of occlusal dental decay with nearinfrared (NIR) light We tend to configure Raspberry Pi as the microcontroller and acquire an image for a Raspberry camera Additionally, we will display results on a computer monitor via a Wi-Fi connection On top of that, we are going to design the practical model with a 3D printed technology 1.3 RESEARCH CONTENT - CONTENT 1: Study the information, literature related to the “Detecting Tooth Decay by Near-Infrared Laser and Camera Model.” - CONTENT 2: “Detecting Tooth Decay by Near-Infrared Laser and Camera Model” design solution - CONTENT 3: “Detecting Tooth Decay by Near-Infrared Laser and Camera Model” design - CONTENT 4: Design Image Processing Software - CONTENT 5: Choosing components - CONTENT 6: Result and evaluation 1.4 LIMITATIONS The limitations of this project contain: - Use Raspberry Pi Model B as a microcontroller - Use Camera (F) for Raspberry Pi to acquire images - Design a device’s model for educational purposes (with a 3D printer technology) The examination is better with tooth samples that were taken out of patients - Write a program in Python for basic processing of the results to clarify the dental decays - The system does not have a function that detects the tooth caries 1.5 THESIS REPORT OUTLINE ● Chapter 1: Introduction Show the necessity of the topic; some facts relate to the topic in reality and introduce the quick view of content ● Chapter 2: Materials and methods Present the theoretical basis of “Detecting Tooth Decay by Near-Infrared Laser and Camera Model” and the working principle of the model DEPARTMENT OF ELECTRONICS - BIOMEDICAL ENGINEERING Chapter INTRODUCTION ● Chapter 3: Design and calculation Based on the request of the topic, choose the components, and learn how to connect them, suggest the design method of the system ● Chapter 4: Assembly of the image acquisition system Show how we execute the system and apply the image processing method ● Chapter 5: Results and Discussion Summarize what we did and show the results ● Chapter 6: Conclusions and Future Work Show the conclusion about the things that we complete, not complete, and some drawbacks Present the plan of the topic in the future ● Chapter 7: Appendix Materials are related to the project DEPARTMENT OF ELECTRONICS - BIOMEDICAL ENGINEERING Chapter Materials and Methods CHAPTER MATERIALS AND METHODS In this chapter, we are going to show the basic knowledge of human anatomy teeth and introduce some dental issues such as plaque, tartar, and tooth decay After that, an impact of near-infrared laser on human teeth and how to detect caries with a nearinfrared laser will be revealed Electronic components are indispensable; thus, the next parts of this chapter introduce all components that were used in this project, such as Raspberry Pi, a camera, 2.1 OVERVIEW OF HUMAN TEETH Human teeth are one of the crucial parts of the digestive system The human teeth function is to mechanically break down items of food by cutting and crushing them in preparation for swallowing and digesting Human teeth contain four different types of teeth: incisors, canines, pre-molars, molars, which have specific functions and properties For instance, the incisors are cutting the food; the canines tear the food out while the molars and pre-molars crush the food The roots of teeth are embedded in the maxilla (upper jaw) or the mandible (lower jaw) and are covered by gums Teeth are made of multiple tissues of varying density and hardness [1] Figure 2.1 demonstrates the anatomy of the human tooth Figure The names of human teeth Incisors are the eight sharp teeth at the front of the mouth We often use them to bite into foods and cut them into smaller pieces to facilitate the process of digestion DEPARTMENT OF ELECTRONICS - BIOMEDICAL ENGINEERING Chapter Materials and Methods Incisors are flat with a thin edge They are also known as anterior teeth Both children and adults have eight incisors (four incisors for each jaw) [2] Canines are the sharp, peaked teeth, which are next to the incisors and look like fangs (the teeth of predators) They are also known as cuspids or eyeteeth Canines are the longest of all the teeth, and the primary purpose of them is tear-out Both children and adults have four canines (two canines at each jaw) The first permanent canines usually appear when children are between the ages of and 12 The lower canines tend to come through slightly before those in the upper jaw Pre-molars, or bicuspids, are bigger than the incisors and canines They have many ridges and help chew and grind up food Adults have eight premolars The first and second premolars are the molars that sit next to the canines Young children not have pre-molar teeth These first appear as permanent teeth when children are 10–12 years old [2] Molars are the biggest teeth of all the teeth They have a large, flat surface with ridges to chew food and grind it up As usual, adults have twelve permanent molars (six on each jaw), and children have eight primary molars [2] 2.2 DENTAL ANATOMY A human tooth contains enamel, dentin, cementum, and pulp tissue The portion of a tooth exposed to the oral cavity is known as the dental crown, and the portion below the dental crown is known as the tooth root The dental pulp cavity exists in the center of the tooth, through which the dental pulp, called the nerve To receive an impact on the tooth and to absorb and alleviate the force on the jaw, the surface of the tooth root area (cementum) and the alveolar bone are connected by a fibrous tissue called the periodontal ligament The tooth is supported by the tissue consisting of the alveolar bone, gums, and periodontal ligament [3] Figure 2.2 demonstrates the anatomy of the human tooth Tooth enamel is one of the four primary tissues that make up the teeth of humans and many other animals, including some species of fish It covers a crown, and it is a visible part of the tooth Tooth enamel is tough, white to off-white, highly mineralized substance that acts as a barrier to protect the tooth but can quickly become susceptible, especially by acids from food and drink [1] Dentin is a calcified tissue of the body It is usually covered by enamel on the crown and cementum on the root and surrounds the entire pulp By volume, 45% of dentin consists of the mineral hydroxyapatite, 33% is an organic material, and 22% is water [3] Dentin is softer than enamel Two principal characteristics distinguish dentin from enamel: dentin forms throughout life, and it is sensitive [1] DEPARTMENT OF ELECTRONICS - BIOMEDICAL ENGINEERING Chapter Results and discussion power supply can provide stable voltage and help components to operate stably at an ideal temperature (below 30 degrees C) The power supply has the ability to disconnect to power when a short-circuited phenomenon happens Table The Output/Inputs voltage testing Without load Order Input voltage Output voltage 9V 5.10V 9V 5.10V 9V 5.11V 9V 5.12V 9V 5.14V minutes after the power supply connected to loads (Include Raspberry, Camera, LEDs) Order Input voltage Output voltage 9V 5.04V 9V 5.04V 9V 5.05V 9V 5.05V 9V 5.04V DEPARTMENT OF ELECTRONICS - BIOMEDICAL ENGINEERING 33 Chapter Results and discussion 5.1.3 Result Images Acquisition a) Image of the tooth under visible light Before emitting the beam of NIR lights through the tooth, it was noticed that the teeth were opalescent, reflecting the normal light, and the deep marks on the teeth could not be witnessed by human eyes Figure 5.2 illustrates the images of the tooth sample before processing Figure Image of the tooth under visible light b) Results after processed In the research process, to choose the proper wavelength for IR LEDs, we experienced several difficulties Try and error is the Method that we must use to find the ultimate infrared LEDs wavelength Somehow, it costs significantly (time and money) Figure 5.3a) was captured in a condition: 940nm IR LEDs, low light The IR rays went through the tooth theoretically, but this image cannot be processed (Image processing algorithm cannot process this picture) Figure 5.3b) was captured in condition: 850nm IR LEDs, low light Tooth details were witnessed easily, but the tooth decays were not emphasized The reason could be the fact that high-power LEDs impact scattering of IR rays DEPARTMENT OF ELECTRONICS - BIOMEDICAL ENGINEERING 34 Chapter Results and discussion a) 940nm b) 850nm Figure The images with two different NIR wavelengths 940nm and 850nm Eventually, we decided to use 760 nm IR LEDs because it gives us better results that we are going to show in table 5.2 Several suspected caries extracted teeth were examined in the project To acquire the results that were shown in the table, an input image must follow seven steps: Step 1: Resize an input image to 180x180 Step 2: Get the red channel of the image Step 3: Use the Gaussian filter to reduce speckle noises and the median filter to reduce salt and pepper noise Step 4: Apply the Histogram Equalization method (mentioned in 2.6.1 section) to the image to adjust contrast Step 5: Find a threshold with Otsu’s Method The formula was mention in section 2.6.2 Step 6: Increase the contrast of the image with the 5.2 formula: 𝑔(𝑖, 𝑗) = 𝛼 𝑓 (𝑖, 𝑗) + 𝛽 (5.2) Where - i and j indicate that the pixel is located in the i-th row and j-th column - g(i,j) is a new value of a pixel - f(i,j) is a default value of a pixel The parameters α and β are sometimes referred to as the gain and bias parameters; these parameters are often said to control contrast and brightness, respectively If the parameter α is greater than zero, the contrast of the image is increased, vice versa Step 7: Use the threshold found with Otsu’s Method to mark the cavities Because pixel values of the cavity are very close to zero, we should subtract 60 from the threshold value to determine the exact decay traces, avoiding marking to the corners and edges of the teeth Pixels with a value lower than the threshold value will be assigned a value of 0; otherwise, the value will have remained the same DEPARTMENT OF ELECTRONICS - BIOMEDICAL ENGINEERING 35 Chapter Results and discussion All those teeth are molar or pre-molar teeth The pictures were taken from the crown areas For each specific case, we will put our comments to show our prediction and evaluation from the student’s perspective Table 5.2 showed the results of the real teeth in volunteer mouth; the results of the sample teeth are shown in table 5.3 Table The comments of the real tooth Order After processed Description No sign of dental decay There is a significant black point on the crown area A volunteer revealed that his tooth was filled No sign of dental decay DEPARTMENT OF ELECTRONICS - BIOMEDICAL ENGINEERING 36 Chapter Results and discussion Table The comments of the sample tooth Order After processed Description No abnormal sign, maybe it is a healthy tooth The lesion can be seen apparently We could not determine how deep it is The exact location of a suspected lesion is shown on the output data on the top view The exact location of fillings on the tooth shown on the output image DEPARTMENT OF ELECTRONICS - BIOMEDICAL ENGINEERING 37 Chapter Results and discussion Table Accuracy of the system refers to a visual ability of normal human eyes ACCURACY OF THE SYSTEM 16 15 14 14 12 10 10 3 Molar Pre-Model Visible Canine Healty System Decay detection of molar reaches 93.3% (14/15) Decay detection of pre-molar reaches 90% (9/10) 5.2 INSTRUCTION 5.2.1 Setup instruction Step 1: Plug the male jack in the power outlet, turn on the switch, press the small button on the supply to make the power supply active, the green light of the power supply lights up Step 2: Plugin Raspberry Pi Model B power USB and power jack Step 3: Wait for raspberry booting (roughly 10 to 20 seconds) Step 4: Display Raspberry screen You can display a raspberry screen in two different methods Step 4a.1: On our computer, use any kind of IP Scanner to find what your Raspberry’s IP is Step 4a.2: Use the RealVNC program to connect to Raspberry Pi Model B Step 4b Use an HDMI cable to connect Raspberry board to a TV/Monitor Step 5: Open Get_image.py on a desktop on Raspberry 5.2.2 Operating Instruction - After powering up the device, launch the device Use a small spoon to push out the cheekbones, making it easy to insert the device into the teeth DEPARTMENT OF ELECTRONICS - BIOMEDICAL ENGINEERING 38 Chapter Results and discussion - Put the device into the teeth so that the teeth are between the two lights; the device is facing up so that it is as perpendicular to the teeth as possible to obtain the best image - You can directly view the image via Raspberry or use the Space key to capture images Causing: The device operates stably at room temperature, avoiding use in hot environments 5.3 DISCUSSIONS 5.3.1 Advantages Overall, we have a significant improvement in the project model In the beginning, we just tended to experiment with the impact of IR on enamel, but we have made a usable device that can be put into a patient’s mouth The device can be moved easily in the mouth to capture the best results Additionally, we designed the probe that is separated from the Embedded computer; thus, users can take advantage of this design to hold the probe simply The scientific research, we got a basic concept of Infrared LED and how it influences enamel The different IR wavelengths influence enamel in different ways Although we not have a chance of using an IR LED with an ideal wavelength, which we found in theory, we still found a way to emphasize decay traces About image processing, we created a program removing some noise in a picture and clarify traces of dental problems Although it is not the best results that can be acquired, they are still better than a way we witness with human eyes 5.3.2 Disadvantages Instead of doing our best to accomplish the project, the project still has unexpected disadvantages The worst disadvantage of our project belongs to the image processing program In some cases, it cannot mark the dental problems properly About the power supply, the case of the power supply is quite big, and there is no cooling system for the power supply, which has to operate continuously DEPARTMENT OF ELECTRONICS - BIOMEDICAL ENGINEERING 39 Chapter Conclusions and future works CHAPTER CONCLUSIONS AND FUTURE WORK 6.1 CONCLUSIONS To sum up, this device was made for research purposes After completing this project, we have learned a tremendous amount of knowledge that contains: Infrared technology, 3D printing technology, designing a power supply, We knew the importance of experimentation in scientific fields, especially in our major (biomedical engineering) Although many disadvantages, our device still satisfies our beginning purpose: examine the influence of Infrared to enamel In the future, we hope that our device will have improvements to become a popular tool that everyone can use daily 6.2 FUTURE WORKS With the development of science and technology, non-invasive equipment has become increasingly essential In the future, we are eager to keep developing this project and hope that it can meet the medical standard The device should be made of high-quality plastic to reduce weight and not make patients allergic Additionally, we can design our device, which looks like a pen, and use a battery to power it Maybe, we can have the patient’s sympathy because of its appearance DEPARTMENT OF ELECTRONICS - BIOMEDICAL ENGINEERING 40 REFERENCES REFERENCES [1] “Human tooth”, https://en.wikipedia.org/, accessed on 26/02/2020 [2] “Teeth: Names, types, and functions”, https://medicalnewstoday.com/, accessed on 26/02/2020 [3] “The Roles and Structure of Teeth”, https://www.lions.co.jp, accessed on 26/02/2020 [4] “Tooth Plaque and Dental Tartar”, https://oralb.com, accessed on 26/02/2020 [5] SECTION ON ORAL, HEALTH; SECTION ON ORAL, HEALTH (December 2014), “Maintaining and improving the oral health of young children”, Pediatrics [6] Southam JC, Soames JV (1993), “2 Dental Caries”, Oral pathology (2nd ed.) Oxford: Oxford Univ [7] Smith B, Pickard HM, Kidd EA (1990), “1 Why restores teeth?”, Pickard's manual of operative dentistry (6th ed.), Oxford University Press [8] Daniel Fried, Richard E Glena, John D B Featherstone, and Wolf Seka, “Nature of light scattering in dental enamel and dentin at visible and nearinfrared wavelengths”, 1/3/1995, accessed on 27/02/2019 [9] Cynthia L Darling, Gigi D Huynh, Daniel Fried, “Light scattering properties of nature and artificially demineralized dental enamel at 1310 nm”, Journal of biomedical optic 11(3) (May/June 2006) [10] “Scattering”, https://en.wikipedia.org/, accessed on 03/03/2020 [11] Gail F Williamson, RDH, MS, “Intraoral Imaging: Basic Principles, Techniques and Error Correction”, https://dentalcare.com/, accessed on 03/03/2020 [12] “Xray”, https://www.facialart.com/, accessed on 03/03/2020 DEPARTMENT OF ELECTRONICS - BIOMEDICAL ENGINEERING 41 REFERENCES [13] Dr George Ghidrai, “THE DENTAL RADIOGRAPHY OR DENTAL XRAY”, https://infodentis.com, (May 2019), accessed on 03/03/2020 [14] “RPi Camera (F) Raspberry Pi Camera Module, Supports Night Vision”, https://www.waveshare.com/, accessed on 19/05/2020 [15] Prof Nguyễn Thanh Hải, Dr Trần Quốc Cường, “Giáo trình xử lý ảnh y sinh”, NXB Đại học Quốc gia TP Hồ Chí Minh, 2016 [16] Dr Andrew Greensted, “Otsu Thresholding”, http://www.labbookpages.co.uk, accessed on 20/07/2020 [17] “Arduino”, http://en.wikipedia.org, accessed on 19/05/2020 [18] “Raspberry Pi gì? Các dịng Raspberry Pi phổ biến”, http://bkaii.com.vn, accessed on 22/10/2019 [19] “RPi Camera (F), Supports Night Vision, Adjustable-Focus”, https://www.waveshare.com, accessed on 19/05/2020 [20] “Power management Integrated circuit”, http://en.wikipedia.org, accessed on 19/05/2020 [21] Sam Sattel, “How Power Supplies Work”, https://www.autodesk.com/, accessed on 31/07/2020 [22] “Transformer”, https://en.wikipedia.org/, accessed on 31/07/2020 [23] “Bridge Rectifier”, https://www.physics-and-radio-electronics.com/, accessed on 31/07/2020 [24] “Tkinter”, https://en.wikipedia.org, 27/9/2019, accessed on 18/07/2020 [25] “RealVNC- Product”, http://realvnc.com/, accessed on 19/07/2020 DEPARTMENT OF ELECTRONICS - BIOMEDICAL ENGINEERING 42 APPENDIX APPENDIX 7.1 CAMERA COMPARISON Table Comparison of Raspberry Camera Name Pixels Sensor Adjustable focus RPi Camera V2 Mega IMX219 RPi NoIR Camera V2 Mega IMX219 RPi NoIR Camera V2 Mega OV5647 RPi Camera (B) Mega OV5647 RPi Camera (D) Mega OV5647 RPi Camera (E) Mega OV5647 RPi Camera (F) Mega OV5647 √ RPi Camera (G) Mega OV5647 √ RPi IR-CUT Camera2 Mega OV5647 √ Infrared night vision √ √ √ √ √ DEPARTMENT OF ELECTRONICS - BIOMEDICAL ENGINEERING 43 APPENDIX RPi Zero V1.3 Mega Camera3 OV5647 7.2 INFRARED LEDs COMPARISON Table Infrared LEDs Name Picture Wavelength Price Infrared Led Light 5W 850nm 850nm 44.000 VNĐ Infrared 3mm LED 940nm 1.000 VNĐ Infrared highpower LED 740nm 30.000 VNĐ 7.3 RASPBERRY COMPARISON Table The different between raspberry models Raspberry Pi B Raspberry Pi B+ Raspberry Pi B Raspberry Pi Model A+ Raspberry Pi Zero 1.5 GHz 1.4 GHz 1.2 GHz 1.4 GHz GHz 4 Price CPU Clock No of Core DEPARTMENT OF ELECTRONICS - BIOMEDICAL ENGINEERING 44 APPENDIX GPU Video Core IV Video Core IV Video Core IV Video Core IV Video Core IV RAM 1GB , 2GB, 512MB 4GB DDR2 LPDDR4 1GB DDR2 512MB DDR2 512 MB Camera Yes Yes Yes Yes Yes GPIO Yes Yes Yes Yes Yes USB 2x USB3.0 + 2x USB2.0 4x USB2.0 4x USB2.0 + micro OTG 1xUSB 2.0 micro + micro OTG Power ratings 1.25A @5V 1.13A @5V 1.34A @5V 200mA 160mA 7.4 THE CODE OF MAIN PROGRAM ##import lib import cv2 import os #Get name name = input("Enter a sample name: ") # define the name of the directory to be deleted dir_path = "/home/pi/Desktop" path = dir_path+"/"+name print(path) ## create dir try: os.makedirs(path) except OSError: DEPARTMENT OF ELECTRONICS - BIOMEDICAL ENGINEERING 45 APPENDIX print ("Creation of the directory %s failed" % path) else: print ("Successfully created the directory %s" % path) ##take photos cam = cv2.VideoCapture(0) cam.set(cv2.CAP_PROP_FPS,15) print("Press spacebar to take photo!",) print("Press Esc to Escape") img_counter = while True: ret, frame = cam.read() out = frame[100:280,220:400] #Convert RGB to Gray out_gray = cv2.cvtColor(out, cv2.COLOR_BGR2GRAY) # Loc nhieu bang bo loc GaussianBlur out_blur = cv2.GaussianBlur(out_gray, (3, 3), 0) #Histogram Equalization hist = cv2.equalizeHist(out_blur) #Increase contrast and brightness alpha = 1.1 beta = 20 new_out = np.zeros(hist.shape, hist.dtype) for y in range(out.shape[0]): new_out[y] = np.clip(alpha*hist[y] + beta, 0, 255) # Binary ret1, thresh = cv2.threshold(hist,0,255,cv2.THRESH_BINARY+cv2.THRESH_OTSU) ret2,thre = cv2.threshold(new_out,ret1-60,255,cv2.THRESH_TOZERO) #Show Image DEPARTMENT OF ELECTRONICS - BIOMEDICAL ENGINEERING 46 APPENDIX cv2.imshow("Caries", thre) if not ret: break k = cv2.waitKey(1) if k == 27: # ESC pressed print("Escape hit, closing ") break elif k == 32: # SPACE pressed img_name = "{}_Original.png".format(img_counter) cv2.imwrite(path+"/"+img_name, out) img_name = "{}_Gray.png".format(img_counter) cv2.imwrite(path+"/"+img_name, out_gray) img_name = "{}_Caries.png".format(img_counter) cv2.imwrite(path+"/"+img_name, thre) print("Captured ",img_counter," Image(s)") img_counter += cam.release() cv2.destroyAllWindows() DEPARTMENT OF ELECTRONICS - BIOMEDICAL ENGINEERING 47 ... dimensions of the image - L = 2x, x is a bit of the image -

Ngày đăng: 01/11/2022, 12:49

Tài liệu cùng người dùng

Tài liệu liên quan