SA_Image
Description
SA_Image wraps an [M x N x d] Matrix that represents an Image. The dimension d is determined
by the image given to the constructor. There are some functions (like setR, setG and setB) that
assume d=3;
Constructor:
Image = SA_Image(SrcMatrix)
SrcMatrix: [M x N x d] Matrix; The matrix containing the image. The
dimension d in SrcMatrix defines the third dimension for further use (see set, get).
Image: object of type SA_Image;
Creates a new instance of the class SA_Image with the passed matrix SrcMatrix.
Public Functions:
draw(Image)
Image: SA_Image; The image to be drawn.
Displays the Image using the Matlab viewer.
Image = drawBoundaries(Image, VecArr, Color)
Image: SA_Image; The image used.
VecArr: SA_VectorArray; The list of boundaries. (k x 2)
Matrices of absolute (x,y) positions.
color: [d x N] Vector; Color list. For each new element in VecArr
the next color in the list is used.
Image: SA_Image; The image with highlighted boundaries.
Sets for all positions of all boundary vectors in VecArr the color of Image to the color parameter.
color = get(Image, x, y)
Image: SA_Image; The image used.
x: Float; x coordinate on the Image.
y: Float; y coordinate on the Image.
color: [1 x d] Vector; The color at x,y.
Returns the color vector at the position (x,y) of the Image. If the index position is outside of the
image, zeros(1,d) is returned.
BoundaryList = getBoundaries(Image)
Image: SA_Image; The image used.
BoundaryList: SA_VectorArray; A list of the boundaries on the
Image with absolute positions.
BoundaryList is a list of boundary path vectors on the image. The function extracts patches of the same color and traces the boundaries of them. A boundary is a [N x 2] Float Matrix where each row represents an absolute position on the image. The color black (0,0,0) is interpreted as empty and not extracted.
Image = set(Image,x,y,color)
Image: SA_Image; The image used.
x: Float; x coordinate on the Image.
y: Float; y coordinate on the Image.
color: [1 x d] Matrix; The color to be set.
Image: SA_Image; The image used.
Sets the color of the image at (x,y) to the passed value color.
Image = setR(Image,x,y,r)
Image: SA_Image; The image used.
x: Float; x coordinate on the Image.
y: Float; y coordinate on the Image.
r: Uint8; Red color component.
Image: SA_Image; The image used.
Sets the red color component of the image at (x,y) to the passed value color.
This function requires the image (passed through the constructor) to be a [M x N x 3] Uint8 Matrix.
Image = setG(Image,x,y,g)
Image: SA_Image; The image used.
x: Float; x coordinate on the Image.
y: Float; y coordinate on the Image.
g: Uint8; Green color component.
Image: SA_Image; The image used.
Sets the green color component of the image at (x,y) to the passed value color.
This function requires the image (passed through the constructor) to be a [M x N x 3] Uint8 Matrix.
Image = setB(Image,x,y,b)
Image: SA_Image; The image used.
x: Float; x coordinate on the Image.
y: Float; y coordinate on the Image.
b: Uint8; Blue color component.
Image: SA_Image; The image used.
Sets the blue color component of the image at (x,y) to the passed value color.
This function requires the image (passed through the constructor) to be a [M x N x 3] Uint8 Matrix.
GreyImage = greyval(ColorImage)
ColorImage: SA_Image; RGB image.
GreyImage: SA_Image; Uint8 grey image with values in [0;255].
Converts the RGB image ColorImage to the grey value image GreyImage.
GreyImage = equalize(GreyImage)
GreyImage: SA_Image; The grey image to be equalized.
GreyImage: SA_Image; The equalized grey image.
Equalizes the grey values in GreyImage.
Private Functions:
Bitmask = getPatchBitmask(SrcImg, start_x, start_y)
SrcImg: [M x N x 3] Uint8 Matrix; The image to get a patch from.
start_x: Float; x coordinate of the startpoint in the patch to be extracted.
start_y: Float; y coordinate of the startpoint in the patch to be extracted.
Bitmask: [M x N] Logical Matrix; The Bitmask.
Computes a bit-matrix that covers the linked area of SrcImg that has the same color than at (start_x, start_y). Bitmask will contain ones at the area and zeroes else.
Boundary = traceBoundary(Bitmask)
Boundary: [M x 2] Uint Matrix; Boundary of the Bitmask.
Image: SA_Image; The image used.
Returns a vector of absolute positions. The positions in Boundary represent the boundary of the patch in Bitmask. The function assumes one patch of 1 (true) completely surrounded by 0 (false).
|