Nothing Special   »   [go: up one dir, main page]

Lab 8 Biomedical Imaging

Download as pdf or txt
Download as pdf or txt
You are on page 1of 19

LAB 8

Biomedical Imaging

29-04-2021
TERM PROJECT
rgb2gray converts RGB images to grayscale by
eliminating the hue and saturation information while
retaining the luminance. I = rgb2gray(RGB) converts the
truecolor image RGB to the grayscale intensity image I.
newmap = rgb2gray(map) returns a grayscale colormap
equivalent to map.
im2bw (Convert image to binary image, based on
threshold)
• BW = im2bw(I,level) converts the grayscale image I to binary image
BW, by replacing all pixels in the input image with luminance greater
than level with the value 1 (white) and replacing all other pixels with
the value 0 (black).

• This range is relative to the signal levels possible for the image's class.
Therefore, a level value of 0.5 corresponds to an intensity value
halfway between the minimum and maximum value of the class.
bwareaopen (Remove small objects from binary
image)
• BW2 = bwareaopen(BW,P) removes all connected components
(objects) that have fewer than P pixels from the binary image BW,
producing another binary image, BW2. This operation is known as an
area opening.
• Remove objects containing fewer than 50 pixels using bwareaopen
function.

• BW2 = bwareaopen(BW, 50);


Imfill (Fill image regions and holes)
• I = imread('coins.png');
• figure
• imshow(I)
• title('Original Image')
Imfill (Fill image regions and holes)
• BW = imbinarize(I);
• figure
• imshow(BW)
• title('Original Image
Converted to Binary Image')
Imfill (Fill image regions and holes)
• Fill holes in the binary image and display the result.

• BW2 = imfill(BW,'holes');
• figure
• imshow(BW2)
• title('Filled Image')
strel

• A strel object represents a flat morphological structuring element,


which is an essential part of morphological dilation and erosion
operations.

• A flat structuring element is a binary valued neighborhood, either 2-D


or multidimensional, in which the true pixels are included in the
morphological computation, and the false pixels are not. The center
pixel of the structuring element, called the origin, identifies the pixel
in the image being processed. Use the strel function (described
below) to create a flat structuring element. You can use flat
structuring elements with both binary and grayscale images.
imerode Erode image

• J = imerode(I,SE) erodes the grayscale, binary, or packed binary image


I, returning the eroded image, J. SE is a structuring element object or
array of structuring element objects, returned by the strel or
offsetstrel functions.
imerode Erode image
imerode Erode image

Original Image eroded Image


Imdilate (Dilate image)

• 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.
Dilate image

Original Image dilated Image


MASKING
• Will keep only the part of the image that's inside the mask, zero
outside mask.
??

You might also like