Project Report (2021-BME-107)
Project Report (2021-BME-107)
Project Report
Submitted to: Dr. M Umair Ahmed Khan
Submitted by: Hamza Asjad
Registration number: 2021-BME-107
Course name: Medical Image Processing
Course Code BME 420
Semester: 7th
Department: Biomedical Engineering
(NAROWAL CAMPUS)
Project Report 2021-BME-107
Image Processing for Tissue Detection, Localization, Bounding Boxes and Coordinates
in Ultrasound Images Using MATLAB
Objective
The purpose of this report is to apply step-by-step process of detecting and localizing fetal tissue
structures from the ultrasound image, drawing bounding boxes around detected tissues, and determining
both image and real-time coordinates.
Introduction
Ultrasound imaging is the most commonly used non-invasive diagnostic method in medicine. The
ultrasound signal has proven to be very helpful in monitoring fetal development. This report describes an
image processing procedure designed for the analysis of fetal ultrasound images with special emphasis on
tissue detection, localization, and the extraction of necessary coordinates. The procedure has been divided
into four steps: contrast enhancement, edge detection, generation of a bounding box around the tissue of
interest, and finally, coordinate extraction. All of these steps that implement the analysis automatically
use MATLAB, which will be helpful in monitoring fetuses for healthcare professionals.
Methodology
1. Preprocessing
Ultrasound images are either noisy or even have contrasts that may appear uneven, and there are several
preprocessing steps to make the important structures clear and reduce artifacts as much as possible.
2. Edge Detection
Edge detection recognizes edges or boundaries in an image where pixel intensity changes suddenly.
This is important in marking many structures found in an ultrasound image.
This work opted for the canny edge detection algorithm, which is quite effective in edge detection in
noisy environments like ultrasound images.
Connected Component Analysis: Following edge detection, the regions present in the binary
image are assigned labels through connected component analysis. In this step, all distinct
regions of connected pixels are considered as individual objects.
Bounding box Calculation Using regionprops for MATLAB over all detect objects for which it
computes the bounding box as the minimum enclosing rectangle covering all tissue areas it can
detect in an image. Box Drawing By overlay of every box over either an original or any
processing done over it within an image.
Project Report 2021-BME-107
Bounding boxes around the tissue identify its location within the ultrasound image. It might be
useful later for further analysis or report.
4. Coordinate Extraction
Coordinates of detected tissues' image are extracted to determine their location, measurement, and, if
possible, track them in real time. It might be useful in diagnostic and monitoring procedures.
Centroid Computation: This function computes the centroid of detected region, which is a geometric
center of the tissue. The coordinate will give a reference for every structure within the image.
Coordinate Output: The coordinates of all centroids are output or saved indicating precisely where
each tissue structure has been detected. These coordinates form a reference in case of reporting or
further spatial analyses.
Real-Time Approximation Coordinate: In the lack of direct support, I took the GINPUT function in
place. GINPUT picks out and describes very distinctive points in the image which can be used as
coordinates for real-time spatial referencing.
Procedure
The ultrasound image was loaded into MATLAB, and initial preprocessing was applied. Grayscale
conversion, contrast enhancement, and noise reduction were used to prepare the image:
Canny edge detection algorithm is applied to outline the edges of the tissues in the ultrasound image.
This results in clear edges for the detection as Canny edge detection has robustness in medical
images.
The binary edge detected image was labeled for its connected components and boxes are drawn
around each of the connected components as follows:
In order to delineate the exact region of the found tissue, I made bounding boxes by using the
BoundingBox property of connected components.
Project Report 2021-BME-107
Due to the limitations of directly using ArUco markers in MATLAB, GINPUT is used as an
alternative to approximate image coordinates. GINPUT identifies featurepoints within the image,
providing key points that can be used for reference in real-time tracking applications.
The image processing steps Using the above code produced the following results:
1. Preprocessed Image: The original ultrasound image was enhanced for contrast andfiltered
to reduce noise, improving the visibility of tissue structures.
Project Report 2021-BME-107
2. Edge Detection: The Canny edge detection highlighted boundaries of various tissue
structures, allowing precise localization.
3. Bounding Boxes and Tissue Localization: Each detected tissue structure was
surrounded by a bounding box, clearly indicating its boundaries. The centroids ofeach
bounding box were marked as well.
4. Image Coordinates: The coordinates of each centroid were displayed, indicating the
image positions of the detected tissues.
Real-time Coordinates
For real time coordinates, we use Python programming language, specifically with the OpenCV library
for computer vision tasks and NumPy for numerical operations.
Libraries:
OpenCV: For video capture, color detection, and contour operations.
NumPy: For array operations, such as defining HSV ranges.
Code:
Output:
Figure 6 showing the real-time coordinates Figure 7 showing the real-time coordinates
Conclusion
The project is able to employ image processing algorithms to the ultrasound images to achieve tissue
detection, tissue localization, generation of bounding box around the localized tissue and eventual
extraction of the tissue coordinates using MATLAB. Furthermore, real-time coordinate detection by
using Python and OpenCV for precaution of multiple colors demonstrated sufficiently accurate spatial
monitoring and analysis.