|Intelligent Automation & Soft Computing |
Blood Group Classification System Based on Image Processing Techniques
Department of Computer Science, Faculty of Specific Education, Mansoura, Egypt
*Corresponding Author: S. A. Shaban. Email: email@example.com
Received: 15 April 2021; Accepted: 23 June 2021
Abstract: The present paper proposes a novel system that automatically classifies the eight different blood groups according to the ABO and Rh blood group systems. The proposed system is developed by applying MATLAB’s image processing techniques on the blood sample images. These images are acquired from the laboratory using the slide test. It utilizes a mean filter for removing noise from blood sample images. In addition, the Contrast Limited Adaptive Histogram Equalization (CLAHE) is used for enhancing the image characteristics analysis. The proposed system also utilizes the automated threshold strategy (Otsu’s approach) for obtaining the blood samples binary images. Since, adding the three antigens (A, B, D) to the blood samples works on clumping the samples or not, and this, in turn, works on the variation number of objects and holes in the different blood groups’ samples. Therefore, the “Bwboundaries” Matlab function is applied for the first time in the proposed system to count the number of objects and holes for blood group classification. The database used in the proposed system consists of 600 images collected from different laboratories. The suggested system has many advantages such as simplicity, speeding up processing time, reducing human interference and errors, decreasing the risk of transfusion reactions, and high accuracy, even in remote places. As well, it can be used by a lab technician or any user who doesn’t have any previous knowledge of the blood group detection technique. In addition to using this system to assist in several applications such as premarital tests, blood transfusion as well as paternity tests.
Keywords: ABO blood system; premarital tests; blood transfusion; paternity tests; image processing technology; mean filter; CLAHE; Otsu’s approach; “Bwboundaries” Matlab function
There are various kinds of blood group. The main two basic types are the ABO blood system and the Rhesus blood system. The most critical system in human blood transfusion is the ABO blood system. It was created by Austria's Rand Steiner at the beginning of 19 century . There are eight distinct blood groups according to the ABO and Rh blood group systems. These are A Rh+, A Rh−, B Rh+, B Rh−, AB Rh+, AB Rh−, O Rh+, and O Rh− . Blood classification is a manual process performed by laboratory technicians in laboratories and achieved by glass slide checking. First, Antigen-A, Antigen-B, Antigen-D are mixed into the blood sample of an individual. These antigens may or may not be combined with red blood cell antibodies from a specific blood group. Then, the technician scans for blood cell clumps. For e.g., if clumps are found in antigen-A added and Antigen-D added samples, the blood group is known as an A-positive blood type. The category is known as A− Negative if clumps are detected only in samples added with Antigen-A .
Blood group knowing and understanding are very important nowadays for many critical tasks such as premarital testing, blood transfusion, donation, organ transplantation, accidents, parental disputes, and other emergency situations . A premarital test is described by a series of laboratory and clinical tests that are offered to both spouses prior to marriage . It includes clinical assessment for family, barrenness, and laboratory tests such as blood count, blood type, the rate of hemoglobin, rhesus factor, functions of liver and kidney, HIV testing, male semen testing . It also reduces the risk of children developing a disorder. This is done by alerting the spouses to the need for treatment or by helping them determine whether pregnancy should be prevented in the face of the high probability of an abnormality or not . There is a fact that says that there is no harm in marrying a man or woman of a different blood type, the damage occurs when both have a different Rh element . If D antigen is in the red blood cells, the person has a positive Rh. If there is an absence of D antigen in the red blood cells, Rh is negative [9,10].
In Rh-negative women with Rh-positive children (Rh blood incompatibility), health issues do not arise during the first pregnancy. This is because there is not a possibility for the wife's body to produce a lot of antibodies. On the other hand, if treatment is not presented during the first pregnancy and the wife becomes pregnant with Rh-positive child again, more antibodies will be made. More antibodies pose a danger to the second pregnancy [11,12].
Blood transfusion is a lifesaving way that rescues a huge number of people yearly. About 81 million blood units are usually donated annually. It requires accurate matching of blood types to prevent significant adverse effects [13,14]. It is well recognized that if anyone requires a blood transfusion, it is risky for him/her to receive a differing blood type due that the blood can contain antigens that his/her antibodies can attack this may lead to the sudden death of the patient .
The ABO blood group has been used for personal identification and paternity test in forensic medicine and criminal investigations for many years. It cannot prove paternity, but it can definitely rule out a suspected parent as a candidate, this is because the baby must inherit his blood type from his parents. Thus, if the blood group of the child differs from the blood type of the mother and the alleged father, then the man cannot be the father of the child [16,17]. For instance, if the child is in group A, and the mother and the putative father are in the group (O), the man is banished from paternity.
The manual technique for blood group detection has undesirable disadvantages with increasing the sample number and in case of disasters such as slowness, inaccurate typing in the reports as it bases on the skills and fatigue of the operator. Thus, the use of automatic procedures decreases the influence of human mistakes in laboratories and increases the efficiency of the findings obtained [18,19].
Due to the exponential development of image processing technology, including image detection, interpretation, and enhancement, medical imaging is evolving rapidly. Consequently, the time and the efforts used by people in the medical field have decreased . A closer look at the researches that are based on image processing, many types of research have been found in face recognition, fingerprint recognition, iris recognition, etc., but little has been done in blood group identification. In recent years, the development of automatic recognition systems dependent on computer vision technologies has become a vital need in the area of blood group detection . Based on the above, an impeccable operation justified by empirical and statistical measurements and perfect image analysis is required to identify the blood group.
2 Related Work
Few papers have been suggested methods in order to identify the blood groups. An adaptive method of Hough transform techniques has presented to analyze blood samples by Keerthana et al. . Image processing techniques such as thresholding, morphological operations, attribute extraction by Scale-Invariant Feature Transform (SIFT) algorithm, and classification using Support Vector Machine (SVM) have proposed for the identification of blood group by Pathan et al. . The attributes of standard deviation, histogram, Histogram of Oriented Gradients, and fast Fourier transform have calculated for different regions of interest to use as inputs for SVM and Decision Trees classifiers for blood type classification by Ferraz et al. . Gray Level Co-occurrence Matrix (GLCM) approach for the extraction of feature matrix, also SVM, Decision Tree, and Linear Discriminate Analyzer (LDA) classifiers have been used for determination of blood samples group by Jogi et al. . Different attributes like (contrast, correlation, energy, homogeneity, mean, standard deviation, entropy, Root Mean Square (RMS), variance, smoothness, kurtosis, skewness, and GLCM) and SVM classifier have used to identify different blood groups by Gurav et al. . A blood group testing framework depended on Field Programmable Gate Arrays (FPGA) has been evolved utilizing Verilog Hardware Description Language (HDL) by Noorbasha et al. . Different systems have been reviewed and their outputs evaluated to detect the class of blood sample using MATLAB calculations to assist researchers in their work by Jogi et al. . The image processing techniques such as Region of Interest (RoI), image cropping, grey-scale segmentation, contouring or edge-detection techniques, and HSL (hue, saturation, lightness) average value have used to the patient’s blood type in a short time by Sathiyan et al. . A survey on recent advances made for the detection of blood group based on different techniques, like thresholding, histogram, and cluster conditions has been presented by Pavithra . Morphological operations have used for classifying the blood regions based on statistical features such as area, shape, size of the segmented regions by Danti et al. . The following techniques for image processing: preprocessing, Grayscale image, image segmentation, feature extraction, and classification have applied to detect blood groups for more than one person at a single stretch in a short time by Banu et al. . Image processing techniques like thresholding, morphological operations, HSL Luminance plane, and quantification have used for blood group identification by Ravindran et al. .
3 The Proposed System Description
The proposed system consists of two basic stages for determining the blood group. These stages are preprocessing stage for preparing blood samples and image processing techniques for the classification of the blood samples. Fig. 1 shows the proposed system flowchart for blood group detection and uses it in different applications. Below is a detailed explanation of the flowchart of the proposed system.
3.1 Preprocessing Stage for Preparing Blood Sample
At this stage, a set of steps are applied in order to obtain an image of the blood sample in preparation for its entry to the next stage. A detailed explanation of these steps is as follows:
3.1.1 Providing a Glass Slide
A clean microscopic slide is brought up which called a glass slide. Whereas, slide testing is relatively the least sensitive procedure, among other things for determining blood group. But due to its rapid results, it is very useful in an emergency situation .
3.1.2 Mixing Blood Sample with Antigens (A, B and D)
A drop of antisera A, B, and D are put on the left, middle and right portions of the glass slide respectively. The color of Anti-A is blue, yellow for Anti-B, and transparent for Anti-D. These antigens are added with a dropper. Also, the finger is wiped with alcohol and softly rubbed next to the fingertip. Next, the tip of the finger is pricked with a scalpel, and the first drop of blood is wiped. When the blood starts to bleed, it falls on three antigens on the glass slide. After that, the blood sample is mixed with the three antigens.
3.1.3 Waiting for Blood Cell Clumps
The blood sample is left for a little while to see if the blood cells are sticking together (clumping). If blood cells stick to one another, this means that the blood has reacted with an antibody.
3.1.4 Taking Image for the Blood Sample
An image of the blood sample in the glass slide is captured using a USB Camera (Samsung ES65). USB 2.0 or USB 3.0 technology is used to transfer image files. USB cameras are designed to connect conveniently with dedicated computer systems that use the same USB technology.
3.2 Image Processing Techniques for Classification of the Blood Sample
The image of the blood sample captured from the USB camera is processed utilizing different image processing techniques. The detailed analysis of these techniques is as follows:
3.2.1 Splitting the Image to Three Parts Equally
Since the three parts (A, B, RH factor) are located on the left, center, and right of the slide, the blood sample image on the slide is divided vertically into three parts evenly. This is done based on the number of columns in the image. The number of columns is obtained using the “size” function in Matlab. The image of the blood sample is divided into three parts as follows in Eqs. (1)–(3):
Here, N is the number of columns for the blood sample image and A is N divided by 3.
3.2.2 Resizing the Image
The major aim of resizing the image is to adaptively resize the image to obtain an ideal display under different conditions. Also, for smaller data size and making the processing time faster [35,36]. It is done using “imresize” Matlab function and the size used is 256 × 256 pixels.
3.2.3 Filtering the Image
Image filter methods are applied to images to remove various types of noise that may have been present in the image during capture or transfer . Here, the noise is removed with an average or (mean) filter. This filter operates by replacing every pixel value in an image with the mean value of its neighbors, including itself. This has the effect of removing pixel values that are not representative of their surroundings. Measuring the mean is dependent on a kernel, which represents the form and scale of the neighborhood to be sampled [38,39]. Kernels of (5 × 5 squares) are used in the proposed system. This is done using “imfilter” Matlab function .
3.2.4 Converting the Image to Gray
Since color image processing is mathematically high, most applications use grayscale or binary images . Grayscale is a set of shades of gray with no visible color. The darkest possible shade is black and the lightest possible shade is white . Here, converting the blood sample color image to gray is achieved using “rgb2gray” Matlab function .
3.2.5 Enhancing the Image
Image enhancement is a widely used technique to enhancing certain characteristics of an image in order to increase its visual quality and to aid in further image analysis. CLAHE is the tool used in the proposed system for contrast enhancement. This method divides the image into different sub-images (tiles) and calculates the corresponding histogram for different parts of the image . However, before the Cumulative Distribution Function (CDF) is computed, the histogram clips to the predefined values to limit the amplification. The overflow created by the clipped bins is redistributed over the histogram of that tile . Here, this is applied using the Matlab function called “adapthisteq” .
3.2.6 Converting the Image into a Binary and Finding its Complement
Otsu’s approach is the automated threshold strategy used in the proposed system. This is achieved using the “graythresh” Matlab function that calculates the global threshold T of the grayscale image . It computes the optimal threshold that separates the two-pixel classes; foreground (black) and background (white) such that the difference between the two is small . With the Matlab “imbinarize” function, the global threshold T can be used to convert a grayscale image into a binary image . In the complement of the binary image, the zeros become the ones and the ones turn into zeros; black and white are reversed. Here, this is done using Matlab function called “imcomplement” .
3.2.7 Smoothing Edge of the Binary Image
Smoothing the edge of the image helps guide the computer to retrieve images more accurately. The “conv2” function in MATLAB is used to execute this task in the proposed system. It convolves 2-D data with a specified kernel whose items determine how to remove or enhance attributes of the original data .
3.2.8 Removing of Small Objects in the Binary Image
In the proposed system, the “Bwareaopen” Matlab function is used to remove small objects from the binary image. This function removes all connected components (objects) that are less than P pixels, resulting in another binary image .
3.2.9 Counting the Number of Objects and Holes
Since the “Bwboundaries” Matlab function is not used in most research in determining blood groups, it has been used here in this research for the first time. It traces the outlines of objects, as well as the boundaries of holes within these objects, in the binary images. It also gets down to outside things (parents) and keeps track of their children (things parents totally surround it). These components are illustrated in Fig. 2 .
The general form of the function is [B, L] = Bwboundaries (BW, conn, options). Here, “BW” is the binary image. The value of “conn” in the proposed system is “8-connected” which represents pixel connectivity. In it, pixels are connected if their edges or corners touch. Two adjoining pixels are part of the same object if they are both on and are connected along the horizontal, vertical, or diagonal direction. The value of “options” in the proposed system is “holes” which used to search for both object and hole boundaries. B is a cell array of boundary pixel locations. L is a label matrix in which objects and holes are labeled. L is a two-dimensional array of nonnegative integers that represent contiguous regions. The number of objects and holes represented by L is equal to max (L (:)). Also, the number of objects and holes represented by B is equal to Length (B).
3.2.10 Classification of the Blood Sample Image
The blood sample image is classified based on the number of objects (parent and child) and holes in the three-segmented parts (A, B, RH factor). By looking at the numerous tests performed, it is verified that if the number of objects and holes is less than or equal to 4, the image is classified as a “non-agglutinated” image. If the number of objects and holes is greater than 4, the image is classified as “agglutinated”. Tab. 1 shows the detection of the blood sample group according to the proposed system.
3.3 Using the Obtained Blood Group in Many Applications
At this stage, a set of steps are required for using the obtained blood type in many applications. The following is an explanation of these steps:
3.3.1 Identification of the User’s Application for the Blood Group
After determining the blood group, it can be used in many applications. The proposed system addresses three applications: pre-marital tests, blood transfusion, and paternity tests.
3.3.2 Using the Chosen Application Rules
In premarital tests, it is determined whether there is compatibility between the male and the female or not based on the rules in Tab. 2.
In the process of blood transfusion, it is decided whether any blood group is permitted to give or receive from another or not based on the rules in Tab. 3.
In the paternity tests, it is decided whether this child is the son of the father and the mother according to their blood groups, based on the rules in Tab. 4.
3.3.3 Printing the Chosen Application Report
After applying the rules for the chosen blood group application, a medical report is extracted in Word. This report shows whether there is compatibility between the spouses in the case of pre-marital tests, blood transfusion is allowed or not in the case of blood transfusion and the father is the father of the child or not in the case of paternity tests.
4 Application and Experimental Results
The database used in the proposed system consists of 600 images taken from blood samples tested in the laboratory, with 75 images taken for each blood group. The proposed system for blood group applications was designed using the MATLAB language (R2018b). The proposed system Graphical User Interface (GUI) is shown in Fig. 3. The button of the chosen blood group application is pressed to enter its application.
Fig. 4 shows the GUI for premarital tests application. First, the “Select Blood Sample” buttons are pressed to enter the blood sample images for both male and female. Then, click on the “Detect Blood Group” buttons to detect blood groups for the male and the female. Finally, the final report is printed by clicking the “Print Report” as shown in Fig. 5.
Fig. 6 shows the GUI for blood transfusion application and its final report appears in Fig. 7.
Fig. 8 shows the GUI for paternity tests application and its final report appears in Fig. 9.
For testing purposes, the results of 200 images of the proposed system were taken and compared with the laboratory results. Tab. 5 displays the results of some images obtained from the laboratory and the classification of the proposed system.
The confusion matrix is applied to evaluate the performance of classifiers in datasets. It is used to distinguish between expected and real values of model elements in software engineering . The confusion matrix has four outcomes [58,59]:
• True Positives (TP): are positive items correctly classified as positive.
• True Negatives (TN): are negative items correctly identified as negatives.
• False Positives (FP): are negative items classified as positive.
• False Negatives (FN): are positives items classified as negative. Fig. 10 and Tab. 6 show confusion matrix statistical measures for the 200 tested images.
Blood type is a way to find out what type of blood a person has. It is very helpful in cases of blood transfusion, blood donation, accidents, and other emergencies. This paper presents an innovative approach based on image processing techniques for accurate, rapid, and safe detection of blood groups. Images of blood samples are filtered using the mean filter and are enhanced using CLAHE. Classification is done based on the “Bwboundaries” Matlab function that uses here for the first time. This function is a very appropriate to distinguish between the form of clumping or not that occurs in the blood sample images as it counts the number of objects and holes in it. The proposed system also extends to present applications that depend on blood groups, such as pre-marital tests, paternity tests on the basis of the mother’s and father’s blood group, as well as blood groups that are given and received during the blood transfusion. The suggested user interfaces are easy to use and display step-by-step blood group detection and use in the different applications. The proposed system has achieved a high accuracy reached to 98% when compared with manual results which prove that it is an efficient and reliable system.
Funding Statement: The authors received no specific funding for this study.
Conflicts of Interest: The authors declare that they have no conflicts of interest to report regarding the present study.
|This work is licensed under a Creative Commons Attribution 4.0 International License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.|