EPIX, Inc. Home Page
4MOBJ Library

Programming Library for 4MEG VIDEO

  • Quick & Easy Access to 4MEG VIDEO Series.
  • C/C++ Library for 16 & 32 bit DOS Programs.
  • DLL for 16 & 32 bit Windows Applications.
  • High Level Functions Avoid I/O Port Pokes.
  • RS-170 or CCIR Formats.
  • Custom Area-Scan or Line-Scan Formats.
  • Analog or Digital Video Interfaces.
  • Control Multiple 4MEG VIDEO's & Cameras.
  • Access On-Board TMS320C2x DSP Accelerator.
  • Access Optional TMS320C40 DSP Accelerator(s).
  • Image Sequence Capture.
  • Triggered Image Capture.

The 4MOBJ Library empowers C/C++ and Windows programmers to control the 4MEG VIDEO series of imaging boards.

4MOBJ supports all versions and options of the 4MEG VIDEO series:(1)

  • The Model 5 with 1 to 4 Megabytes image memory and 5 MIPS DSP,
  • The Model 10 with 1 to 4 Megabytes image memory and 10 MIPS DSP,
  • The Model 12 with 4 to 64 Megabytes image memory and 12 MIPS DSP,
  • The IMAGE MEMORY EXPANSION for the Model 12 with 4 to 256 Megabytes image memory, and
  • The COC40 series for the Model 12 with single or dual 275 MOPS DSP(s).

Up to eight 4MEG VIDEO's, of the same version and with the same options, can be operated selectively or simultaneously; allowing sequential control for extended image sequences, parallel control for multi-camera vision, or ping-pong control for increased processing throughput.

Through the unique flexibility of 4MOBJ and the 4MEG VIDEO, a nearly endless variety of cameras and sensors are supported: RS-170, CCIR, nonstandard area-scan, line-scan, digital, analog, high frame rate, or high pixel clock rate.

4MOBJ provides high level services, allowing programmers to concentrate on the imaging application, rather than board level programming and I/O ports. For virtually all applications, the programming details described in the 4MEG VIDEO User's Manual can be ignored!

4MOBJ automatically recognizes different versions and options of the 4MEG VIDEO, providing consistent access to features, and hiding hardware details and differences. Fundamental services, such as capturing, displaying, setting resolution, and accessing image data and lookup tables, are compatible with "C" libraries for other EPIX imaging board families; allowing easy porting and reuse of application programs.

The 4MOBJ C/C++ libraries of object code allow embedding 4MEG VIDEO control into user-written applications. Under Windows, the 4MOBJ DLL also enables access from existing Windows applications which support "hooks" into DLLs.

4MOBJ allows user-written programs to apply the 4MEG VIDEO to applications such as image enhancement, archival, analysis, and measurement; video format conversion; event and motion study; document capture; cine-loop, CT, MR, and ultrasound image capture; particle analysis; visual inspection; machine vision and quality control. Join the scientists and engineers in medical, industrial, and research environments who rely on EPIX for imaging solutions.


Flexible Video Formats - Capture and display standard monochrome RS-170 and CCIR formats, as well as most nonstandard area-scan or line-scan formats. (Consult the Camera Compatibility Guide for a list of supported cameras and formats).

Images captured from nonstandard sensors are optionally displayed in RS-170, CCIR, or other formats. Images captured from all video formats can be displayed on the S/VGA (Windows versions).

Quick Video Configuration - The QUICK SET VIDEO programs, provided with any of the 4MIP Interactive Programs, provide quick, custom configuration for non-standard cameras and video formats. Nonstandard video formats, once configured and verified under 4MIP, are readily imported into the 4MOBJ environment.

Flexible Video Modes - Set the number of pixels per line, subsampling of pixels within line, lines per field, and subsampling of lines within a field. Set genlock vs. master mode. Capture/display interlaced video as a single interlaced image; as two images, one per field; or as a single image of the odd or even field. Video rate selection of capture/display image buffer. Set split screen capture/display.

Tradeoff capture resolution against number of buffers. With 4Mbyte image memory, for example, resolution of 512x240 yields 34 image buffers, 752x480 yields 11 image buffers, and 2048x2048 yields 1 image buffer.

Display Control - Magnify (zoom) display, set pan and scroll positions. Set RGB output lookup tables, set position and color of hardware cursor, AOI box, and 64x64 icon.(2) For boards without hardware feature(s), draw and erase software cursor and AOI box.

Camera & Device Control - Sense external input signal, control external output signal. Set camera mode bits. Obtain elapsed field time. Set A-D gain and offset.(2) Request interrupts to application program at each vertical blanking.(3)

Image Access - Read and write image buffers with efficient block read and write, or with convenient single pixel read and write. Read and write pixels sequentially within area of interest, without concern for AOI boundaries or line interlacing. Efficient read, write, or modification of lists of pixels in nonconsecutive locations. Direct access to image memory with "C" pointer.

Multiple 4MEG VIDEO Units - Control one to eight 4MEG VIDEO imaging boards, selecting any subset to be affected by subsequent operations. Multiple units need not be locked to common video timing, nor set to common video format. Under software control, multiple units support serial usage (capture or display image buffers of unit one, then unit two, etc.), parallel usage (capture or display all units simultaneously(4)), or any serial, parallel combination.

TMS320C40 DSP - Load and execute user written assembler or "C" TMS320C40 image processing programs. Loader provides run-time relocation of programs. Macros and subroutines for host and TMS320C40 simplify inter-processor communication.

TMS320C2x DSP - Execute user written TMS320C2X image processing programs.(5) Programs included for histogram; pixel count; mean; pixel and, or, xor, set, threshold, complement; image pair add, subtract, copy, and, or, xor; morphological erode, dilate, boundary, medial axis; 3x3 convolution; image sequence average and subtraction.

Easy Programming - All basic features available via Simple C Functions (SCF); easy to use subroutines don't require familiarity with "C" structures, pointers, etc. An example source program demonstrates use of SCF subroutines. Additionally, an extended "structured" and "object oriented" interface provides complete control of video formats, resolutions, features and options.

High Level Services - Services such as image buffer access are "logically correct", providing interlaced data in "world view order", and independent of camera scanning or internal memory configurations.

Many 4MOBJ services support "no-wait" and "check for completion" modes. During frame capture the PC is not locked into waiting for the next vertical blanking interval, but can proceed with concurrent processing.

4MOBJ provides high level services and automatic recognition of hardware versions and options, but doesn't support every compiler or environment.

An alternative, 4MCODE provides a "C" source example and exposition of 4MEG VIDEO programming. Unlike 4MOBJ, 4MCODE serves programmers familiar with 4MEG VIDEO board level control, I/O ports, and TMS320C2x coding. Programmers can study and mutate the provided example to fit the application's needs, rather than "starting from scratch". As source code, the 4MCODE can be used with virtually all "C" compilers, or translated for use in other languages.

For simplicity, 4MCODE does not provide hardware version recognition or run-time video reconfiguration to arbitrary resolution. Instead, the supported hardware and one or more video formats and resolutions are selected as the program is written and compiled.


Image memory access examples
pxd_m4open("RS-170", 0);		  // Use standard RS-170, or
//pxd_m4open("CCIR", 0);		  // .. CCIR, or
//pxd_m4open("VIDEO.FMT", 0);		  // .. nonstandard video?
pxd_snap('s', 1L, 0, 0, 0);		  // snap image into buffer 1

// Using easy, buffered, sequential, access
unsigned char	buf[512];		  // any convenient size
unsigned long	count = 0;
int	 i, j;
pxd_iopen(0, 0L, 0, 0, 256, 256, 'r');	  // open access to read 256x256 AOI
while (i = pxd_ioc(0, buf, sizeof(buf)))  // read one or more lines
    for (j = 0; j < i; j++)		  // scan and ..
	if (buf[j] < 64)		  // .. test and count pixels
	    count++;			  // .. with value less than 64

// Using direct memory access
unsigned long adrs, size, l;
unsigned char _far p;			  // not _far in Win 95 & others
adrs = pxvid_xyadrs(pxd_defimage(1L,0,0,-1,-1),0,0); // adrs of pixel 0, 0
size = (long)pxd_xdim()*pxd_ydim()*(pxd_ylace()+1);  // size of buffer 1
while (size) {
    p = pxdrv_imap(adrs, &l);		  // get pointer & max access length
    l = min(size, l); size -= l;	  // housekeeping
    while (l--) 			  // scan and ..
	if (*p++ < 64)			  // .. test and count pixels
	    count++;			  // .. with value less than 64

Image capture and VGA display example (Windows)
HDC  hDC; RECT   rect; 
pxd_m4open("RS-170", 0);		    // Use standard RS-170, or
//pxd_m4open("CCIR", 0);		    // .. CCIR, or
//pxd_m4open("VIDEO.FMT", 0);		    // .. nonstandard video?

hDC = GetDC(hWnd);			    // get handle to window
GetClientRect(hWnd, &rect);		    // get size of window
rect.right++; rect.bottom++;		    // inclusive-> exclusive
SetStretchBltMode(hDC,STRETCH_DELETESCANS); // set window modes

pxd_snap('s', 1L, 0, 0, 0);		    // snap image into buffer 1
pxd_StretchDIBits(1L, 0, 0, -1, -1,	    // specify image buffer & AOI
	    0, 0, hDC,			    // specify window
	    rect.right/4, rect.bottom/4,    // window upper left corner
	    rect.right/2, rect.bottom/2,    // window size
	    0); 			    // display!

ReleaseDC(hWnd, hDC);			    // release handle

Image capture and save example
pxd_m4open("RS-170", 0);		  // Use standard RS-170, or
//pxd_m4open("CCIR", 0);		  // ..CCIR, or
//pxd_m4open("VIDEO.FMT", 0);		  // ..nonstandard video format
					  // ..created by QUICK SET VIDEO

pxd_snap('s', 2L, 0, 0, 0);		  // snap image into buffer 2
pxd_bmpsave("IMAGE.BMP",2L,0,0,256,128);  // save 256x128 AOI to file
					  // ..in .bmp format (available
					  // In DOS versions too!)

pxd_snap('s', 1L, 0, 0, 0);		  // snap image into buffer 1
pxd_pxcsave("IMAGE.PCX",1L,0,0,-1,-1);	  // save full AOI to file
                                          // In .pcx format

Interactive sequence capture and video display example
long	b;
pxd_m4open("RS-170", 0);		  // Use standard RS-170, or
//pxd_m4open("CCIR", 0);		  // .. CCIR, or
//pxd_m4open("VIDEO.FMT", 0);		  // .. nonstandard video?

for (b = 1; b <= pxd_imbufs(); b++) {	  // Run thru all buffers.
    pxd_video('z', b);			  // Capture into buffer 'b'.
    printf("Key ENTER to capture buffer #%ld\\n", b);
    while (getchar() != '\\n') ;	   // Wait for user trigger.
pxd_video('p', 1);			  // Display buffer 1.

printf("Buffer #1 displayed. Key ENTER to display sequence\\n");
while (getchar() != '\\n') ;		   // Wait for user trigger.
for (b = 2; b <= pxd_imbufs(); b++) {	  // Run thru all buffers
    unsigned long t;			  // .. without trigger,
    t = pxd_vidtime();			  // .. displaying each buffer
    while (t+30 < pxd_vdtime()) ;	  // .. for 30 field times.
    pxd_video('p', b);			  // Display buffer 'b'



Any 4MEG VIDEO series, Model 5, Model 10, or Model 12, imaging board. Also supports the IMAGE MEMORY EXPANSION and the COC40 series for use with the Model 12.

Up to eight 4MEG VIDEO series imaging boards of identical version and configuration, but with unique I/O port addresses, can be controlled simultaneously.

Standard versions support:

Other versions available on request.
DOS memory requirements: Approx. 64 to 96 Kbytes, dependent upon selection of library routines.

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


Loads user written TMS320C20 and TMS320C25 imaging programs assembled by AVOCET or TEXAS INSTRUMENTS tools; and TMS320C40 imaging programs assembled or compiled with TEXAS INSTRUMENTS tools.(6)

A symbolic debugger for TMS320C40 imaging programs is available in the 4MIP Interactive Image Analysis(6) program.

  1. Software may require upgrade to operate future versions or options of the 4MEG VIDEO.
  2. For imaging boards equipped with corresponding hardware feature.
  3. Interrupt callbacks not available under Windows or protected mode DOS extenders.
  4. The degree of simultaneity is fundamentally dependent on video timing synchronization.
  5. With optional COC40.
  6. These tools are not included with 4MOBJ.

Back to EPIX Software

Back to the EPIX home page

Image Processing Products For Research and Industry