1. Trang chủ
  2. » Giáo Dục - Đào Tạo

Design of a gel card reader for blood grouping tests

89 3 0

Đ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

Thông tin cơ bản

Định dạng
Số trang 89
Dung lượng 5,43 MB

Cấu trúc

  • ACKNOWLEDGMENTS

  • LIST OF FIGURES

  • LIST OF TABLES

  • ABSTRACT

  • Chapter 1. INTRODUCTION

    • 1.1. PROBLEM STATEMENT

    • 1.2. OBJECTIVE

    • 1.3. THESIS CONTENTS

    • 1.4. LIMITATIONS

  • Chapter 2. LITERATURE REVIEW

    • 2.1. TYPES OF HUMAN BLOOD

    • 2.2. GEL CARD METHOD AND TYPE OF GEL CARDS

    • 2.2.1 Gel Card method

    • 2.2.2 Type of Gel Cards

    • 2.3. IMAGE PROCESSING ALGORITHM.

    • 2.3.1 Dilation method

    • 2.3.2 Edge detection method

    • 2.4. IMAGE CAPTURING DEVICES

    • 2.4.1 Microprocessor introduction

    • 2.4.2 Description of power supply

  • Chapter 3. DESIGN AND CALCULATION

    • 3.1. INTRODUCTION

    • 3.2. CALCULATION AND DESIGN

    • 3.2.1 Block Diagram Of An Capturing Device

    • 3.2.2 Image Capturing Device

    • 3.2.3 Central Processing Unit

    • 3.2.4 Image Display and Peripherals

    • 3.2.5 Calculation of Power Supply

    • 3.2.6 Case designs for the Gel Card Reader

    • 3.3. DEVICE CONNECTION

    • 3.4. FLOWCHART AND PROGRAM ALGORITHM

    • 3.4.1 Functional summary of Gel Card Reader

    • 3.4.2 Flowchart

    • 3.4.3 A flowchart of agglutination level and blood type

    • 3.5. PRINCIPLE OF OPERATION

  • Chapter 4. CONNECTION OF SYSYTEM PARTS

    • 4.1. INTRODUCTION

    • 4.2. POWER SUPPLY

    • 4.2.1 Assembly of the Power Supply

    • 4.2.2 Execution of The Power Supply

    • 4.2.3 Inspection of The Power Supply

    • 4.3. EXECUTION THE CASE OF GEL CARD READER

    • 4.4. SYSTEM CONSTRUCTION

    • 4.4.1 User Interfere Design

    • 4.4.2 Model Construction

    • 4.5. PROGRAMMING SOFTWARE

    • 4.5.1 Python Programming Software

    • 4.5.2 Image processing program

    • 4.5.3 QT Designer

  • Chapter 5. RESULTS AND DISCUSSION

    • 5.1. GENERAL RESULTS

    • 5.2. ACHIEVEMENT RESULTS

    • 5.2.1 Power Supply

    • 5.2.2 GUI

    • 5.2.3 System modelling result

    • 5.2.4 Test results

    • 5.2.5 Result of Gel Card Reader

    • 5.2.6 Actual Results

    • 5.3. INSTRUCTION

    • 5.4. DISCUSSIONS

    • 5.4.1 Advantages

    • 5.4.2 Disadvantages

  • Chapter 6. FUTURE WORKS AND CONCLUSION

    • 6.1. CONCLUSION

    • 6.2. FUTURE WORKS

Nội dung

INTRODUCTION

PROBLEM STATEMENT

Health plays a vital role in our lives Now blood testing has become an important area, including biochemical testing, hematology, blood clotting, and blood grouping

The early detection of blood abnormalities has been crucial for prompt treatment Centuries ago, the challenges of blood transfusion led scientists to investigate incompatibilities In 1901, Austrian doctor Karl Landsteiner identified the first three human blood types: A, B, and O A year later, the fourth type, AB, was discovered by A Decastrello and A Sturli Over 40 years later, the Rh factor, a major cause of transfusion reactions, was uncovered by Landsteiner, Alex Wiener, Philip Levine, and R.E Stetson Together with the ABO blood type system, the Rh factor revolutionized blood banking.

In the past century, blood grouping tests primarily relied on two methods: testing on enamel slabs and in vitro, which, while simple and cost-effective, were prone to technical errors and administrative confusion based on user skill levels To address these issues, Dr Yves Lapierre introduced Gel technology in 1988, significantly improving the accuracy of blood grouping The Gel Card has since become the preferred method for blood grouping in hospitals, clinics, and laboratories, offering enhanced reliability over traditional techniques.

A Gel Card Reader was invented and used to determine the blood grouping Currently, hospitals in Vietnam and around the world are using this device However,

The current market price for a Gel Card Reader in Vietnam is around 5000 USD, prompting the need for a more affordable solution This led to the decision to develop a Gel Card Reader that can determine blood groups at a significantly lower cost, thereby enhancing medical testing capabilities The proposed Gel Card Reader utilizes a camera to capture images of the Gel Card containing treated blood, which are then sent to a central processing unit This unit employs a programmed image processing algorithm to analyze the Gel Card images and accurately determine the blood group results.

THESIS CONTENTS

- Complete the model and the thesis report

- Submit the final version of the thesis report and report the thesis

- Submit to the advisor for the last inspection

ADVISOR (Sign and write your full name) viii

This project, conducted under the guidance of Assoc Prof Dr NGUYEN THANH HAI, ensures that all research findings are original and authentically represent our work, with no replication from other sources.

Nguyễn Minh Đức Trương Hoàng Gia Bảo ix

We would like to express our heartfelt gratitude to Assoc Prof Dr Nguyen Thanh Hai for his invaluable support and guidance throughout our graduation project His dedication has significantly contributed to our success, as he not only imparted essential knowledge but also instilled in us a serious approach to scientific research, which is crucial for our future careers.

We extend our heartfelt gratitude to the teachers in the Department of Industrial Electronics - Biomedical Engineering for creating an optimal environment for our project completion We also thank all the lecturers who imparted foundational knowledge in previous semesters, enabling us to successfully execute our project Special thanks to Ms Huong, Head of the Laboratory Department at Thu Duc General Hospital, for providing Gel Card samples essential for our work We appreciate Nghia Tin Medical Equipment Co., Ltd for their support with equipment and ideas, as well as Mr Ngo Thien Ha, Deputy Director of Duong Phu Technology Co., Ltd, for offering facilities and equipment crucial for our implementation Lastly, we express our deep appreciation to our parents for their unwavering dedication in supporting our education, as our experiences have deepened our understanding of their sacrifices.

Finally, we would like to express our sincere thanks to the people who have contributed and helped the group to implement this project successfully

Ho Chi Minh City, January 20, 2021

Nguyễn Minh Đức Trương Hoàng Gia Bảo x

2.2 GEL CARD METHOD AND TYPE OF GEL CARDS 5

3.2.1 Block Diagram Of An Capturing Device 13

3.2.6 Case designs for the Gel Card Reader 25

3.4.1 Functional summary of Gel Card Reader 28

3.4.3 A flowchart of agglutination level and blood type 29

Chapter 4 CONNECTION OF SYSYTEM PARTS 37

4.2.1 Assembly of the Power Supply 37

4.2.2 Execution of The Power Supply 37

4.2.3 Inspection of The Power Supply 40

4.3 EXECUTION THE CASE OF GEL CARD READER 41

5.2.5 Result of Gel Card Reader 51

Chapter 6 FUTURE WORKS AND CONCLUSION 57

Figure 2 1 The ABO blood grouping system (Source: Wikipedia) 4

Figure 2 2 Gel Card and parts inside the Gel Card tube 5

Figure 2 4 Sample of Forward grouping Gel Card 7

Figure 2 5 Dilation in image processing (Source: www.cs.auckland.nz) 8

Figure 2 6 Raspberry Pi 4B (Source: www.deskmodder.de) 11

Figure 3 1 Block diagram of the system 13

Figure 3 3 Block diagram of the switching power supply 16

Figure 3 4 Schematic of noise filter and primary voltage rectifier circuit 20

Figure 3 5 Schematic of pulse generator circuit 22

Figure 3 6 Schematic of secondary voltage rectifier circuit 23

Figure 3 7 Schematic of secondary voltage feedback circuit 24

Figure 3 8 Schematic of switching power supply circuit 25

Figure 3 9 Frontside (a) and backside (b) of the base holder 26

Figure 3 10 The frontside (a) and backside (b) of the Gel Card Reader case 27

Figure 3 11 The connection of the entire project Interpret connection diagrams 27

Figure 3 12 Flowchart of Gel Card Reader system 29

Figure 3 13 A flowchart of agglutination level and blood type 30

Figure 3 14 Image area is cropped in Gel Card (red border) 31

Figure 3 15 The result after image cutting in Gel Card Reader 31

Figure 3 16 RGB to HSV diagram 32

Figure 3 17 Results after converted image from RGB to HSV 32

Figure 3 18 The selectable color threshold for filtering 32

Figure 3 19 Image after processed with threshold 33

Figure 3 20 Determine binary image area and draw contour .34

Figure 3 21 The value belong x and y axis of center point in binary image 34

Figure 3 22 Flowchart of blood type determination in Gel Card Reader 35

Figure 4 1 The top side (a) and bottom side (b) of PCB 39

Figure 4 2 The 5 Volt switching power supply 39 xi

Figure 4 3 The inspection output voltage of power supply board 40

Figure 4 4 Base holder (a) and case (b) of Gel Card Reader 41

Figure 4 5 Graphic User Interface of Gel Card Reader 42

Figure 4 6 PyCharm IDE for python programming 43

Figure 4 7 Gel Card GUI is built on QT Designer 45

Figure 5 1 Input, output jacks of the switching power supply .47

Figure 5 2 Measure output voltage when the load is connected .48

Figure 5 3 GUI of a Gel Card Reader 49

Figure 5 4 Gel Card Reader system 50

Figure 5 5 Sample is put into Gel Card Reader 51

Figure 5 7 Wrong Gel Card recognition 52

Figure 5 8 The result interpretation (Sample 1: O- ; Sample 2: B+) 53

Figure 5 9 The result interpretation (Sample 1: A+ ; Sample 2: B-) 53

Figure 5 10 DG Reader of GRIFOLS 54

Figure 5 11 Gel Card Reader and GRIFOLS’s DG Reader Comparison 55 xii

Table 2 1 Raspberry Pi all generations comparison .11

Table 3 1 The consumption power of the circuit 15

Table 3 2 Electronic component of the input filter and rectifier circuit 20

Table 3 3 Electronic component of pulse generating circuit 21

Table 3 4 Electronic component of secondary voltage rectifier circuit 23

Table 3 5 Electronic component of secondary voltage feedback circuits 24

Table 4 1 Electronic component of the switching power supply board 37

Table 5 1 Outputs/Inputs voltage of power supply testing 48

Table 5 2 The Accuracy and Efficiency of Gel Card Reader ……….…54 xiii

The "Design of a Gel Card Reader for Blood Grouping Tests" focuses on developing a system that accurately reads Gel Cards used in blood typing, identifies faulty cards, and manages patient information Utilizing the unique feature of agglutination in gel columns, the reader calculates blood group results with high precision The process begins with capturing the Gel Card image via a camera, followed by data transfer to a Raspberry Pi 4B for image processing and result computation Finally, the results are displayed on a user interface, and the system includes functionality to save these results for effective patient information management.

Health plays a vital role in our lives Now blood testing has become an important area, including biochemical testing, hematology, blood clotting, and blood grouping

The early detection of blood abnormalities is crucial for timely treatment Centuries ago, issues with blood transfusions led scientists to investigate the reasons behind incompatibilities In 1901, Austrian doctor Karl Landsteiner made a significant breakthrough by identifying the first three human blood types: A, B, and O The following year, the fourth blood type, AB, was discovered by A Decastrello and A Sturli Over 40 years later, the Rh factor, a major contributor to blood transfusion reactions, was identified by Landsteiner, Alex Wiener, Philip Levine, and R.E Stetson Together with the ABO blood type system, the Rh factor revolutionized blood banking.

In the last century, blood grouping tests primarily utilized two methods: testing on enamel slabs and in vitro techniques While these methods are simple, cost-effective, and easy to handle, they are prone to technical errors and administrative confusion, largely dependent on the user's skills To address these issues, Dr Yves Lapierre introduced Gel technology in 1988, significantly improving the accuracy of blood grouping The Gel Card has since become the preferred and most effective method for blood grouping in hospitals, clinics, and laboratories.

A Gel Card Reader was invented and used to determine the blood grouping Currently, hospitals in Vietnam and around the world are using this device However,

The Gel Card Reader currently available in Vietnam costs no less than $5,000, prompting the need for research and development of a more affordable alternative that retains the blood group determination function This initiative aims to significantly enhance medical testing capabilities As a result, the team has embarked on a graduation thesis titled “Design of a Gel Card Reader for Blood Grouping Tests.” This innovative Gel Card Reader utilizes a camera to capture images of the Gel Card containing processed blood samples The captured images are then transmitted to a central processing unit, where an image processing algorithm analyzes the data to accurately determine the blood group results.

This project focuses on developing a blood group classification system using Gel Card technology The system is built around a Raspberry Pi 4B, incorporating a camera and a display, along with advanced image processing algorithms to accurately read and classify blood types.

● CONTENT 1: Research on blood group system, Gel Card method

● CONTENT 2: Research the functions of Gel Card Reader

● CONTENT 3: Design flowchart, write the code for image processing

● CONTENT 4: Designing a power supply for Gel Card Reader

● CONTENT 5: Designing a case for Gel Card Reader

● CONTENT 6: Design a graphical user interface (GUI) for the system

● CONTENT 7: Execute the system, evaluate the results, compare with similar equipment, re-evaluate the advantages and disadvantages

LIMITATIONS

● No results will be saved in the event of a power failure

● Card Reader only reads with popular Cel Cards as Forward, Forward and Reverse, CrossMatch, Coombs

● The instrument does not recognize the type of Gel Cards through the barc 1.5 BRIEF SUMMARY OF THESIS

This chapter shows the Gel Card method's importance, point out the topic's limitations, goals, and make lists

This chapter describes the theoretical basis of “Design of a Gel Card Reader for blood grouping tests” and the model's working principle

This chapter presents to choose the components and learn how to connect them, and suggest the system's design method

 Chapter 4: Connection of system parts

This chapter shows how the system is executed and applied to the image processing method

This chapter discusses the results achieved after completing the system, commenting on the results achieved

 Chapter 6: Conclusion and future works

This chapter shows the conclusion about the things that we complete, not complete and some drawbacks Present the plan of the topic in the future.

BRIEF SUMMARY OF THESIS

In this chapter, an overview of theories related to the Gel Card Reader implementation is presented

Human blood consists of four primary components: red blood cells, white blood cells, plasma, and platelets The determination of blood type primarily relies on red blood cells, with the ABO blood type system being the most widely used classification This system categorizes blood into four types: A, B, AB, and O, facilitating the identification of individual blood types.

Blood types are determined by the presence or absence of specific antigens on red blood cells Individuals with A antigens are classified as blood type A, while those with B antigens are designated as blood type B If both A and B antigens are present, the blood type is identified as AB Conversely, a lack of A and B antigens results in blood type O Understanding these classifications is essential for blood transfusions and medical treatments.

Figure 2 1 The ABO blood grouping system (Source: Wikipedia)

The basic grouping system classifies blood into eight groups based on the Rhesus factor, commonly known as the 'Rh' factor This term originates from the Rhesus monkey, where the antigen was initially discovered The presence of the Rhesus D factor plays a crucial role in this classification.

LITERATURE REVIEW

TYPES OF HUMAN BLOOD

Human blood consists of four key components: red blood cells, white blood cells, plasma, and platelets Red blood cells play a crucial role in determining blood types, which are classified using the ABO blood type system, identifying types A, B, AB, and O.

Blood types are determined by the presence or absence of specific antigens on red blood cells A person with A antigens is classified as blood type A, while those with B antigens are categorized as blood type B If both A and B antigens are present, the blood type is AB Conversely, individuals lacking both A and B antigens are identified as having blood type O Understanding these classifications is crucial for blood transfusions and medical procedures.

Figure 2 1 The ABO blood grouping system (Source: Wikipedia)

The basic blood grouping system can be divided into eight categories based on the presence of the Rhesus (Rh) factor, which is named after the Rhesus monkey where the antigen was initially discovered Individuals with the Rhesus D factor in their blood are classified as Rhesus positive, while those lacking this factor are deemed Rhesus negative Consequently, when blood types are categorized under both systems, individuals may be identified as having either AB blood type or its negative counterpart.

The Rhesus factor is crucial in pregnancy, as it can pose risks to the baby's life if the infant inherits Rhesus positive blood from the father while the mother has Rhesus negative blood This mismatch can lead to the mother's immune system producing antibodies that attack the child's blood.

GEL CARD METHOD AND TYPE OF GEL CARDS

In Gel Technology, a specialized plastic card known as the Gel Card is utilized for reactions, featuring six to eight microtubes pre-filled with specific gels and reagents such as Anti A, Anti B, Anti D, and AHG These gel plates, designed in various sizes, function as sieves that allow only single normal red blood cells to pass through, resulting in a negative outcome, while agglomerated erythrocytes are trapped within the gel column The sensitivity of this system is influenced by the size of the gel and gel particles.

Figure 2 2 Gel Card and parts inside the Gel Card tube

A red blood cell suspension was created using Low Ion Strength Solution (LISS), red blood cells, and serum/plasma in a microtubule reaction chamber Following the addition of a gel tag, the mixture is incubated to allow for antigen-antigen reactions After incubation, the Gel Card is centrifuged for 10 minutes at a force of 85g Under these controlled conditions, only a single normal red blood cell can pass through the gel and settle at the bottom of the microtubule, forming a knot The agglomerated cells remain in the gel column, with their position determined by the size of the agglutination, facilitating the classification of the reaction.

4 + RBCs are agglutinated at the top of the gel column

3 + Most of the agglutination erythrocytes remain in the upper half of the gel column

2 + Red cell agglutination is observed throughout the length of the column A few groups of red blood cells may also be displayed at the bottom of the gel column

1 + Most RBCs are in the lower half of the column Some can also be shown at the bottom of the gel column

All red blood cells pass through and form a compact knot at the bottom of the gel All 4+ 3+ 2+ 1+ case are positive, 0 or - considered negative

2.2.2 Type of Gel Cards a) Forward grouping Gel Card

The Forward grouping Gel Card features eight micro tubes, with each test utilizing four specific tubes: A, B, D, and Ctrl Tube A is infused with antibodies A, tube B contains antibodies B, tube D holds antibodies D, while tube Ctrl provides a neutral environment for testing An example of the Forward card is illustrated in Figure 2.4.

For a patient with blood type A, characterized by A antigens and B antibodies, the process involves diluting the erythrocyte solution and LISS solution The upper suspension is then injected into three tubes of ABD and centrifuged at 880 rpm for 10 minutes The results are subsequently displayed on the Gel Card, indicating the patient's blood type compatibility.

 Column A contains antibodies A, so the patient's A antigen will be retained by antibody A and not pulled down by centrifugal force The result will be positive

 Column B contains antibody B, so the patient's A antigen will not be retained by antibody A The results will be negative

 Column D is used to determine the blood group system of patients with Rh + or Rh- systems, if there is a positive agglutination present, Rh + patients, if negative, Rh- patients

To assess the quality of the Gel Card, refer to the Ctrl column; a negative value indicates that the Gel Card is still valid, while a positive value signifies that it is no longer in use.

Figure 2 4 Sample of Forward grouping Gel Card b) Card Reader

After incorporating all the ingredients, the Gel Card undergoes centrifugation at 85g, especially if it contains an AHG tube incubated at 37 degrees Celsius for 15 minutes The agglutination results are then presented on the card, which can be efficiently interpreted using a Gel Card Reader that employs image processing technology to assess the degree of agglutination in the gel column.

IMAGE PROCESSING ALGORITHM

The expansion operation, denoted as A⊕B = ⋃Bx where x⊂A, is used to increase the size of an object in an image, where A represents the object and B is the image structuring element This operation utilizes predefined shapes, such as squares and crosses, to interact with the image and determine the availability of the original object.

Figure 2 5 Dilation in image processing (Source: www.cs.auckland.nz)

The image expansion algorithm plays a crucial role in various practical applications, including product classification and license plate detection For instance, Phan Thanh Phong and Nguyen Hien Minh utilized this technique in their graduation project titled "APPLICATION OF IMAGE PROCESSING IN PRODUCT CLASSIFICATION SYSTEM," enhancing object clarity to improve classification accuracy Similarly, Vo Danh Quan and Nguyen Minh Hao applied image expansion in their project focused on "COUNTING THE NUMBER OF PILLS," showcasing its effectiveness in precise object recognition.

VỈ THUỐC" [4] also use expansion math to clarify the image of the pill so that the microcontroller can handle it

Canny Edge Detection is an algorithm used to extract edges from images

The algorithm has four stages:

 First - Performs noise reduction with a Gaussian Blur

 Second - Gets the gradient direction and magnitude with a Sobel kernel

 Third - Applies non-maximum suppression, which removes unwanted pixels that are not part of a contour

 Fourth — Applies the Hysteresis Thresholding that uses min and max values to filter the contours by the intensity gradient [5]

In practical applications, edge detection is used in object detection and recognition In Nguyen Thanh Huy's master's thesis, University of Da Nang, the topic

“ỨNG DỤNG PHƯƠNG PHÁP PHÁT HIỆN BIÊN TRONG NHẬN DẠNG CÁC ĐỐI TƯỢNG HÌNH HỌC [6] ” Uses an edge detection method to detect objects.

IMAGE CAPTURING DEVICES

The image capturing device plays a crucial role in photography, as it is primarily responsible for capturing images Utilizing a high-resolution camera, such as one with a 1920x1080 resolution, presents challenges, particularly when it comes to capturing close-up shots effectively.

We chose the HOCO DI01 webcam for image recognition due to its affordability, high resolution, and user-friendly design This webcam connects to the microcontroller via USB, making it ideal for various image processing applications, including product counting, classification systems, face recognition, and license plate detection.

Microcontrollers play a crucial role in embedded programming, with popular options including PIC16F887, STM32, Arduino, Intel Galileo, and Raspberry Pi, each tailored for specific applications Among these, Raspberry Pi stands out in image processing due to its superior configuration, making it ideal for a range of tasks from simple product color checks and license plate detection to more advanced applications like facial recognition and machine learning.

The Raspberry Pi is a microcontroller that is widely used in real-world applications Specifically, the graduation project of Nguyen Phuc Bao, Nguyen Le

Gia Bach from HCMUTE presented a project titled "Design of an Image Acquisition System for the Detection of Occlusal Dental Problems," utilizing the Raspberry Pi 3B as a microcontroller Similarly, Le Hoang Thanh and Ho Dinh Vuong from HCMUTE developed a project focused on "Design and Implementation of a Security System Using Image Processing," also employing the Raspberry Pi 3B as their microcontroller.

Launched in 2019, the Raspberry Pi 4B is a powerful embedded computer that boasts three times the performance of its predecessor, the Pi 3B, and offers RAM options of 2GB, 4GB, and 8GB Its efficiency in image processing makes it a popular choice compared to other embedded kits like Arduino, Intel Galileo, and NVidia Jetson Nano The significant RAM upgrades in the Pi 4B enhance its capability to run Python-based image processing algorithms, making it an ideal microcontroller for projects such as creating a compact Gel Card Reader.

Figure 2 6 Raspberry Pi 4B (Source: www.deskmodder.de)

Table 2 1 Raspberry Pi all generations comparison

CPU Clock 1.5 GHz 1.4 GHz 1.2 GHz 1.4 GHz 1 GHz

Camera Yes Yes Yes Yes Yes

GPIO Yes Yes Yes Yes Yes

The switching power supply has been the preferred choice over the traditional transistor linear power supply for over 30 years due to its compact size, lightweight, higher efficiency, reduced heat generation, better tuning capabilities, wider input voltage range, and lower cost As a result, it is widely utilized in household appliances, industrial equipment, and electronic medical devices In contrast, linear power supplies, which typically use a 220VAC low-voltage transformer and an IC 7805 for voltage stabilization, achieve only around 40% efficiency, while switching power supplies boast efficiencies exceeding 70% For applications requiring stable and safe operation over extended periods, such as powering a Raspberry Pi, a 5V switching power supply is the ideal solution.

DESIGN AND CALCULATION

INTRODUCTION

In this chapter, the design calculations and selection of components for Gel Card Reader include power circuit, image capturing device, device cover, and how to connect the components together.

CALCULATION AND DESIGN

3.2.1 Block Diagram Of An Capturing Device

Figure 3 1 Block diagram of the system

The system's block diagram, illustrated in Figure 3.1, outlines a Power Supply designed to provide 5VDC to the Central Processing Unit, Light Environment, and Cooling Fan The Light Environment features a small LED bar that illuminates the Gel Card, enabling the camera to capture clear images and transmit data effectively.

The Central Processing Unit (CPU) processes input image data using various image processing methods in conjunction with a Raspberry Pi To maintain optimal performance, a cooling fan dissipates heat generated by both the power and processor blocks during operation Peripheral devices, including a keyboard and mouse, facilitate system operation and allow for the input of patient data Ultimately, the blood group results are displayed on the screen for easy access and review.

In the topic, the system uses the Hoco D101 webcam because it is cheap (about

$ 15) but with good quality Video quality is bright and clear, with up to Full HD resolution, good refresh rate and virtually no stutter even in low-light environments

Image capturing device has 4 pins, including: GND, 5V DC, DATA+, DATA- The camera has a built-in ADC converter and offers 2 outputs: DATA + and DATA-

The Raspberry Pi 4B, released in 2019, is the most powerful model to date, designed to receive and process images from a connected camera It outputs the results to a user interface while being powered through a 5V 5A USB Type C port and connected to a 14-inch LCD screen via micro HDMI Its enhanced processing speed allows for a higher number of samples to be measured within an hour, making it an efficient choice for image processing tasks.

To effectively use the Raspberry Pi 4B as a computer, it is essential to connect monitors and peripherals for user interaction and visibility In this setup, a 13-inch Samsung LCD screen with HD resolution is utilized.

HD resolution is the best resolution for the Raspberry because it does not affect the device's performance and processing speed

3.2.5 Calculation of Power Supply a) Calculation of Power Requirement

Table 3 1 The consumption power of the circuit

No Device Voltage (V) Current (mA) Power (W)

The sum of consumption power is described in the formula (3.1):

P1 = consumption power of Raspberry mainboard

P2 = consumption power of Webcam USB

P3 = consumption power of DC Fan

P4 = consumption power of Led bar

This is a minimum of power that our project requires As a result, we decided to make a switching power supply 5V-5A (25W) b) Circuit Composition of Switching Power Supply

The block diagram of most switching power supplies is shown in Figure 3.3

Figure 3 3 Block diagram of the switching power supply

The process begins with the rectification and filtering of AC input voltage into DC voltage A power transistor, regulated by a high-frequency PWM signal or another transistor, applies this DC voltage to the primary side of a switching transformer The secondary side of the transformer then induces a high-frequency voltage, which is delivered to the load after rectification and filtering To maintain a stable output, feedback from the output section is sent to the control circuit, which adjusts the PWM duty ratio accordingly For easier calculation and design, the switching power circuit is analyzed by breaking it down into smaller component circuits.

• Total output power is calculated as the formula (3.2):

• Power supply input with an efficiency of 75% is calculated as the formula (3.3):

Po = power of output n = efficiency of input power supply

• DC voltage input after rectifier is calculated as the formula (3.4):

• Average input current is calculated as the formula (3.5):

• The peak current on the transistor is calculated as the formula (3.6):

• Primary inductance is calculated as the formula (3.7):

Lpri = (V1 * Dmax) / (Ipk * f) = (220 * 0.45) / (0.625 * 300000) = 528 (uH) (3.7) Where:

Dmax = maximum duty cycle when flyback circuit is in interrupt mode, choose Dmax = 0.45 f = switching frequency

• Number of primary winding is calculated as the formula (3.8):

Lpri = primary inductance is calculated above, converted to nH

• The waveform of the primary current is a serrated pulse, so the r.m.s.value is calculated as the formula (3.9):

The switching transistor utilizes a 0.7mm winding for its primary coil, featuring a cross-sectional area of 0.384 mm² With a current density of 5A/mm², each winding can handle a current of 1.9A Consequently, a total of 38 turns of 0.7mm winding are required for the primary coil to ensure optimal performance.

• Number of secondary winding is calculated as the formula (3.10):

Ns = Npri * (Vo + Vd) * (1 - Dmax) / (V1 * Dmax)

Vd = voltage drop of the secondary rectifier diode

• The maximum peak current through Transistor Q2 is calculated as the formula (3.11):

Dmax = maximum duty cycle when flyback circuit is in interrupt mode

V1 = AC input voltage f = switching frequency

• Transistor Q2 working mode saturation in pulse generating circuit is calculated as the formula (3.12):

Ic = (V2 - Vcesat)/ Zlpri (3.12) Zlpri = 2π * f * Lpri = 995 (Ω)

V2 = DC rectified voltage β = BJT's current amplification coefficient

Vcesat = Vce saturation of transistor Q2

Vbe = threshold voltage Vbe of transistor Q2 (~ 0.7V)

Ib = bias current pin B of transistor Q2

Zlpri = secondary winding impedance when operating at frequency f = 300kHz Lpri = primary inductance

• Resistor values in the voltage divider bridge for TL431 and PC817 in the feedback circuit is calculated as the formula (3.13):

Vref = Reference voltage of TL431

Input filter and rectifier circuit

The 220AC voltage is first protected by a fuse F1 and a varistor VR1, which safeguard against overcurrent and overvoltage It then passes through a high-frequency noise filter circuit made up of capacitor CX1 and inductor LF1 to eliminate noise, before being rectified by a diode bridge to convert it into DC voltage To prevent sudden surges in charge current that could shorten the lifespan or damage capacitor C1, the DC voltage is routed through an NTC resistor The primary filter capacitors, particularly capacitor C1, flatten the DC voltage and store energy for the primary winding of the switching transformer T1 Suitable components for the input filter and rectifier circuit are outlined in Table 3.2, while Figure 3.4 provides a schematic of the noise filter and voltage rectifier circuit.

Table 3 2 Electronic component of the input filter and rectifier circuit

No Label Component Quantity Value Note

3 CX1 Capacitor 1 100nF; 310V Polyester capacitor

4 LF1 Inductor 1 10mH Power inductor

Diode 1N4007 4 1A; 1000V Used for the diode bridge

Figure 3 4 Schematic of noise filter and primary voltage rectifier circuit Pulse generating circuit

The 310 DC voltage is directed through the priming resistor R5 and the switching transformer T1, providing power to the pulse generating circuit, which consists of transistors Q1 and Q2 A key characteristic of the flyback power circuit is the polarity of its primary and secondary windings; for a positive output voltage, the windings must have opposite polarities, while for a negative output, they must align in the same direction Table 3.3 lists the suitable components for the pulse generating circuit, illustrated in Figure 3.5.

Table 3 3 Electronic component of pulse generating circuit

No Label Component Quantity Value Note

5 C2 Capacitor 1 10nF; 2KV Ceramic capacitor

Figure 3 5 Schematic of pulse generator circuit Secondary voltage rectifier circuits

When transistor Q2 operates in open/close mode, it creates a variable primary field in switching transformer T1, which induces voltage on the secondary side This induced voltage is then rectified for further use.

The Schottky diode D3 is utilized to convert AC to DC voltage, which is then stabilized to a 5V output using two filter capacitors, C7 and C8 Table 3.4 provides a list of suitable components for the secondary voltage rectifier circuit, while Figure 3.6 illustrates the schematic of these rectifier circuits.

Table 3 4 Electronic component of secondary voltage rectifier circuit

Label Component Quantity Value Note

Figure 3 6 Schematic of secondary voltage rectifier circuit

The secondary output voltage is linked to the sampling and fault voltage detection circuits, which consist of an optocoupler (U1) and a voltage regulator (U2) to ensure stable operation of the pulse generator Suitable components for the secondary voltage feedback circuits are detailed in Table 3.5, while Figure 3.7 illustrates the schematic of these feedback circuits.

Table 3 5 Electronic component of secondary voltage feedback circuits

No Label Component Quantity Value Note

Figure 3 7 Schematic of secondary voltage feedback circuit

The complete switching power circuit, as illustrated in Figure 3.8, operates with an input voltage of 220VAC and provides a stable output voltage of 5VDC This circuit features essential safety functions, including overcurrent and overvoltage protection, noise filtering, and voltage stabilization, while ensuring complete isolation of the secondary output voltage from the primary high voltage for enhanced safety.

Figure 3 8 Schematic of switching power supply circuit 3.2.6 Case designs for the Gel Card Reader

To enhance the device's reliability and stabilize its image capturing process, we utilized Solidworks for model design and employed 3D printing technology for fabrication The design comprises three distinct components.

- The device case a) Base holder

The base holder is designed to securely fix the Gel Card tray holder, camera holder, and back cover of the device It features ample space beneath the two holders for essential components like the power circuit, Raspberry Pi, LED lights, and connection cables Additionally, the back cover includes strategically placed holes for a cooling fan, power switch, power cord, and Raspberry Pi connectors, including USB, LAN, HDMI, and Micro 3.5mm ports The shape of the base holder is illustrated in Figure 3.9.

Figure 3 9 Frontside (a) and backside (b) of the base holder b) Device case

We designed a protective case for the device that safeguards internal components while ensuring an optimal lighting environment for stable operation of the image capturing unit, resulting in consistent image quality Additionally, the case features a precisely shaped opening at the top for easy insertion and removal of the Gel Card, as illustrated in Figure 3.10.

DEVICE CONNECTION

Design calculations are crucial in any project, as they significantly influence the outcomes Careful selection of all equipment and components is essential to achieve optimal results Consequently, a comprehensive description of the entire system's connections, as illustrated in Figure 3.11, is necessary for effective implementation.

Figure 3 11 The connection of the entire project Interpret connection diagrams

The Raspberry Pi 4B operates using a 5V 5A power supply connected through a USB Type C port, which also powers USB LEDs and a heatsink fan A D1O1 Hoco Webcam connects to the Raspberry Pi via a USB 3.0 port, while a computer monitor is linked through the Micro HDMI port using a Micro HDMI to VGA converter cable Additionally, peripherals like a mouse and keyboard are connected through the USB ports.

FLOWCHART AND PROGRAM ALGORITHM

3.4.1 Functional summary of Gel Card Reader

To effectively construct flowcharts and programming for the project "Designing a Gel Card Reader for blood grouping tests," it is essential to summarize the functions of the Gel Card Reader.

The Gel Card Reader function allows users to read two types of Gel Cards: Forward and Forward Reverse To read a Forward type Card, users should select the Forward Grouping option on the user interface, insert the Card into the holder on the Gel Card Reader, and press the View Result button The interface will then display the agglutination levels in each microtube, the results for both samples from the Forward Card, and the final results for both the Forward and Reverse Cards.

The defective Gel Card detection function is essential for assessing the quality of Gel Cards during testing via the Ctrl column When a faulty card is identified, the interface promptly displays the results in the result box.

After completing the test, users can input and manage patient information, including full name, ID, date of birth, gender, and measurement results, all of which will be securely stored in the Program Database.

Figure 3 12 Flowchart of Gel Card Reader system

The control process of the Gel Card Reader system, as illustrated in Figure 3.12, begins with system boot-up and program initiation Following this, the camera captures an image of the Gel Card, which is then transmitted to the Raspberry Pi for processing.

The Pi 4B processes images through pre-processing steps to create an aggregated image Based on the height of the condensation column, the algorithm infers results, which are then displayed on the user interface.

3.4.3 A flowchart of agglutination level and blood type

Figure 3 13 A flowchart of agglutination level and blood type a) Image pre-processing

The process involves several key steps: first, cropping the image and converting it from RGB to HSV format Next, we identify the red threshold in the HSV image to isolate the red areas, which are then converted to grayscale This grayscale image is transformed into a binary format using a threshold Following this, we dilate the binary area with a 5x5 kernel and compute the midpoint of the dilated region Finally, by analyzing the vertical axis coordinates of this midpoint, we can determine the agglutination level of the gel column.

The camera captures an image that is divided into eight sections, each featuring a Gel Card with dimensions of 255x75 pixels To identify the coordinates for cutting the image, we utilize Paint software on Windows As illustrated in Figure 3.14, the specific areas to be cut from each micro tube are clearly marked.

Figure 3 14 Image area is cropped in Gel Card (red border) roi1 = img1[274:274+255,423:423+75] roi2 = img1[274:274+255,583:653] roi3 = img1[274:274+255,708:708+75] roi4 = img1[274:274+255,855:855+75] (4.1) roi5 = img1[274:274+255,1002:1002+75] roi6 = img1[274:274+255,1145:1145+75] roi7 = img1[274:274+255,1289:1289+75] roi8 = img1[274:274+255,1427:1427+75]

Figure 3 15 The result after image cutting in Gel Card Reader

Step 2: Convert RGB to HSV image

The standard RGB color space, while commonly used, is not ideal for color recognition tasks To address this limitation, we convert RGB images to the HSV color space, which stands for Hue, Saturation, and Value This conversion can be easily accomplished using the OpenCV library in Python with the function: `hsv1 = cv2.cvtColor(roi1, cv2.COLOR_BGR2HSV)`.

Note: hsv1: HSV image after convert from RGB image roi1: RGB image

Figure 3 16 RGB to HSV diagram

Figure 3 17 Results after converted image from RGB to HSV

We analyzed data samples from various Gel Cards to assess agglutination levels, classifying the Hue, Saturation, and Value metrics of the agglutination regions These metrics establish specific thresholds that allow us to filter out red areas for subsequent processing.

Figure 3 18 The selectable color threshold for filtering

Once you have defined and filtered the desired color area, the next step is to apply the threshold method to convert the color into a grayscale image, followed by transforming the grayscale image into a binary image.

The function converts a gray image to a binary image using the threshold method: gray1 = cv2.cvtColor(output1, cv2.COLOR_RGB2GRAY) ret, threshold1 = cv2.threshold(gray1, 10, 255, 0)

Note: output1: The Image after processed with red filter

For a grayscale image with a gray level from 0 to 255, we use threshold method, select a threshold (T = 10), with a pixel has a gray level below 10 will have value of

1, pixel has a gray level higher than 10 will be worth 0

Figure 3 19 Image after processed with threshold Step 4: Find the midpoint of the binary image area

The cv2.findContours function is essential for identifying the edges of specific areas within an image As illustrated in Figure 3.20, after processing the microtube image, we utilize cv2.findContours to detect the borders of the white binary image and subsequently draw these contours.

Figure 3 20 Determine binary image area and draw contour

Then we use the function cv2.moment to find the midpoint of the image area, applying the following formula

Cy =M01/M00 total_contours = len(contours) print('Total: ',total_contours) locations = [] for contour in contours:

M = cv2.moments(contour) cX = int(M["m10"] / M["m00"]) cY = int(M["m01"] / M["m00"]) print('center on the x-axis :',cX,' center on the y-axis',cY) locations.append([cX,cY])

E.g Determine the center point of binary image in Gel Card’s microtube

Figure 3 21 The value belong x and y axis of center point in binary image

Figure 3.21 show us the value belong x and y axis of center point in Figure 3.20 b) Flow chart determines blood type based on agglutination results of Gel Card Reader

Figure 3 22 Flowchart of blood type determination in Gel Card Reader

The flowchart in Figure 3.22 illustrates the algorithm used by the Gel Card Reader to determine blood type through image processing Initially, the Ctrl column in the Gel Card must be assessed at the 4th and 8th positions If either column shows a positive result ranging from 1+ to 4+, the card is deemed unusable, and an error message will be displayed on the interface Conversely, if the Ctrl column yields a negative result (-), data should be collected from the other microtubes labeled A to D to deduce the blood type result.

1 (positive), column B has a value of 0 (m calculated) and column D has a value of 1

The blood type result is identified as A+, and the user interface provides a visual representation of agglutination levels in the columns, aiding in the detection of both minor and significant abnormalities in antibody presence within the patient's blood.

PRINCIPLE OF OPERATION

To start the setup, connect the power circuit to a 220V source and turn on the Raspberry boot switch Once the desktop screen is visible, click on the Gel Card icon to launch the program.

To prepare a Gel Card sample, inject the patient's erythrocytes into microtubes and centrifuge at 1015 rpm for 10 minutes Once centrifugation is complete, place the Gel Card in the measurement position of the machine and press the "View Gel Card" button on the interface, allowing the webcam to capture the image The program will then crop and process the Gel Card image, displaying the results in the "View Result" section If the card is defective or damaged, the interface will prompt, "Wrong Gel Card, please use another Gel Card!"

CONNECTION OF SYSYTEM PARTS

INTRODUCTION

The design of a Gel Card Reader for blood grouping tests utilizes image processing to analyze the agglutination position of erythrocytes in microtubes This innovative system includes an interface and model that accurately determines the position of red blood cell agglutination and displays the results The Gel Card Reader has gained popularity in major hospitals, enhancing the efficiency and accuracy of blood grouping tests.

The project is built with a small system model, low capacity, only suitable for clinics or small and medium hospitals.

POWER SUPPLY

4.2.1 Assembly of the Power Supply

Steps to conduct circuit construction:

 List components, make the schematic on Proteus software

 Make the printed circuit board (PCB), arrange components on the printed circuit board in Proteus software, export pdf file

 Printing the PCB on a glossy paper, position it on the copper board, ironing it After that, wash the circuit with ferric chloride

 Conducting drilling, arranging the components on the board, and soldering it

 Plugin the power, recheck the circuit, and measure the outputs of the source board

4.2.2 Execution of The Power Supply

The power supply board's PCB was designed using Proteus 8.6, and after conducting calculations and simulation tests to obtain accurate results, the components are detailed in Table 4.1.

Table 4 1 Electronic component of the switching power supply board

No Component Quantity Value Note

24 Capacitor 1 10nF; 2KV Ceramic capacitor

29 Diode 1N4007 4 1A; 1000V Used for the diode bridge

Next, the PCB is designed in Proteus software and constructed Figure 4.1 describes the PCB of the switching power supply

Figure 4 1 The top side (a) and bottom side (b) of PCB

Figure 4.2 describes the completed power supply There are two 5V-2A header output and one USB power port

Figure 4 2 The 5 Volt switching power supply

4.2.3 Inspection of The Power Supply

After assembling the power supply, we conduct thorough checks on all outputs to verify they deliver sufficient voltage and current for the project's modules As illustrated in Figure 4.3, this inspection process confirms that the power supply board meets the required voltage output specifications.

Figure 4 3 The inspection output voltage of power supply board

EXECUTION THE CASE OF GEL CARD READER

A Gel Card Reader was created using a 3D printer, with all enclosure components crafted from PLA material The outcome, showcasing the base holder and Gel Card Reader case, is illustrated in Figure 4.4.

Figure 4 4 Base holder (a) and case (b) of Gel Card Reader

SYSTEM CONSTRUCTION

The system's program interface features three primary components: control, display, and results The control section includes a Gel Card Reader button, offering two options for image processing: reading the image directly or accessing it from a file.

(b) display will display the image read from the Webcam and the result will return the readable result on the Gel Card Interface created by Qt Designer software

Figure 4 5 Graphic User Interface of Gel Card Reader 4.4.2 Model Construction

● Model Size: Length 24 cm, width 12 cm, height 13 cm

● The Raspberry Pi 4B is located inside the device

● Webcam Hoco D101 is used to receive images, the distance from the camera to the location of the Gel Card is 10 cm

● Use 1 5V 5A power supply circuit as a power supply for the Raspberry Pi Board, USB Led and the heatsink fan

● 14 inch Samsung LCD screen, keyboard, mouse.

PROGRAMMING SOFTWARE

The team utilized the Python programming language to develop code during the project's implementation Python is the most popular choice for embedded projects with Raspberry Pi For writing Python programs, we opted for PyCharm as our Integrated Development Environment (IDE) due to its intuitive interface, user-friendly features, and effective data management capabilities.

Figure 4 6 PyCharm IDE for python programming 4.5.2 Image processing program img1 = cv2.imread('C:/Users/Admin/Desktop/gelcard/test7.jpg') roi1 = img1[274:274+255,423:423+75] hsv1 = cv2.cvtColor(roi1, cv2.COLOR_BGR2HSV)

To process a Gel Card image, the first step is to read and crop it, focusing on micro tube 1 The code utilizes OpenCV to define red color ranges in the HSV color space, creating masks for both lower and upper red hues These masks are combined to isolate the desired regions in the image The result is then converted to grayscale, and a threshold is applied to enhance features, followed by dilation using a 5x5 kernel to improve visibility.

In this process, we establish two filters to isolate the red area within each microtube, with all parameters detailed in Chapter 3 Using the OpenCV function cv2.findContours, we identify the contours in the dilated image, applying the RETR_TREE and CHAIN_APPROX_SIMPLE methods The total number of detected contours is then calculated and displayed, followed by the initialization of an empty list to store the locations of these contours.

To calculate the centroid of a contour in an image, use the formula `M = cv2.moments(contour)` to obtain the coordinates `cX` and `cY` These coordinates are appended to a list called `locations`, which is then sorted based on the x-coordinate For each location, the y-coordinate is analyzed to determine the corresponding state: if `indexY` is less than 60, a white circle is drawn, and the state is labeled as 'Positive (4+)'; if between 60 and 70, it is labeled 'Positive (3+)'; between 70 and 80, 'Positive (2+)'; between 80 and 95, 'Positive (1+)'; and for values above 95, a black circle is drawn, indicating a 'Negative (-)' state.

After dilate image, we find the center pixel of area, X-axis  IndexX, Y-axis  Index Y We base on Index Y parameter to determine alggutination level of microtube

QT Designer is a versatile cross-platform integrated development environment that streamlines GUI application development using C++, JavaScript, and QML As part of the Qt SDK, it leverages the Qt API to simplify host OS GUI function calls Key features include a visual debugger, WYSIWYG GUI layout designer, syntax highlighting, and autocompletion On Linux, Qt Creator utilizes the GNU Compiler Collection, while on Windows, it supports MinGW or MSVC by default and can also work with the Microsoft Console Debugger when compiled from source.

Figure 4 7 Gel Card GUI is built on QT Designer

RESULTS AND DISCUSSION

GENERAL RESULTS

After nearly three months of researching professional documents, documents on the Internet, and the enthusiastic help of the lecturer, we implemented the topic

"Design of a Gel Card Reader for blood grouping tests." has achieved specific successes, completed as required and on time prescribed with the following contents:

 Research and understand the principle of operation of the webcam, Raspberry

 Design and build the model hardware with full essential functions, reasonable layout, and stable operation

 Learn, design, and create GUI

 Design a switching power supply for stable output voltage

 Research and understand algorithms and functions and the light environment conditions applied to the processing, calculating and giving results, and identifying defective samples

 Building a system capable of managing patient information, making it easy to access data.

ACHIEVEMENT RESULTS

Figure 5.1 illustrates the arrangement of input jacks, output jacks, and components, highlighting the design's efficiency The power supply is capable of delivering a maximum output of 25W, ensuring optimal performance Notably, the power supply port remains cool even after extended use, indicating its reliability and durability.

Figure 5 1 Input, output jacks of the switching power supply

The output voltage of the power supply is 5V, adjustable between 4.8V and 5.2V using a 1K ohm potentiometer in the voltage feedback circuit In the event of a short circuit, the power supply can disconnect from the 220AC input voltage Designed with a feedback circuit and control voltage circuit, this power supply ensures stable voltage operation within its specified power limits, facilitating reliable performance of connected components, as illustrated in Figure 5.2 and detailed in Table 5.1.

Figure 5 2 Measure output voltage when the load is connected

Table 5 1 Outputs/Inputs voltage of power supply testing

No Input voltage Output voltage

30 minutes after the power supply connected to loads

No Input voltage Output voltage

The team has developed a user-friendly GUI utilizing QT Designer on the Python platform, enabling users to effortlessly manipulate and read Gel Card images while observing and interpreting results in each column Additionally, the interface includes a section for entering information, allowing users to effectively manage sample results Upon the initial launch of the program, the interface will display as illustrated below.

Figure 5 3 GUI of a Gel Card Reader

Figure 5 4 Gel Card Reader system 5.2.4 Test results

The Gel Card reading method utilizes gel column agglutination to determine blood type results In this study, the group tested the GRIFOLS Gel Card sample, which is currently implemented at Thu Duc General Hospital.

5.2.5 Result of Gel Card Reader

Figure 5 5 Sample is put into Gel Card Reader

The GUI control features a Read key that allows users to capture images directly from the Gel Card Reader, utilizing the right blood grouping card with 8 micro-tubes supplied by GRIFOLS Upon clicking the Read button, the capturing device takes an image and transmits it to the Raspberry Pi 4B for preprocessing, agglutination recognition, and result export Results are displayed on the screen after a 5-second processing period, as illustrated in Figure 5.6.

The system is able to recognize faulty Gel Card based on agglutination in Ctrl column, if Ctrl column is a positive result, it means that Gel Card is damaged, unusable

Figure 5 7 Wrong Gel Card recognition

To ensure the system works correctly, the system has been tested many times by different Gel Card models, below are some specific examples

Figure 5 8 The result interpretation (Sample 1: O- ; Sample 2: B+)

Figure 5 9 The result interpretation (Sample 1: A+ ; Sample 2: B-)

We evaluated the effectiveness of the Gel Card Reader system by applying for samples on November 25, December 16, December 30, and January 18 The results, presented in the chart below, compare the performance of the Gel Card Reader with the DG Reader from GRIFOLS.

Table 5 2 The Accuracy and Efficiency of Gel Card Reader

Day Number of cards read correctly

Number of cards read wrong

Figure 5 10 DG Reader of GRIFOLS

Figure 5 11 Gel Card Reader and GRIFOLS’s DG Reader Comparison

The accuracy of the Gel Card Reader, as illustrated in Figure 5.11, ranges from 65% to nearly 90% However, some errors occur during the interpolation process due to certain cards being too long to maintain color consistency at the start Overall, the results align with our initial objectives and requirements for the project.

INSTRUCTION

Step 1: Plug the male jack in the power outlet, connect VGA cable to device, turn on the power switch, plug the mouse and keyboard into USB ports, wait for raspberry booting (10-20 seconds)

Step 2: Click on Thesis Graduation icon on Desktop Screen, put the Gel Card after processing into the tray holder

Step 3: Press the Read button on the screen, after the results have been displayed, fill the patient information and press Save If you want to print the report, just press the Print button If you want to see all the patient’s results, click on Database on toolbar If you want to exit the program, click the X button on the left top corner then click Exit

Causing: Put the Gel Card slowly, avoid tilting If you don’t put the Gel Card in the correct way, the result will be affected.

DISCUSSIONS

We have developed a compact and portable device specifically designed for reading Gel Cards in blood grouping tests This high-performance tool ensures accurate results, effectively determines blood types, and identifies defective Gel Cards Additionally, it offers robust patient information management and allows for easy access to patient history.

The study faced limitations in sample size and type, restricting the measurement of all blood types to those available on Gel Cards, based on hospital sample availability The device utilized can only read the dominant blood type card, as other cards are infrequently used at the hospital, leading to a focus solely on determining the dominant blood group Additionally, the device lacks the capability to scan barcodes on the Gel Cards.

FUTURE WORKS AND CONCLUSION

CONCLUSION

The graduation project successfully utilized image processing techniques to read results from the Gel Card, achieving its initial objectives The implemented system model includes functionalities for reading, displaying, saving, and managing results The team effectively applied their knowledge of image processing to develop algorithms, create a user-friendly GUI, design power circuits, and execute model design and 3D printing The reading results demonstrate high precision, complemented by an intuitive and easy-to-use interface.

FUTURE WORKS

In the process of implementing the graduation project until the completion of the topic, the biggest error belongs to the image processing To improve this problem:

 Find the best HSV color filter to read Gel Card

 Apply additional filters to avoid image noise

In addition, the development direction of this topic is to increase the readability of many different types of Gel Cards such as Forward Reverse, Coombs, CrossMatch

It is necessary to have a sufficiently large and diverse sample of samples to be able to accurately evaluate the system

[1] Salama Yusuf, “How Were Blood Types Discovered ?”, scienceabc.com, access on 26/10/2020

[2] Dr Jadhad M V “Gel tech”, slideshare.net , Apr 18, 2017

[3] Nguyễn Hiền Minh, Phan Thanh Phong, “ỨNG DỤNG XỬ LÝ ẢNH TRONG HỆ

THỐNG PHÂN LOẠI SẢN PHẨM”, Graduation thesis in HCMUTE, 6/2019

[4] Võ Danh Quân, Nguyễn Minh Hảo, “ĐẾM SỐ LƯỢNG VIÊN THUỐC CÓ TRONG VỈ THUỐC”, Graduation thesis in HCMUTE, 12/2019

[5] Thiago Carvalho, “Edges and Contours Basics with OpenCV”, pyimagesearch.com, Jul 20, 2020

[6] Nguyen Thanh Huy, “ỨNG DỤNG PHƯƠNG PHÁP PHÁT HIỆN BIÊN TRONG

NHẬN DẠNG CÁC ĐỐI TƯỢNG HÌNH HỌC”, Master thesis in Universiy of Da

[7] Nguyen Phuc Bao, Nguyen Le Gia Bach , “DESIGN OF AN ACQUISITION IMAGE SYSTEM FOR THE DETECTION OF OCCLUSAL DENTAL PROBLEMS”,

[8] Lê Hoàng Thành, Hồ Đình Vương, “THIẾT KẾ VÀ THI CÔNG HỆ THỐNG BẢO

MẬT ỨNG DỤNG XỬ LÝ ẢNH”, Graduation thesis in HCMUTE, 7/2019

[9] Apogeeweb, “Switching Power Supply Circuit Diagram with Explanation”, apogeeweb.net, 13 Jul 2019

The main program code utilizes PyQt5, importing essential modules such as QtCore, QtGui, and various components from QtWidgets, including QMainWindow, QApplication, QFileDialog, and QMessageBox This setup is crucial for developing graphical user interfaces (GUIs) in Python applications.

This article discusses the implementation of a PyQt5 application that utilizes various modules such as QLabel, QTextEdit, and QVBoxLayout for user interface design The code snippet showcases the creation of a main window class, LoadQt, which inherits from QMainWindow and initializes the UI using a ui file It sets a custom window icon and connects a button to a function for opening images Additionally, the article mentions the integration of libraries like OpenCV, NumPy, and SciPy for image processing and analysis, highlighting the use of Butterworth filters and other signal processing techniques.

The code snippet connects various actions to their respective functions, such as opening an image and displaying information about the application A QTextEdit widget is initialized, and a background image is set for a label using a specified URL Finally, the main layout is applied to the interface.

@pyqtSlot() def loadImage(self, fname): self.image = cv2.imread(fname) self.tmp = self.image self.displayImage(fname) self.ReadGelcard() def Giaodien(self): fname, filter = QFileDialog.getOpenFileName(self, 'Open File',

To effectively load and display images using OpenCV with PyQt5, the application first checks if a valid file name is provided If a valid image is detected, the `loadImage` function is invoked; otherwise, an "Invalid Image" message is printed The `displayImage` method determines the appropriate QImage format based on the image's shape, supporting both RGB and RGBA formats The image is then converted to a QImage object, ensuring proper color representation with the `rgbSwapped` method Finally, the processed image is displayed in a QLabel, which is centered within the window for optimal viewing The `open_img` function allows users to select an image file through a file dialog, enhancing user interaction.

"Image Files (*)") if fname: self.loadImage(fname) else: print("Invalid Image")

# cv2.destroyAllWindows() def save_img(self): fname, filter = QFileDialog.getSaveFileName(self, 'Save File', 'C:\\', "Image Files

(*.png)") if fname: cv2.imwrite(fname, self.image) # Lưu trữ ảnh print("Error") def AboutMessage(self):

QMessageBox.about(self, "About Qt - Qt Designer",

"Qt is a multiplatform C + + GUI toolkit created and maintained byTrolltech.It provides application developers with all the functionality needed to build applications with state-of-the-art graphical user interfaces.\n"

"Qt is fully object-oriented, easily extensible, and allows true component programming.Read the Whitepaper for a comprehensive technical overview.\n\n"

Since its launch in 1996, Qt has become the foundation for thousands of successful applications globally and serves as the core of the widely-used KDE Linux desktop environment, integral to major Linux distributions For examples of commercial development using Qt, explore our Customer Success Stories.

"Qt is supported on the following platforms:\n\n"

"\tSolaris, HP - UX, Compaq Tru64 UNIX, IBM AIX, SGI IRIX and a wide range of others\n"

"\tEmbedded - - Linux platforms with framebuffer support.\n\n"

"Qt is released in different editions:\n\n"

The Qt Enterprise and Professional Editions are designed for commercial software development, allowing traditional distribution along with free upgrades and technical support For current pricing, visit the Trolltech website or contact their sales team The Enterprise Edition includes additional modules compared to the Professional Edition In contrast, the Qt Open Source Edition is available for Unix/X11, Macintosh, and Embedded Linux, specifically for developing Free and Open Source software, and is offered free of charge under the Q Public License and the GNU General Public License.

QMessageBox.about(self, "About Author", "Lecturer: Assoc Prof Dr Nguyen

"\t Truong Hoang Gia Bao - ID: 16129007" ) def QuestionMessage(self): message = QMessageBox.question(self, "Exit", "Bạn có chắc muốn thoát",

The code snippet demonstrates how to read and process specific regions of interest (ROIs) from an image using OpenCV It defines a method, `ReadGelcard`, that extracts eight ROIs from predefined coordinates, resizes each ROI to half its original size, and converts them to the HSV color space for further analysis The process begins by checking a user's response through a QMessageBox, printing "Yes" or "No" based on the input, and subsequently closing the interface Each ROI is processed sequentially, ensuring efficient handling of image data for potential applications in image recognition or analysis tasks.

To detect red regions in an image using OpenCV, we first define the lower and upper HSV color bounds for red, creating two masks with `cv2.inRange` We combine these masks to isolate red areas and apply a bitwise AND operation to extract the relevant regions The output is then converted to grayscale, followed by thresholding to create a binary image We use a dilation operation to enhance the contours, which are then found using `cv2.findContours` Finally, we count and print the total number of detected contours, storing their locations for further processing.

In the given code, the contours are analyzed using OpenCV to calculate the moments, allowing for the determination of the centroid coordinates (cX, cY) These coordinates are appended to a list called 'locations', which is then sorted based on the x-coordinate The code iterates through each location to assess the y-coordinate, drawing circles on the image based on specific ranges: if the y-coordinate is below 60, it indicates a positive result (4+); between 60 and 70, it indicates (3+); between 70 and 80, it indicates (2+); between 80 and 95, it indicates (1+); and above 95, it signifies a negative result (-) The corresponding results are displayed in a text browser, providing a clear output of the analysis.

To detect red objects in an image using OpenCV, first define the lower and upper HSV color ranges for red Create two masks using these ranges and combine them to isolate red areas in the image Apply a bitwise operation to extract the relevant regions, then convert the result to grayscale Next, threshold the grayscale image to create a binary image and use dilation to enhance the features Finally, find contours in the dilated image, count them, and print the total number of detected contours.

To calculate the centroid of a contour in an image, we use the `cv2.moments` function to obtain the moments, followed by calculating the x and y coordinates (`cX` and `cY`) These coordinates are appended to a list called `locations`, which is then sorted based on the x-coordinate We then iterate through each location, determining the corresponding y-coordinate to classify the result If the y-coordinate is less than 60, a white circle is drawn and the result is labeled as 'Positive (4+)' For y-coordinates between 60 and 70, the label changes to 'Positive (3+)', and similarly for ranges between 70-80 and 80-95, labeled as 'Positive (2+)' and 'Positive (1+)' respectively If the y-coordinate exceeds 95, a black circle is drawn, indicating a 'Negative (-)' result Each classification updates the text display accordingly.

To detect red regions in an image using OpenCV, we define lower and upper HSV color ranges for red, creating two masks with `cv2.inRange` These masks are combined to isolate red areas, and a bitwise operation is applied to extract the relevant portions from the original image The result is converted to grayscale, and a threshold is applied to create a binary image Dilation is then performed to enhance the contours, which are identified using `cv2.findContours` Finally, the total number of detected contours is printed, and their locations are stored for further analysis.

To calculate the centroid of a contour, we use the moments function from OpenCV, extracting the x and y coordinates (cX and cY) These coordinates are appended to a list called locations, which is then sorted based on the x-coordinate We iterate through the sorted locations to determine the state based on the y-coordinate: if it's below 60, we draw a white circle and classify it as 'Positive (4+)'; if it's between 60 and 70, it's 'Positive (3+)'; between 70 and 80, it's 'Positive (2+)'; between 80 and 95, it's 'Positive (1+)'; otherwise, we draw a black circle and classify it as 'Negative (-)' The results are displayed in a text browser accordingly.

To detect red regions in an image, we define two color ranges using HSV values: the first range captures lower red hues, while the second captures higher red hues We create masks for both ranges and combine them to isolate the red areas in the image The resulting masked image is then converted to grayscale, and a threshold is applied to enhance the features We perform dilation to strengthen the contours, which are then extracted using the findContours function Finally, we count the total number of detected contours and print the result, indicating how many red regions were identified.

In the code, moments are calculated from a contour using `cv2.moments`, and the centroid coordinates (cX, cY) are derived from these moments The coordinates are appended to a list called `locations`, which is then sorted based on the x-coordinate The code iterates through each location, determining the y-coordinate to classify the result: if the y-coordinate is less than 60, a circle is drawn, and the result is labeled as 'Positive (4+)'; for y-coordinates between 60 and 70, it's 'Positive (3+)'; between 70 and 80, it's 'Positive (2+)'; between 80 and 95, it's 'Positive (1+)'; and for y-coordinates above 95, it indicates 'Negative (-)' The corresponding classification is displayed in a text browser.

Ngày đăng: 27/11/2021, 15:50

Nguồn tham khảo

Tài liệu tham khảo Loại Chi tiết
[1] Salama Yusuf, “How Were Blood Types Discovered ?”, scienceabc.com, access on 26/10/2020 Sách, tạp chí
Tiêu đề: How Were Blood Types Discovered
[2] Dr Jadhad M. V. “Gel tech”, slideshare.net , Apr 18, 2017 Sách, tạp chí
Tiêu đề: “Gel tech”
[3] Nguyễn Hiền Minh, Phan Thanh Phong, “ỨNG DỤNG XỬ LÝ ẢNH TRONG HỆ THỐNG PHÂN LOẠI SẢN PHẨM”, Graduation thesis in HCMUTE, 6/2019 Sách, tạp chí
Tiêu đề: “ỨNG DỤNG XỬ LÝ ẢNH TRONG HỆ THỐNG PHÂN LOẠI SẢN PHẨM”
[4] Võ Danh Quân, Nguyễn Minh Hảo, “ĐẾM SỐ LƯỢNG VIÊN THUỐC CÓ TRONG VỈ THUỐC”, Graduation thesis in HCMUTE, 12/2019 Sách, tạp chí
Tiêu đề: “ĐẾM SỐ LƯỢNG VIÊN THUỐC CÓ TRONG VỈ THUỐC”
[5] Thiago Carvalho, “Edges and Contours Basics with OpenCV”, pyimagesearch.com , Jul 20, 2020 Sách, tạp chí
Tiêu đề: “Edges and Contours Basics with OpenCV”
[6] Nguyen Thanh Huy, “ỨNG DỤNG PHƯƠNG PHÁP PHÁT HIỆN BIÊN TRONG NHẬN DẠNG CÁC ĐỐI TƯỢNG HÌNH HỌC”, Master thesis in Universiy of Da Nang, 2018 Sách, tạp chí
Tiêu đề: “ỨNG DỤNG PHƯƠNG PHÁP PHÁT HIỆN BIÊN TRONG NHẬN DẠNG CÁC ĐỐI TƯỢNG HÌNH HỌC”
[7] Nguyen Phuc Bao, Nguyen Le Gia Bach , “DESIGN OF AN ACQUISITION IMAGE SYSTEM FOR THE DETECTION OF OCCLUSAL DENTAL PROBLEMS”, Graduation thesis in HCMUTE, 8/2020 Sách, tạp chí
Tiêu đề: “DESIGN OF AN ACQUISITION IMAGE SYSTEM FOR THE DETECTION OF OCCLUSAL DENTAL PROBLEMS”
[8] Lê Hoàng Thành, Hồ Đình Vương, “THIẾT KẾ VÀ THI CÔNG HỆ THỐNG BẢO MẬT ỨNG DỤNG XỬ LÝ ẢNH”, Graduation thesis in HCMUTE, 7/2019 Sách, tạp chí
Tiêu đề: “THIẾT KẾ VÀ THI CÔNG HỆ THỐNG BẢO MẬT ỨNG DỤNG XỬ LÝ ẢNH”
[9] Apogeeweb, “Switching Power Supply Circuit Diagram with Explanation”, apogeeweb.net, 13 Jul 2019 Sách, tạp chí
Tiêu đề: Switching Power Supply Circuit Diagram with Explanation

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

w