[mmframe] [Up] [mmtext] Image Creation

mmdrawv
Superpose points, rectangles and lines on an image.

Synopsis

y = mmdrawv ( f , data , value , GEOM )

Input

f Image Gray-scale (uint8 or uint16) or binary image

data Image Gray-scale (uint8 or uint16) or binary image

vector of points. Each row gives information regarding a geometrical primitive. The interpretation of this data is dependent on the parameter GEOM.

The line drawing algorithm is not invariant to image transposition.

value Image Gray-scale (uint8 or uint16) or binary image

pixel gray-scale value associated to each point in parameter data. It can be a column vector of values or a single value.

GEOM String

geometrical figure. One of 'point','line', 'rect', or 'frect' for drawing points, lines, rectangles or filled rectangles respectively.

Output

y Image Gray-scale (uint8 or uint16) or binary image

y has the same type of f.

Description

mmdrawv creates the image y by a superposition of points, rectangles and lines of gray-level k1 on the image f. The parameters for each geometrical primitive are defined by each line in the 'data' parameter. For points, they are represented by a matrix where each row gives the point's row and column, in this order. For lines, they are drawn with the same convention used by points, with a straight line connecting them in the order given by the data matrix. For rectangles and filled rectangles, each row in the data matrix gives the two points of the diagonal of the rectangle, where the points use the same row, column convention.

Examples

Numerical examples
f=uint8(zeros((3,5)))
pcoords=uint16([[0,2,4],
                [0,0,2]])
pvalue=uint16([1,2,3])
print mmdrawv(f,pcoords,pvalue,'point')
[[1 0 2 0 0]
 [0 0 0 0 0]
 [0 0 0 0 3]]
print mmdrawv(f,pcoords,pvalue,'line')
[[1 1 2 0 0]
 [0 0 0 2 0]
 [0 0 0 0 2]]
rectcoords=uint16([[0],
                   [0],
                   [3],
                   [2]])
print mmdrawv(f,rectcoords, uint16(5), 'rect')
[[5 5 5 5 0]
 [5 0 0 5 0]
 [5 5 5 5 0]]
Gray-scale image
A line connecting the centroids of the blobs is drawn.
f=mmreadgray('blob3.tif')
pc=mmblob(mmlabel(f),'centroid','data')
lines=mmdrawv(mmintersec(f,0),transpose(pc),uint8(1),'line')
Warning: upcasting image from scalar to binary uint8
mmshow(f,lines)
f,lines

See also

mmframe Create a frame image.
mmtext Create a binary image of a text.
mmblob Blob measurements from a labeled image.
[mmframe] [Up] [mmtext]