You are on page 1of 17

Image Processing open cv

functions
By
Shivaguru Inamati
Under the guidance of
Mr. Anup Vijapur (NanoPix)
Internal College Guide
Asst Prof.Prashant Achari(BVBCET)

What is Thresholding?
The simplest segmentation method
Application example: Separate out regions of an image
corresponding to objects which we want to analyze.
This separation is based on the variation of intensity
between the object pixels and the background pixels.
To differentiate the pixels we are interested in from the
rest , we perform a comparison of each pixel intensity
value with respect to a threshold .
Once we have separated properly the important pixels,
we can set them with a determined value to identify
them .

Types of Thresholding

Threshold Binary
Threshold Binary,inverted
Truncate
Threshold to zero
Threshold to zero, inverted

Threshold Binary
This thresholding operation can be expressed as:

So, if the intensity of the pixel is higher than , then the new pixel
intensity is set to a . Otherwise, the pixels are set to .

Threshold Binary ,inverted


This thresholding operation can be expressed
as:

If the intensity of the pixel src(x,y) is higher than threshold , then the new pixel intensity is
set to a 0 . Otherwise, it is set to Max value .

Truncate
This thresholding operation can be expressed
as:

Threshold to zero
This operation can be expressed as:

Threshold to zero,inverted
This operation can be expressed as:

Region of interest
The vertices of an ROI outline may be positioned anywhere
with respect to the array of image pixels, so the same
Rectangular ROI shown above superimposed on the pixel
array may appear like this:

Computations of area and intensity for


generalised ROI
Each row of the image is considered in turn.
If the row intersects the ROI anywhere, then each pixel in that
image row is considered in turn.
Each pixel is intersected with the ROI.
The total ROI area is the sum of the areas of all the
intersected shapes,let I(i) be the intensity of pixel i,and A(i) be
the area of intersected pixel i
The mean pixel intensity is=
Summation of[A(i)xI(i)]/A
The standard deviation in pixel intensity is=
Sqroot((summation A(i)xI(i)xI(i))-muxmuxA)/A

Blob analysis
Identify regions in an image that differ in
properties like color or brightness.
Detect connected regions in binary images
usually done after thresholding.
Two Pass algorithm is used

First step:1st condition Does the pixel to the left (west) have the
same value?
Yes Same region, assign the same label to the current pixel
No Check next condition
Second step:Do the pixels to the north and west of
the current pixel have the same value but not the same
label?
Yes We know that the north and West pixels belong to the same
region and must be merged, assign the current pixel the minimum
of the north and west labels and record their equivalence
relationship
No Check next condition

Third step:Does the pixel to the left (west) have a


different value and the one to the north the same
value?
Yes Assign the label of the north pixel to the
current pixel
No Check next condition.
Fourth step:Do the pixels north and west neighbors
have different pixel values?
Yes Create a new label id and assign it to the
current pixel

Extract Plane
Suppose we wanted to extract red plane in an
image
Put R=(R-G)+(R-B)
G=0 and B=0
Also
Put the value of R to G and B,We will get
complete red plane

Hu moments
The function calculates seven Hu invariants

These values are proved to be invariants to the image scale, rotation, and
reflection except the seventh one, whose sign is changed by reflection.

You might also like