Friday, 14 February 2014

Brain tumor detection & classification using OpenCV

Title: Brain tumor detection & classification using OpenCV

Abstract :

In this project we are going to apply modified image segmentation technique on MRI scan images in order to detect brain tumors. Also a modified Probabilistic Neural Network (PNN) model will use for automated brain tumor classification using MRI scans. Present available tool is able to detect the brain tumor only but it is not able to classify brain tumor. Present tool is available in MATLAB which is too costly. We are creating the tool using OpenCV which is open source and able to classify the type of brain Tumor. This tool will helpful for doctors for automatic detection & classification of brain tumor.


Brain tumor detection and classification system detects brain tumor and classifies it. Brain tumor has two types i.e. benign and malignant tumor. Tumor is mass of tissue that serves for no purpose and generally exists at expense of healthy tissue. Benign brain tumors, composed of harmless cells, have clearly defined borders, can usually be completely removed, and are unlikely to recur. A benign tumor is basically a tumor that doesn't revert and doesn't spread to other parts of the body. Benign tumors tend to grow more slowly than malignant tumors and are less likely to cause health problems. But malignant brain tumors do not have distinct borders. They tend to grow rapidly, increasing pressure within the brain and can spread in the brain or spinal cord beyond the point where they originate. They grow faster than benign tumors and are more likely to cause health problems. The Brain tumor detection and classification system will take MRI scan image and compare it with anatomical structure of healthy brain. After that smoothing of image is done and Region of interest (ROI) is determined. From ROI we can classify brain tumor using number of data sets stored in system.

Proposed work:

In our proposed work we will take MRI scanned image and apply following steps on it for detection and classification of brain tumor.
Brain tumor identification and classification system contains following steps:

A) Image Acquisition:

In our proposed approach we first will consider that the MRI scan images of a given patient are either color, Gray-scale or intensity images herein are displayed with a default size of 220×220. If it is color image, a Gray-scale converted image is defined by using a large matrix whose entries are numerical values between 0 and 255, where 0 corresponds to black and 255 to white for instance. Then the brain tumor detection of a given patient consist of two main stages namely, image segmentation and edge detection.

B) Image Segmentation:

The objective of image segmentation is to cluster pixels into image region. The segmentation is useful for identifying region of interest i.e. locate tumor and other abnormalities. The proposed system is based on information about anatomical structure of healthy parts and compares it with healthy parts. The comparison done with reference image of normal candidate brain scan image as shown in fig.1. After comparison it will locate abnormal parts of brain tumor patient. The abnormal brain is as shown in fig.2.

        Figure 1: Normal Brain                     Figure 2: Abnormal Brain

C) Smoothing of image:

There are different types of noise encountered by different techniques, depending on
noise nature and characteristics namely Gaussian noise and impulse noise. We will use
smoothing image filters for reducing Gaussian noise from MRI images & sharpening filters for
highlighting edges in an image. It was observed that smoothing and sharpening filter does not
remove noise completely from original image. Filtering is as shown in fig.3 and fig 4.

 Figure 3. Applying Gaussian filter           Figure 4: applying average filter

D) Edge detection:

Edge is the property attached to an individual pixel. The purpose of edge detection is
to finding Region of Interest. While preserving structural properties to be used for further image
processing. We will apply edge detection algorithm and calculate region of interest as shown
in fig 6. Our region of interest is tumor i.e. abnormal part present on brain. The white portion
shown in the tumor, since our focus is on this portion it will helpful to significantly
reduce amount of data in an image. After identifying tumor we will apply Canny Edge
Detection algorithm in order to classify brain tumor.

     Figure 6: Region of Interest                Figure 7: Canny Edge Detection

E) Methodology

Figure 8. Illustrate the sequence of proposed approach.


In proposed work we will take MRI scanned image. It can be in the form color or gray, if it is not in gray color the system will convert image into gray format. This gray image is given to the image segmentation. Segmented image is compared with stored data sets. After comparing we can detect brain tumor. For classification we will give this compared image to the neural network. By using probabilistic classification we can classify the tumor is in normal state or abnormal state.

Literature, reviews or other schemas:

[1] Dina Aboul Dahab1, Samy S. A. Ghoniemy2, Gamal M. Selim3
Dep. of Computer Engineering, Arab Academy for Science, Technology & Maritime Transport
Cairo, Egypt “Automated Brain Tumor Detection and Identification Using Image Processing and Probabilistic Neural Network Techniques”.
[2] Automatic Detection of Brain Abnormalities and Tumor Segmentation in MRI Sequence.
[3] International Journal of Image Processing and Visual Communication ISSN 2319-1724: Volume (Online) 1, Issue 2, October 2012.


  1. can I get code for this algorithm

    1. hi, are you working on a program to detect brain tumor from an image scan

  2. what sort of code you want..? as everything is there in opencv just search on google and implement the steps one by one

  3. fck u.. just giv d code already

  4. can u please send the code to watermark the extracted tumor

  5. Please can you send me code ?