.st0{fill:#FFFFFF;}

RBC and WBC Blood Cell Counter using Circular Hough Transform 

 June 14, 2019

By  Ceethal Piyus

Cover picture : RBC and WBC Blood Cell Counter

Introduction

What would healthcare look like if you could determine your blood cell count as quickly and inexpensively as your body temperature? At MATLAB Helper®, we are excited by this possibility and believe that such a future is within sight, thanks to MATLAB Image processing and segmentation techniques!

This blog will demonstrate a simple example of how image processing and segmentation techniques can classify and estimate blood cell count.

The proposed model will segment white blood cells (WBC) and Red blood cells (RBC) and it will count them despite they are overlapped or not, by using an algorithm called Circular Hough transform. 

Before entering into the algorithm, let's see why this is a fascinating problem space in the first place!

Estimation of Blood Cells and why they’re crucial?

A microscopic image of the blood smear is often used to categorize and identify disease conditions that can affect blood cells and to track down those who seek treatment for these conditions. There are many diseases that can affect the count and type of blood cells produced, their function, and their lifespan. Examples include bone marrow disorders, anemia, and leukemia. So understanding the count of Blood Cells in our bloodstream can give us a powerful picture of our health.

Disease affecting Blood cell counts

Fig1: Examples of disease conditions that affects Blood cell counts

Old conventional method using Hemocytometer and microscope are involving manual counting of blood, which are extremely laborious, time-consuming, and leads to inaccurate results due to human errors. Also, there are some expensive machines like Analyzer, which are not affordable by every laboratory. The proposed method that we will be covering through the rest of this blog is a potentially promising advancement over such techniques due to the following reasons:

  • Instantaneous results
  • Low cost
  • Accurate
  • less human interactions

Now that we have the necessary background, let’s jump into our particular problem and analyze the dataset, methodology, and results of our method.

Problem: 

Given a stained image of a blood smear sample, classify it as either RBC or WBC and estimate it’s count despite its overlapped or not.

RBC WBC segmentation Image

Fig 2: Expected outcome

  •  

Dataset

The project was fully implemented in MATLAB; the main advantage of this algorithm is that the model does not require training for segmentation. Image segmentation steps are followed for identifying RBC and WBC present in the sample, so it works for the segmentation in smaller data sets. The dataset is composed of a dyed blood sample with overlapped and not overlapped cells. Each image is in PNG format, which is of 440 x 440 pixels size.

Blood smear samples

Fig 3: Blood smear samples used in our dataset

Prerequisites required

  • MATLAB App designer and Image processing toolbox
  • Blood smear samples

Graphical User Interface

For creating the graphical user interface, watch the video given  below!

Graphical user interface design using MATLAB app designer tool box

Fig 4: Graphical user interface design using MATLAB app designer tool box

Algorithm Design

The main criterias considered in this method for segmenting RBC and WBC are its shape and size, normally the RBC’s are having a shape similar to circular shape and WBC’s are irregular in shape. Regarding the size, WBC’s are larger than RBCs. So keeping this in mind we are going to create an algorithm to segment RBC and WBC from the blood sample. The whole algorithm can be summarized as follows:

Algorithm design

Fig 5: Algorithm design

Results

Step1: Image acquisition and Pre-processing

Step2: Segmentation of WBC’s and RBC’s

Step 3: Segmentation of WBC

Step 4: Counting of WBC

Step 5: Segmentation of RBC

Step 6: Circular Hough transform for counting overlapped RBC’s

Conclusion

We hope the results and methodology shared here provide an overview of how promising image processing and segmentation tools are in the field of cell imaging and classification.
As you can see in the picture below, this algorithm was even successful in three overlapping areas for counting the RBC.

Overlapped cells identified through Circular Hough Transform

Fig 18: Overlapped cells identified through Circular Hough Transform

In certain cases the stains are misclassified as cells but, this algorithm differentiates the stains from RBC cells based on its circular shape and counts only the RBC’s.

Correctly predicted RBC cells by eliminating stain issues

Fig 19: Correctly predicted RBC cells by eliminating stain issues

The model and problem statement discussed in this blog are simple, and we believe that they can be extended to more complex issues with multiple classes, new cell types and more varying illumination conditions. We encourage you to extend this code not only for WBCs and RBCs but also a wide variety of other cells such as platelets, sickle cells, and even acanthocytes. If you have any queries regarding the algorithm or if you stuck with your code, you can type them in the comment section below and we will help you with that 🙂 !

If you have any requirement similar to this and you are looking for expert's help, do send the email with necessary attachment at [email protected]

Limitations

Reference:

Watch the video below for the full code and try to replicate all the results yourself 🙂 


Get Standalone Application of Webinar

This Standalone has been created using MATLAB R2018b. Get the application running and start exploring RBC and WBC Blood Cell Counting.

Standalone Application Installation Steps

Did you find some helpful content from our video or article and now looking for its code, model, or application? You can purchase the specific Title, if available, and instantly get the download link.

Thank you for reading this blog. Do share this blog if you found it helpful. If you have any queries, post them in the comments or contact us by emailing your questions to [email protected]. Follow us on LinkedIn Facebook, and Subscribe to our YouTube Channel. If you find any bug or error on this or any other page on our website, please inform us & we will correct it.

If you are looking for free help, you can post your comment below & wait for any community member to respond, which is not guaranteed. You can book Expert Help, a paid service, and get assistance in your requirement. If your timeline allows, we recommend you book the Research Assistance plan. If you want to get trained in MATLAB or Simulink, you may join one of our training modules. 

If you are ready for the paid service, share your requirement with necessary attachments & inform us about any Service preference along with the timeline. Once evaluated, we will revert to you with more details and the next suggested step.

Education is our future. MATLAB is our feature. Happy MATLABing!

About the author 

Ceethal Piyus

Image Processing & Signal Processing Expert with 4 years of experience in MATLAB Programming. Graduated with a Master’s in Technology degree from VIT University, Vellore, India

    • Ceethal Piyus says:

      Thank you for your valuable Feedback!

    • Ceethal Piyus says:

      Thank you for the feedback. You can also subscribe to our Youtube channel at https://mlhp.link/YouTube for upcoming events

    • Ceethal Piyus says:

      Thank you for your valuable Feedback!

    • Ceethal Piyus says:

      Thank you for your valuable Feedback!

    • UWAMAHORO Raphael says:

      Great work

    • Ceethal Piyus says:

      Thank you for the feedback. You can also subscribe to our Youtube channel at https://mlhp.link/YouTube for upcoming events

    • Ceethal Piyus says:

      Thank you for the feedback. You can also subscribe to our Youtube channel at https://mlhp.link/YouTube for upcoming events

  • Kazi Ziaul Hassan says:

    Hi @Ceethal Piyus,
    It would be very helpful to me if you provided the code as well as some data sets of microscopic blood sample image.

    • Hello Kazi. We don’t share code for our Webinars but we do share the Standalone Application. The Standalone application for the current topic is added in the end of this blog. You can use that for your research purpose. For code you will have to follow step by step process from the video only! All the best!

  • Hi! Would it be possible to get access to the code you presented here for research purposes? Thanks!

    • Hello Fareeha. We don’t share code for our Webinars but we do share the Standalone Application. The Standalone application for the current topic is added in the end of this blog. You can use that for your research purpose. For code you will have to follow step by step process from the video only! All the best!

  • Shardul Pawar says:

    algorithm will fail when the RBCs are completely stacked one above another is the limitation right! do we have a different approach to overcome that?
    I am curious to know wether we can process two or more 2D images of a 3D object (consider any)from different orientations and give an aggregate result giving more precise and accurate information of the object

  • SUDHARSANAN S says:

    In which unit rbc count is expressed here…..?????
    how to convert this count value to normal unit…????

  • Kakashi Hatake says:

    How can i get the dataset image?

  • Omar Alkousa says:

    Hello
    Thank you so much for your good explanation. I followed the steps and I and understood the essence of the project, although I don’t have that much experience in image processing.
    But I have a question about counting RBCs. I dowloaded the Hough Transform function and read it well. But I can’t make the algorithm that much of accurate because of the optional inputs control.
    So could you suggest a good values for radrange, grdthres, fltr4LM_R, and multirad so it can fits with the RBCs counting.
    Thanks in advance

  • Hanzlah Riaz says:

    Ma’am,I need code of rbc+wbc+platelets ?

  • Excellent description. Would love to try this.

  • Mihir Rana says:

    Good concept and nice explanation of code.

  • Hozzatul Islam Sayed says:

    This is so good and i saw your video in YouTube about the blood cell count.

    But i have a problem, i need the source code and data sample figure of your video.

    Could you please provide the source code and data sample figure?

    It’s will help me a lot. If possible please provide me.

    Thank you

  • {"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

    Connect with MATLAB Helper ®

    Follow: YouTube Channel, LinkedIn Company, Facebook Page, Instagram Page

    Join Community of MATLAB Enthusiasts: Facebook Group, Telegram, LinkedIn Group

    Use Website Chat or WhatsApp at +91-8104622179

    Watch our Latest Video

    Meet Industrial Experts & Ask your Questions

    Industrial Interaction MATLAB Helper
    >