lvgbox(3)

LIBRARY ROUTINE
lvgbox - This routine fills in a buffer with a represention of plain a parallelogram projected on a CCD sensor. 15 parameters are needed (buffer, 14 description parameters).

LIBRARY CALL
#include "vinclude.h"
#define PI     XV_PI       /*  3.14159265358979323846 */
#define true   1
#define false  0
#define abs(x) (((x)>0) ? (x) : -(x) )
int lvgbox(pt_image_data,
             n_cols,      /* number of cols (x) */
             n_rows,      /* number of rows (y) */
             px_x_w,      /* active area pixel width in the pixel_cell */
             px_y_h,      /* active area pixel height in the pixel_cell */
             px_x_of,     /* active pixel offset from left pixel_cel */
             px_y_of,     /* active pixel offset from top pixel_cel */
             grey_out,    /* grey level outside of parallelogram */
             grey_in,     /* grey level inside of parallelogram */
             im_x_w,      /* parallelogram euclidian width (in pixel unit) */
             im_y_h,      /* parallelogram euclidian height (in pixel unit) */
             im_x_of,     /* parallelogram: x right offset
                              origine: parallelogram center = sensor center */
             im_y_of,     /* parallelogram: y downward offset
                              origine: parallelogram center = sensor center */
             phi,         /* parallelogram rotation (radians,
                              origine: rot. center = parallelogram center) */
             psi)         /* 1rst parallelogram corner angle: (radians) */
unsigned char  *pt_image_data;
unsigned short n_cols,n_rows;
float          px_x_w, px_y_h, px_x_of, px_y_of;
unsigned char  grey_out,grey_in;
float          im_x_w, im_y_h, im_x_of, im_y_of, phi, psi;

INPUT

n_cols
    unsigned short number of cols (x)

n_rows
    unsigned short number of rows (y)

px_x_w
    float active area pixel width in the pixel_cell

px_y_h
    float active area pixel height in the pixel_cell

px_x_of
    float active pixel offset from left pixel_cell

px_y_of
    float active pixel offset from top pixel_cell

grey_out
    unsigned char grey level outside of parallelogram

grey_in
    unsigned char grey level inside of parallelogram

im_x_w
    float parallelogram euclidian width (in pixel unit)

im_y_h
    float parallelogram euclidian height (in pixel unit)

im_x_of
    float parallelogram: x right offset (origine: parallelogram center = CCD center)

im_y_of
    float parallelogram: y downward offset (origine: parallelogram center = CCD center)

phi float clockwise parallelogram rotation (radians, rot. center = parallelogram center)

psi float first parallelogram corner angle (radians)

OUTPUT

pt_image_data
    unsigned char a pointer to the memory allocated by the calling routine. holds the result of the image data generation

MODIFICATIONS
UPDATE: August 1991 : new float psi angle parameter for parallelogram

DESCRIPTION
vgbox
 This procedure fills a buffer with a grey level represention of a parallelogram projected on a CCD sensor.
 It calculates the grey level of each pixel from the intersection of the theorical parallelogram and the rectangular active area of each sensor-pixel.
 The sensor is made of pixels suposed to be all identical, composed of an active rectangular area in a rectangular cell.
  15 parameters are to be provided:
     The buffer,
     For the sensor:
       its number of number of rows (=cols_size) and number of columns (=rows_size)
       the size of each pixel active area,
       the position of active area on the whole pixel area.
     For the parallelogram:
       X and Y sizes,
       its position (horizontal and vertical shifts),
       its rotation (in radians).
       its first corner angle (in radians).
     The grey levels of full lighted pixels and full dark pixels.
        Return Value: 0 on success,
                        n=1 on warning,
                        n=2 on error.
        speed: about 0.5 ms /pixel on a Sun 3.
               about 0.04 ms /pixel on a Sun 4 sparc station ipc.

SEE ALSO
vgbox(1), intro(3), vipl(3), verror(3), vutils(3) vgbox(1)

RESTRICTIONS
Pixel width + pixel offset must be egal or less than 1.000.

The CCD cells are supposed square in order to obtain the asked angles, although the active area can be rectangular.

For a parallelepipedic box, the width and heigth sizes of the box are the euclidian distances between the parallel lines.

AUTHOR
Jean-Pierre GUERIN (CEA)

COPYRIGHT
Copyright 1991, University of New Mexico. All rights reserved.