|
|
![]() |
![]() |
![]() |
![]() |
![]() |
| Features | Download | Buy | News | Support |
![]() |
![]() |
![]() |
![]() |
![]() |
All WiT operators are implemented as C functions in DLLs. So if you are more comfortable with writing your own C/C++ programs, you can use the WiT libraries for image processing and analysis directly from you C/C++ program. The programming API for WiT operator functions are very natural for C programming and are fully documented. You can use WiT for prototyping, then use the C code generator to generate code that you can insert into your C/C++ application. You can also bypass the entire WiT and igraph concept and code directly in C right from the beginning. The following is a trivial yet complete example console application using WiT libraries:
#include "corObj.h"
#include "wSystem.h"
main(void)
{
CorImage im;
CorObjInit(NULL, NULL);
if (cor_rdImage(&im, "../data/sample2.bmp", 0) != COR_OP_OK) {
printf("Failed\n");
} else {
int x, y;
CorUByte min, max;
int w = CorObj_width(&im);
int h = CorObj_height(&im);
CorUByte *ip = CorObj_mdData(&im);
min = max = *ip;
for (y=0; y<h; ++y) {
for (x=0; x<w; ++x) {
if (*ip < min) min = *ip;
if (*ip > max) max = *ip;
++ip;
}
}
printf("Size: %dx%d, range: %d-%d\n",
w, h, min, max);
CorImageFree(&im);
}
CorObjExit();
}
Even acquiring images is easy. The following example shows how to acquire one frame using a DirectShow compatible camera and writing the image out as a BMP file:
#include "CorObj.h"
#include "wdShow.h"
#include "wSystem.h"
void main(void)
{
CorLibCaps dsCaps;
CorContext context;
GFrame mf;
CorObj im;
mf = CorGuiInit(NULL, NULL);
dShowOpen(mf, &dsCaps);
context.libContext = dsCaps.contexts[0];
context.opContext = NULL;
dShowAcquire(&context, &im, NULL, 1, 0);
cor_writeImage(((CorImage *)(CorObj_image(&im))),
"grab.bmp", 5, 0, 0, 75, 0, 0, 2, 0, 1);
CorObjRelease(&im);
dShowClose(&dsCaps);
CorGuiExit(mf);
}