EPIX, Inc. Home Page

PXIPL Library
Imaging Processing and Analysis Library for COC40

Features
  • Image Processing and Analysis for COC40 Processing Boards.
  • Optimized for Fast TMS320C40 Execution.
  • Arithmetic, Logical, Morphological, Correlation, and Transform (FFT) Operations.
  • Blob Analysis, Center of Mass, Moment, and Histogram Calculations.
  • For DSP and Non-DSP Programmers.

PXIPL-COC40 is a comprehensive library of image processing and analysis routines for the TMS320C40 DSP(s) on the COC40 co-processing boards. The libraries are designed to allow quick and easy integration into user-written applications. Programmers can significantly reduce development time with flexible, yet efficient, PXIPL-COC40 routines.

EFFICIENCY
PXIPL-COC40 operations have been developed specifically for the TMS320C40. The functions are coded in optimized C, with selected segments hand-coded in assembler, taking advantage of the high processing speed of the TMS320C40 and its superior performance with integer and floating point operations.

Many functions automatically identify special cases, invoking code optimized for each special case.

FLEXIBILITY
PXIPL-COC40 offers the ease and flexibility to accomplish applications from the most straight-forward to the most demanding. To simplify programming, a single PXIPL-COC40 function does the work of many standard functions. Each function supports variable image resolution, and can operate on specified image buffers. Nonrectangular regions of interest can be designated for many operations.

PROGRAMMING
PXIPL-COC40 offers routines for programmers who have never programmed a DSP. Bound routines are invoked just like a typical PC based image processing function. The TMS320C40 compiler is not required; each routine automatically loads and executes an operation on the TMS320C40. However, some overhead is required to load the TMS320C40 function each time a bound routine is called. Not all PXIPL-COC40 functions are available as bound routines; only the most popular operations are included.

For DSP programmers who expect faster execution of their programs, native routines are also provided.

Native routines require a TMS320C40 compiler (or assembler) and are more efficient than bound routines. Many native routines can be combined into a single TMS320C40 program which only needs to be loaded once, eliminating the overhead required with bound routines.

BOARD CONTROL
PXIPL-COC40 operates with the 4MOBJ library as a complete package of software tools. 4MOBJ provides board control such as image acquisition and display, as well as TMS320C40 communication routines for program loading, execution, and PC to/from TMS320C40 communication.


FEATURES


ARITHMETIC
Add, subtract, multiply, divide, and average two images. Add or multiply a single image by a constant. Select between 8 image subtraction options.

LOGICAL
AND, OR, or XOR two image pairs or single images with a mask.

EDGE DETECTION
  • Kirsch
  • Roberts
  • Sobel
  • Sobel Absolute
  • Thin Edge Gradient

FILTERS
  • Low Pass - Fixed
  • Low Pass - Weighted
  • Low Pass - Smear
  • Median
  • Median - Weighted
  • Median - Binary Images
  • Rank High (Dilate)
  • Rank Low (Erode)
  • Sharpen - Laplacian

COPY, RESIZE, ROTATE
Copy an image buffer into a specified buffer location, concurrently performing these operations:
  • Bilinear Interpolation
  • Nearest Neighbor Interpolation
  • Area Interpolation
  • Spatial Replication
  • Flip up/down, right/left.
  • Skew left/right or up/down by a specified number of pixels.
  • Shift up, down, right, or left by a specified number of pixels.
  • Rotation, in degrees, from a user-definable origin.
  • Warping using nearest neighbor or bilinear interpolation.

SEQUENCE OPERATIONS
Entire sequences can be averaged or integrated with a single function.

NORMALIZATIONS AND CORRECTIONS

  • Correct for shading effects or nonuniform illumination.
  • Correct for lighting variations using a background image and subtractive or multiplicative correction.
  • Remove "speckles" (bad pixels) caused by imperfect sensors.
  • Modify the image so that the histogram has a specific shape.
  • Modify the contrast of image, matching first two moments to those of second image.
  • Normalize column's mean or line's mean.

PIXEL OPERATIONS
  • Complement (invert) pixels.
  • Enhance contrast via lowbound and highbound values, or by histogram percentiles.
  • Threshold pixels by a user defined value.
  • Count pixels above a specified threshold value.
  • Set pixel values to a constant.
  • Scale pixel values by a constant.
  • Search for a specified pixel.
  • Dither.

MORPHOLOGICAL OPERATIONS
Morphological operations may be executed with the standard 3 x 3 structure element, or an arbitrary structure element may be defined.
  • Dilation
  • Erosion
  • Open
  • Close
  • Hit-Miss
  • Medial Axis Thinning

CONVOLUTIONS
  • Real or integer convolutions of any size (N x N), with arbitrary coefficients, are supported.
  • Various convolution special cases are automatically identified and function execution is optimized accordingly.
  • Threshold the image by comparing the image to the average value of the pixel's specified N x N neighborhood.
  • Modify the high and low contrast areas of an image using the specified N x N neighborhood size as a basis for computation.

HISTOGRAM
Compute histogram. Optionally obtain the following statistics:
  • Highest pixel value.
  • Lowest pixel value.
  • Number of pixels.
  • Sum of pixels.
  • Sum of pixels squared.
  • Most frequent pixel value.
  • Least frequent pixel value.
  • First moment.
  • Variance.
  • Standard Deviation.
  • RMS Value.

DRAWING/ANNOTATION
  • Draw box, arrow, line, curved line, ellipse, or icon.
  • Paint within a region.
  • Draw test patterns.

CALIBRATIONS AND MEASUREMENTS
  • Calibrate X & Y pixel values into "real world" dimensions.
  • Calibrate pixel intensity values.
  • Measure subpixel edge position to a precision of better than 0.1 pixel. *

CENTER OF MASS
Compute the center of mass and total mass for any full image or region of interest.

MOMENTS
The following statistics are returned for moment computation.
The statistics can be computed in pixel values or in calibrated units.
  • Number of pixels.
  • Number of non-zero pixels.
  • Coordinates for the center of mass.
  • Central moments.
  • Central moments normalized for scale.

TRANSFORMS
  • Inverse FFT
  • Log magnitude plot of frequency domain.
  • Scale frequency domain by log magnitude plot.
  • Filter frequency domain.

BLOB ANALYSIS
Analyze image for blobs with or without holes. Define constraints on blob size. Optionally obtain the following statistics for each blob, computed in pixel values or in calibrated units.
  • Number of pixels.
  • Area
  • Center of uniform mass (COM).
  • Minimum radius from COM.
  • Maximum radius from COM.
  • Angle of least moment of inertia axis.
  • Pixel at min radius from COM.
  • Pixel at max radius from COM.
  • Coordinates of major axis endpoints.
  • Minor axis.
  • Length of major axis.
  • Angle of major axis.
  • Distance of minor axis from major axis.
  • Circumference.
  • Pixel with/at minimum H coordinate.
  • Pixel with/at maximum H coordinate.
  • Pixel with/at minimum V coordinate.
  • Pixel with/at maximum V coordinate.
  • Width as projected on H axis.
  • Height as projected on H axis.

TYPICAL EXECUTION SPEEDS
These operations were performed using standard PXIPL-COC40 functions.

Image Processing Operation Time (usec/pixel)
AND with a Constant 0.62
OR with a Constant 0.62
Addition of a Constant 0.97
Multiply by a Constant 1.69
Threshold 0.98
3 x 3 Low Pass Filter 1.59
Sharpen (Laplacian-3 x 3) 1.59
3 x 3 Kirsch Edge Detection 10.40
3 x 3 Sobel Edge Detection 4.90
Two Image Addition 0.47
Two Image Subtraction 0.67
Erosion 1.20
Dilation 1.20
Normalize Background 2.88
Compute Moments, 3rd Order 3.90
Compute Center of Mass 0.68
Compute Histogram 0.54
FFT on 256x256 4.50
Correlation w. 16x16 Mask 62.50
Blob Search 1.15

* Accuracy is dependent on image quality.


Native TMS320C40 Functions
Requires TMS320C40 "C" compiler.
Add Pixels of Image Pair De-Flicker Interlace: Modify Singularities Map Ulong Pixel Values in Region
AND Pixels in Region with Mask Decode SMPTE Vertical Interval Time Code Map Ulong Pixel Values
AND Pixels of Image Pair Difference for Insert of Image Pair Map Ushort Pixel Values in Region
AND Pixels with Mask Dither Pixels, Normal Map Ushort Pixel Values
Average Image Sequence Dither Pixels, Uniform Medial Axis Thinning
Average Pixels of Image Pair Draw 2-D Cosine Product Pattern Modify Region Definition: Rectangle to Polygon
Calibrate Intensity/Density Mapping Draw 2-D Gaussian Pattern Morphology Close
Calibrate Spatial Mapping Draw 2-D Separable Patterns Morphology Dilation w. 3x3 Element
Complement Pixel Values in Region Draw Alignment Pattern Morphology Dilation
Complement Pixel Values Draw Arrow Morphology Erosion w. 3x3 Element
Compress Region Path Draw Box Morphology Erosion
Compute Center of Mass of Region Draw Curved Line defined as Bezier Polynomial Morphology Hit-Miss
Compute Center of Mass Draw Ellipse Morphology Open
Compute Center of Mass, Binary Image Region Draw Icon or Cursor Normalize Columns' Mean
Compute Center of Mass, Binary Image Draw Icon Primitive, Free Resources Normalize Image as per Background Image
Compute Histogram on Region Draw Icon Primitive, Initialize Normalize Lines' Mean
Compute Histogram on Region Draw Icon Primitive, Modify Pixels NxN Convolution, Integer
Compute Histogram Statistics w. Interpretation Draw Icon Primitive, Test Completion NxN Convolution, Real
Compute Histogram Statistics w. Interpretation Draw Line Segment NxN Dynamic Threshold
Compute Histogram Statistics Draw Region Boundary NxN Inverse Contrast Ratio Mapping
Compute Histogram Statistics Draw Region Path OR Pixels in Region with Mask
Compute Histogram Edge Detection, Kirsch OR Pixels of Image Pair
Compute Moments of Region w. Interpretation Edge Detection, Roberts OR Pixels with Mask
Compute Moments of Region Edge Detection, Sobel Absolute Paint within Region
Compute Moments w. Interpretation Edge Detection, Sobel Perform Intensity/Density Mapping
Compute Moments Edge Gradient, Thin Perform Inverse Spatial Mapping
Compute Shape Statistics of Image Region Exclusive OR Pixels of Image Pair Perform Spatial Mapping
Compute Tabulated Histogram Extend Region Path Product of Pixels of Image Pair
Construct PXIMAGE: Access Freq. Domain Complex Image Extend Region Path Ratio of Pixels of Image Pair
Construct PXIMAGE: Access Image in Host Memory Field Interlaced Image Line Shuffle Release Intensity/Density Mapping State
Construct PXIMAGE: Access Image in Malloc'ed Memory Field Interlaced Image Line UnShuffle Release Spatial Mapping State
Construct PXIMAGE: Release Image in Malloc'ed Memory Filter Frequency Domain Scale Freq. Domain by Log Magnitude Plot
Contrast Enhance By Percentile Filter, Low Pass, Fixed Scale Pixel Values in Region
Contrast Enhance Region By Percentile Filter, Low Pass, Low Smear Scale Pixel Values
Contrast Enhance Region Filter, Low Pass, Weighted Scan, Connect, Collect Region by Table
Contrast Enhance Filter, Median Scan, Connect, Collect Region by Value
Contrast Match Image Pair Filter, Median, Binary Images Search for Pixel by Table
Copy & Area Interpolation Filter, Median, Weighted Search for Pixel by Value
Copy & Bilinear Interpolation w. Orientation Filter, Rank High (Dilate) Set Pixel Values in Region
Copy & Exchange Image Buffers Filter, Rank Low (Erode) Set Pixel Values
Copy & Nearest Neighbor Interpolation w. Orientation Filter, Sharpen, Laplacian Shift Pixel Values in Region
Copy & Skew Image Left/Right Find Blobs and List Shift Pixel Values
Copy & Skew Image Up/Down Find Blobs, Analyze and List Spatial Intensity Normalization
Copy & Spatial Replicate Find Region's Enclosed Area Spatial Quantization & Shrink
Copy Buffer from Raw Image Address Find Region's Enclosing Window Subpixel Edge Measurement
Copy Buffer to Raw Image Address Follow and Collect Region Boundary by Value Subtract Pixels of Image Pair
Copy Image Buffer Region Get Dimensions of Freq. Domain Representation Swap Line or Column Pairs
Copy Image Buffer with Reversal Halftone by Black/White Sum Threshold Pixel Values in Region
Copy Image Buffer with Shift Histogram Equalization Threshold Pixel Values in Region
Copy Image Buffer Initialize Region Path Threshold Pixel Values
Copy Image with Rotation Insert of Differences of Image Pair Threshold Pixel Values
Copy Image with Warping Integrate Image Sequence Transform Image: FFT
Correct Image as per Speckle Mask Line Pair Pixel Shuffle Transform Image: Inverse FFT
Correlation Profile Line Pair Pixel UnShuffle Translate Region Definition to Path
Count Pixels by Threshold Log Magnitude Plot of Freq. Domain Translate Region Definition to Scan List
Count Region Pixels by Threshold Map Uchar Pixel Values in Region XOR Pixels in Region with Mask
De-Flicker Interlace: Line Pair Average Map Uchar Pixel Values XOR Pixels with Mask

Bound TMS320C40 Functions
Requires only PC "C/C++" compiler.
Add Pixels of Image Pair Edge Detection, Roberts Histogram Equalization
AND Pixels of Image Pair Edge Detection, Sobel Absolute Integrate Image Sequence
Average Image Sequence Edge Detection, Sobel Log Magnitude Plot of Freq. Domain
Average Pixels of Image Pair Edge Gradient, Thin Morphology Dilation w. 3x3 Element
Compute Center of Mass Exclusive OR Pixels of Image Pair Morphology Erosion w. 3x3 Element
Compute Center of Mass, Binary Image Filter Frequency Domain Normalize Image as per Background Image
Compute Histogram Filter, Low Pass, Fixed NxN Convolution, Integer
Compute Moments w. Interpretation Filter, Low Pass, Low Smear NxN Convolution, Real
Compute Moments Filter, Low Pass, Weighted OR Pixels of Image Pair
Compute Tabulated Histogram Filter, Median Product of Pixels of Image Pair
Contrast Match Image Pair Filter, Median, Binary Images Ratio of Pixels of Image Pair
Convert Freq. Domain to/from Host Format Filter, Median, Weighted Scale Freq. Domain by Log Magnitude Plot
Copy & Bilinear Interpolation w. Orientation Filter, Rank High (Dilate) Spatial Intensity Normalization
Copy & Nearest Neighbor Interpolation w. Orientation Filter, Rank Low (Erode) Subtract Pixels of Image Pair
Copy Image with Rotation Filter, Sharpen, Laplacian Threshold Pixel Values
Correlation Profile Find and List Blobs* Transform Image: FFT
Count Pixels by Threshold Get Dimensions of Freq. Domain Representation Transform Image: Inverse FFT
Edge Detection, Kirsch

* Blob Analysis is supported only under 32 bit PC compilers (Bound function).


DUAL PROCESSOR CONTROL -
PXIPL-COC40 functions allow for asynchronous operations on multiple TMS320C40 processors.

If two TMS320C40s are available, each function mentioned above can be directed to operate on either processor, with each processor accessing a separate 4MB section of image memory divided into buffers.

For example, with 24 image buffers, processor A can access buffers 1 thru 12 while processor B simultaneously accesses buffers 13 thru 24. Or, processor A can be executing a program on buffers 1 thru 12 while processor B is digitizing into buffers 13 thru 24.

4MOBJ SOFTWARE -
4MOBJ is a library which operates with PXIPL-COC40 to provide image acquisition, display, and image access. 4MOBJ also includes TMS320C40 communication routines for program loading, execution, and PC to/from TMS320C40 communication.

SAMPLE CODE -
Detailed sample code is provided to demonstrate various function calls.

The following example code demonstrates a typical PXIPL-COC40 program. A background is subtracted from the image and a blob search is performed. The Center of Mass of the first five blobs are printed on the 4MIP Debug Screen (if in use), and also returned to the host PC program.


// Parameters passed by the host in the
// communication buffer, and results returned.
#define NBLOB   5       // number of blobs to search for
struct  parms_from_host
{
    struct c40m4image image[1]; // host stored source image
    uint   background;               // host stored subtraction value
    uint   threshold;                // host stored threshold
    union   {
        ulong   c40;            // floats returned already
        float   pc;             // converted to PC format
    } comx[NBLOB], comy[NBLOB]; // center of mass: x & y
};

main()
{
    struct  parms_from_host *pp;
    struct  pximage srcimage;
    struct  pxy search;
    struct  pxywindow size;
    struct  pxip8blob results[NBLOB];
    int     n, i;

    // Pick up pointer to parameters from host
    PP = (struct parms_from_host*) c40m4_combufp;

    // Init the pximage structures expected by image processing
    // functions from the image description passed by the host,
    // selecting image buffer and area of interest.
    c40m4_setpximage(&srcimage, &PP->image);

    // Subtract background, in place
    pxip8_pixadd(NULL, &srcimage, &srcimage, PP>background, 2);

    search.x = -1; search.y = 0;    // init search coordinates
    size.nw.x = 100; size.nw.y = 100;       // min blob size: 100x100
    size.se.x = 120; size.se.y = 130;       // max blob size: 120x130

    // Find first 5 blobs, segmented with pixel values greater
    // than the specified threshold, that meet the size constraint
    n = pxip8_bloblist(NULL, &srcimage, &search, 'g'^'t', PP>threshold,
                      0, &size, 0, NULL, NBLOBS, results, NULL);

    // Report
    c40m4_debugprintf("blobs found=%d\\n", n);
    for (i = 0; i < n; i++) {
        // Print results on 4MIP's debug screen (if in use)
        c40m4_debugprintf("blob:%d Center of Mass=%g,%g \\n", i,
                          results[i].ucom.xd,results[i].ucom.yd);
        // Store results for host processor retreival
        PP->comx[i].c40 = c40toieee(results[i].ucom.xd);
        PP->comy[i].c40 = c40toieee(results[i].ucom.yd);
    }
    return(n);
}


SPECIFICATIONS

IMAGING BOARD:
For use with 4MOBJ and: 4MEG VIDEO Model 12 (Rev. 4.3 and higher) imaging board and COC401 or COC402 processing boards.

ENVIRONMENT:

Memory requirements: Approximately 16 to 256 Kbytes, dependent upon selection of library routines.
PXIPL-COC40 must be used with 4MOBJ software.

LICENSING:
Licensing permits royalty free inclusion of library routines into programs using EPIX 4MEG VIDEO and COC40 series imaging boards.

SOFTWARE INCLUDES:
As required by the chosen environment:

Back to EPIX Software

Back to the EPIX home page

Image Processing Products For Research and Industry