|
|
|
// This Program
is to generate an image consisting of a regular grid of cross symbols // set path
"d:\doc_ku_class\photo_203312\lab_material\sony\" set path "where your data are" //
******************************************** // Please change
the following variable values // BEFORE running the program //
******************************************** // n_row = no of
rows of the resulting image // n_col = no of
columns of the resulting image // spacing =
spacing distance between each cross in horizontal and vertical // tick_length =
length of the cross symbol //
test_image = TIF file name of the
output image n_row = 900 n_col = 1600 spacing = 150 tick_length = 81 border = 50 a = Matrix_uch(n_row, n_col,255) b = Matrix_uch(tick_length, tick_length,
255) for ii = 0, tick_length-1 b(int(tick_length/2) , ii) = 0 end
for ii = 0, tick_length-1 b(ii, int(tick_length/2)) = 0 end
start_row = border-1 start_col = border-1 no_tick_hor =
int((n_col-2*border)/spacing) no_tick_ver =
int((n_row-2*border)/spacing) for i=start_row,
start_row+no_tick_ver*spacing, spacing for j=start_col,
start_col+no_tick_hor*spacing, spacing a.setsymb(i, j, b) end end a.savetif("test_image")
|
/ This function is to generate an Image_uch
object from an Image_RGB object / The resulting image is a grey scale image
whose brightness value is the average / of those of color image.
/ Author : anonymous Function Image_uch img_out =
Image_rgb2uch(Image_rgb img) no_row = img.nrow() no_col = img.ncol() R = img.r().float() G = img.g().float() B = img.b().float() M = (R + G + B)/ 3 M = M.uchar() pt1 = img.lower_left() pt2 = img.upper_right() img_out = Image_uch(no_row, no_col) img_out.matrix() = M img_out.lower_left() = pt1 img_out.upper_right() = pt2 return
|