You are on page 1of 17

ABSTRACT

Blood type is determined before or during transfusion in emergency situations. It’s necessary to
test a person's blood type for donation. A quick and easy way to make sure one’s have what one
need blood type during surgery or after injury. Can be fatal if given unmatched blood aggregating.
Therefore, certain tests must be performed before transfusion. Blood grouping is one of the pre-
transfusion tests in emergency situations. Microscopy may prove to be inefficient, as it is time
consuming and yields poor results. In addition, professionals are needed. For these reasons, the
evaluation process is becoming increasingly automated. Meaning, software is developed based on
the processing of digital images captured during slide testing. Image processing is implemented
for error-free determination of blood type in emergency situations. Photos of the multiple blood
sample taken is processed, checked for thrombus development, and blood grouped accordingly.
Therefore, this automated technique developed using image processing techniques is useful for
determination of blood type.

1
Index

CHAPTER 1 Introduction 03
1.1 Blood Group 03
1.2 Types of blood groups 03
1.2.1 Blood Group A 04
1.2.2 Blood Group B 04
1.2.3 Blood Group AB 04
1.2.4 Blood Group O 04
1.3 Risk factors 04
1.3.1 Medical Conditions 04
1.3.2 Excessive Bleeding 05
1.3.3 Surgery 05
1.3.4 Fainting or feeling lightheaded 05
1.3.5 Bleeding Under The Skin (Hematoma) 05
1.4 Objectives 05
CHAPTER 2 Background Study 06
2.1 Blood Group detection 06
2.2 Techniques of blood group detection 06
2.2.1 Imaging Techniques 06
2.2.2 Laboratory Tests 06
2.3 Motivation 06
CHAPTER 3 Methodology 07
3.1 Methodology 07
3.2 Flowchart 08
3.3 MATLAB's functions 08
CHAPTER 4 Results, Discussions, and Conclusion 11
4.1 Results 11
4.1.1 Image with sample blood 11
4.2 Discussion 13
4.3 Conclusion 13
References 14
Appendix A 15

2
Chapter 1
Introduction

1.1 Blood Group:

Blood grouping is very important in transfusion. If one have an intolerance during a blood
transfusion, it can be lethal and can cause venous clotting of the patient's blood. Antigens on red
blood cells in blood of the blood recipients can be attacked by antibodies formed in the blood due
to intolerance. Since there are no antibodies in the blood of people with blood type O, people with
blood type O can safely donate blood. Similarly, a person with blood type AB may also experience
symptoms. Therefore, a person with her O-ve blood type is a universal donor. On the other hand,
people with blood type AB +ve are universal recipients. Development of blood grouping is done
using image processing technology. Three blood samples, each mixed with a reagent, are taken on
a slide. Anti-A, anti-B and anti-D respectively. Aggregation occurs after some time and the results
are interpreted accordingly occurrence of aggregation. Agglutination is a reaction between
antibody and antigen that indicates the presence of a particular antigen. The occurrence of
coagulation determines the blood group, enables the detection of hemagglutination with MATLAB
software based image processing technology. Slide images captured after mixing specific
reagents. [1].

1.2 Types of blood groups:

There are 4 types of blood groups. They are [2]:

1.2.1 Blood Group A:

Blood group A individuals have the A antigen on the surface of their RBCs, and blood serum
containing IgM antibodies against the B antigen. Therefore, a group A individual can receive blood
only from individuals of groups A or O (with A being preferable), and can donate blood to
individuals with type A or AB.

3
1.2.2 Blood Group B:

Blood group B individuals have the B antigen on the surface of their RBCs, and blood serum
containing IgM antibodies against the A antigen. Therefore, a group B individual can receive blood
only from individuals of groups B or O (with B being preferable), and can donate blood to
individuals with type B or AB.

1.2.3 Blood Group AB:

Blood group AB individuals have both A and B antigens on the surface of their RBCs, and their
blood plasma does not contain any antibodies against either A or B antigen. Therefore, an
individual with type AB blood can receive blood from any group (with AB being preferable), but
cannot donate blood to any group other than AB. They are known as universal recipients.

1.2.4 Blood Group O:

O negative is the most common blood type used for transfusions when the blood type is unknown.
This is why it is used most often in cases of trauma, emergency, surgery and any situation where
blood type is unknown. O negative is the universal blood type. O negative blood type can only
receive O negative blood. O negative donors who are CMV negative are known as Heroes for
Babies at the Red Cross because it is the safest blood for transfusions for immune deficient
newborns.

Risk factors:

Factors that increase the risk of developing blood grouping include [3]:

1.3.1 Medical Conditions:

It may seem obvious that our blood type is related to our heart, since heart pumps blood to the rest
of the body. But the blood type can actually put at a higher risk for conditions such as heart attack
and heart disease. This is because of a gene called the ABO gene — a gene that’s present in people
with A, B, or AB blood types. The only blood type that doesn’t have this gene is Type O.

If one have the ABO gene and one live in an area with high pollution levels, one may be at a greater
risk of heart attack than those who don’t have the gene.

4
1.3.2 Excessive Bleeding:

A partial thromboplastin time (PTT) test, also called an activated PTT (aPTT), measures how long
it takes blood to clot. It can help determine whether certain clotting factors are involved. A
prothrombin time (PT) test is another test that measures how long it takes blood to clot.

1.3.3 Surgery:

Blood typing is a fast and easy way to ensure that one receive the right kind of blood during surgery
or after an injury. If one are given incompatible blood, it can lead to blood clumping, or
agglutination, which can be fatal.

1.3.4 Fainting or Feeling Lightheaded:

Because a few ml blood is needed to out from the body, one can feel fainting or lightheaded
during/after the procedure.

1.3.5 Bleeding Under the Skin (Hematoma):

A hematoma is usually caused by a broken blood vessel that was damaged by surgery or an injury.
It can occur anywhere in the body, including the brain.

1.4 Objectives:

There are a few tests that must be run before the blood transfusion. Blood type analysis is one of
these examinations. There are several emergencies where giving blood right away is required to
avoid endangering the patient's life. The currently available tests call for moving the lab, may not
give enough time to identify the blood type, and administer blood type O negative, which is
considered to be a universal donor and hence poses a lower risk of incompatibility. Nevertheless,
even though there is a small chance that an incompatibility may result in the patient's death, it is
nevertheless important to avoid them. Therefore, it would be excellent to know the patient's blood
type. Second, technicians do the pre-transfusion tests, which increases the risk of human mistakes.

5
Chapter 2
Background Study

2.1 Blood Group detection:


Blood grouping refers to identifying the ABO blood group of one person. [4].

2.2 Techniques of blood group detection:

There are various Techniques used for blood group detection, including [4]:

2.2.1 Imaging Techniques:

Rapid and accurate determine of blood types is very important during emergency situation before
administering a blood transfusion. At present the method based on image recognition technology
to quickly determine blood type has been widely used in the automated blood analyzer. It’s the
fastest, accurate and robust blood group judgement method based on the image features of ABO
blood group rapid analyzer.

2.2.2 Laboratory Tests:

A blood sample is needed. The test to determine one’s blood group is called ABO typing. The
blood sample is mixed with antibodies against type A and B blood. Then, the sample is checked
to see whether or not the blood cells stick together. If blood cells stick together, it means the blood
reacted with one of the antibodies. According to the agglutination, the blood type is defined.

2.3 Motivation:

The most important reason to know your blood type is in case of an emergency. If one is in a
situation where one require a blood transfusion, one will need compatible blood. An incompatible
blood group can cause blood cells to clump—which can be fatal. One of the best, and most selfless,
reasons to know one’s blood type is to help others through blood donations. Medical facilities are
always in need of blood donations, whether you are O or A.

6
Chapter 3
Methodology

3.1 Methodology:

Steps for detecting blood group by image processing technique:

1. Input Image: Obtain the input for detection.


2. Convert into Grayscale Image: Convert the input image from color to grayscale. This can
be achieved using MATLAB's built-in functions or by extracting the intensity channel of
the image. Grayscale conversion simplifies subsequent processing steps by reducing the
image to a single channel.
3. Image Noise Removal: Gray image is processed to noise removed.
4. Segmentized: The preprocessed image was then segmentized.
5. Edge Detection & Counting: Using canny edge detection technique, the edge detection has
been performed on the blood samples. The number of edge then has been counted.
6. Intensity adjust and filtering for feature extraction: The intensity of the photo has been
adjusted and wiener filter is implemented for feature extraction like mean and standard
deviation.
7. Apply Median Filter: Apply a median filter to the grayscale image to reduce salt-and-
pepper noise while preserving edges. The median filter replaces each pixel value with the
median value of its neighborhood, effectively reducing the impact of outliers.
8. Thresholding: Apply thresholding techniques on the number of edges to detect the blood
group of the test sample.

7
3.2 Flowchart:

Fig 3.1: Flowchart for blood grouping using canny edge detection.

3.3 MATLAB's functions:

Details of a few MATLAB functions are provided below [5].

1. rgb2gray ():

I = rgb2gray(RGB) converts the truecolor image RGB to the grayscale intensity image I. The
rgb2gray function converts RGB images to grayscale by eliminating the hue and saturation
information while retaining the luminance. If you have Parallel Computing Toolbox™ installed,
rgb2gray can perform this conversion on a GPU.

example

newmap = rgb2gray(map) returns a grayscale colormap equivalent to map.

8
2. medfilt2 ():

J = medfilt2(I) performs median filtering of the image I in two dimensions. Each output pixel
contains the median value in a 3-by-3 neighborhood around the corresponding pixel in the input
image.

You optionally can compute the normalized cross-correlation using a GPU (requires Parallel
Computing Toolbox™). For more information, see Image Processing on a GPU.

J = medfilt2(I,[m n]) performs median filtering, where each output pixel contains the median value
in the m-by-n neighborhood around the corresponding pixel in the input image.

3. multithresh ():

thresh = multithresh(A) returns the single threshold value thresh computed for image A using
Otsu’s method. You can use thresh as an input argument to imquantize to convert an image into a
two-level image.

example

thresh = multithresh(A,N) returns thresh a 1-by-N vector containing N threshold values using
Otsu’s method. You can use thresh as an input argument to imquantize to convert image A into an
image with N + 1 discrete levels.

example

[thresh,metric] = multithresh(___) returns metric, a measure of the effectiveness of the computed


thresholds. metric is in the range [0 1] and a higher value indicates greater effectiveness of the
thresholds in separating the input image into N + 1 regions based on Otsu's objective criterion.

4. edge ()

Classification edge

Syntax

E = edge(obj,X,Y)

E = edge(obj,X,Y,Name,Value)

9
Description

E = edge(obj,X,Y) returns the classification edge for obj with data X and classification Y.

E = edge(obj,X,Y,Name,Value) computes the edge with additional options specified by one or


more Name,Value pair arguments.

5. imdilate():

J = imdilate(I,SE) dilates the grayscale, binary, or packed binary image I, returning the dilated
image, J. SE is a structuring element object or array of structuring element objects, returned by the
strel or offsetstrel functions.

You optionally can perform the dilation using a GPU (requires Parallel Computing Toolbox™).
For more information, see Image Processing on a GPU.

J = imdilate(I,nhood) dilates the image I, where nhood is a matrix of 0s and 1s that specifies the
structuring element neighborhood. imdilate determines the center element of the neighborhood by
floor((size(nhood)+1)/2).

This syntax is equivalent to imdilate(I,strel(nhood))

6. imclearborder ():

J = imclearborder(I) suppresses structures in image I that are lighter than their surroundings and
that are connected to the image border. Use this function to clear the image border. For grayscale
images, imclearborder tends to reduce the overall intensity level in addition to suppressing border
structures. The output image, J, is grayscale or binary, depending on the input.

7. strel ():

SE = strel('diamond',r) creates a diamond-shaped structuring element, where r specifies the


distance from the structuring element origin to the points of the diamond.

example

10
SE = strel('disk',r,n) creates a disk-shaped structuring element, where r specifies the radius. n
specifies the number of line structuring elements used to approximate the disk shape.
Morphological operations using disk approximations run much faster when the structuring element
uses approximations.

example

SE = strel('line',len,deg) creates a linear structuring element that is symmetric with respect to the
neighborhood center. deg specifies the angle (in degrees) of the line as measured in a
counterclockwise direction from the horizontal axis. len is approximately the distance between the
centers of the structuring element members at opposite ends of the line.

8. Wiener ():

J = wiener2(I,[m n],noise) filters the grayscale image I using a pixel-wise adaptive low-pass
Wiener filter. [m n] specifies the size (m-by-n) of the neighborhood used to estimate the local
image mean and standard deviation. The additive noise (Gaussian white noise) power is assumed
to be noise.

The input image has been degraded by constant power additive noise. wiener2 uses a pixelwise
adaptive Wiener method based on statistics estimated from a local neighborhood of each pixel.

Chapter 4
Results, Discussions, and Conclusion

4.1 Results:

4.1 Image with sample blood:

Fig 4.1: Input Image. Fig 4.2: Image after RGB to gray conversion.

11
Fig 4.3: Image after noise removal. Fig 4.4: Image after segmentation.

Fig 4.5: Image after preprocessing using Fig 4.6: Image after applying the final edge
canny edge detection. detection & counting.

Fig 4.7: After counting edges and thresholding,


the blood type has been determined

Output:

O+ Blood Group

12
4.2 Discussion:
The method developed proves that it is effective and efficient method to detect the agglutination
and determines the blood type of the patient accurately. The use of image processing techniques
enables automatic detection of agglutination and determines the blood type of the patient in a short
interval of time also helpful in emergency situations. In future it is intended to improve the system
developed by making it smaller so that it can be portable and incorporate GSM technology, to send
a message to the mobile of technician of the laboratory in order to avoid unnecessary travel.

4.3 Conclusion:
A fast, accurate and robust blood group judgment method is proposed for the rapid and accurate
identification of blood types in the case of emergency transfusion. A large number of experiments
show that this method can quickly and accurately identify whether the serum and antibody
agglutination reaction, and then get blood type determination, to meet the needs of automated rapid
blood type analyzer.

13
References
[1] "What Are Blood Tests?" National Heart, Lung, and Blood Institute (NHLBn, [Online].
Available:
http://www.nhlbi.nih.gov/healthlhealth-topics/topics/bdtl. [Accessed 22 May 2023].
[2] Determination of Blood group using Image Based Canny Edge Detection Technique
Mr. Amol Kadam1, Ms. Pratiksha Kulkarni2, Ms. Samiksha Korake3, Ms,Rupali Pawar
[3] Blood Grouping Principle And Procedure (microbiologynote.com)
[4] Blood Typing: Purpose, Procedure, and Risks (healthline.com)
[5] ‘MATLAB Documentation’. https://www.mathworks.com/help/matlab/ (accessed May
22, 2023).

14
Appendix A

Code:

clc
clear all
A = imread('oplus.jpg');
imshow(A)
title('Input Image');

Gray Conversion
a=rgb2gray(A);
imshow(a);
title('Gray conversion Image');
%%Image Noise Removal
c=medfilt2(a);
imshow(c);
title('Preprocessed Image');
%%segmentation
level = multithresh(c);
seg_I = imquantize(c,level);
imshow(seg_I,[])
%%edgedetection & counting
b=edge(seg_I,'canny',.57);
se90 = strel('line', 3, 90);
se0 = strel('line', 3, 0);
BWs = imdilate(b, [se90 se0]);
figure, imshow(BWs), title('dilated gradient mask');
BWdfill = imfill(BWs, 'holes');
figure, imshow(BWdfill);
title('binary image with filled holes');
BWnobord = imclearborder(BWdfill, 4);

15
figure, imshow(BWnobord), title('cleared border image');
seD = strel('diamond',1);
BWfinal = imerode(BWnobord,seD);
BWfinal = imerode(BWfinal,seD);
imshow(BWfinal), title('segmented image');
BWoutline = bwperim(BWfinal);
Segout = A;
Segout(BWoutline) = 255;
imshow(Segout), title('outlined original image');
s=edge(BWfinal,'canny');
imshow(s)
GA1=s(1:600,1:600);
GB1=s(1:600,901:1500);
Rh1=s(1:600,1901:2500);
A1 = digraph(GA1)
B1 = digraph(GB1)
R1 = digraph(Rh1)
h1 = A1.Edges
GA = height(h1)
h2 = B1.Edges
GB = height(h2)
h3 = R1.Edges
Rh = height(h3)
imshow(GA1)
imshow(GB1)
imshow(Rh1)
%% Intensity adjust and filtering
C=imadjust(a);
x=wiener2(a);
imshow(C);
imshow(x);

16
title('Illuminance Plane');
%% Feature Extraction

im1=C;
su=mean2(im1);
mean=ceil(su);
disp('mean Value');
disp(mean)
st=std2(im1);
h=ceil(st);
disp('standard Deviation');
disp(h)

Determine Blood Group Dispalying Results


if(GA>=2500 && GB<=2500 && Rh<=2500)
msgbox('A- Blood Group')
elseif(GA>=2500 && GB<=2500 && Rh>=2500)
msgbox('A+ Blood Group')
elseif(GA>=2500 && GB>=2500 && Rh<=2500)
msgbox('AB- Blood Group')
elseif(GA>=2500 && GB>=2500 && Rh>=2500)
msgbox('AB+ Blood Group')
elseif(GA<=2500 && GB>=2500 && Rh>=2500)
msgbox('B+ Blood Group')
elseif(GA<=2500 && GB>=2500 && Rh<=2500)
msgbox('B- Blood Group')
elseif(GA<=2500 && GB<=2500 && Rh>=2500)
msgbox('O+ Blood Group')
elseif(GA<=2500 && GB<=2500 && Rh<=2500)
msgbox('O- Blood Group')
end

17

You might also like