top of page
| Details
Resources:
Tải Phần Mềm (ZIP File)
Hướng Dẫn Cài Đặt:
– Tiếng Anh (PDF)
– Tiếng Nhật (PDF)
Hướng Dẫn Sử Dụng:
– Tiếng Anh (PDF)
– Tiếng Nhật (PDF)
d. Mẫu Laser profile SAMPLE (để mở cùng phần mềm này)
Sample Code
load image & resize it | image imgFromFile, imgFromFileResized;;
ImageAllocate(&imgFromFile, IMAGE_GREY, width_org, height_org);
ImageAllocate(&imgFromFileResized, IMAGE_GREY, width, height);
fread_image(img_name, &imgFromFile);
resample_bilinear(&imgFromFile, &imgFromFileResized);
ImageFree(&imgFromFile);
ImageFree(&imgFromFileResized); |
save image | rc = fwrite_image(path, &(cpt.sen[0].img));
rc = fwrite_image(path, &imgFromFile); |
access to pixels | image *img; // input image
int y, x;
int row[img->dx];
memset(row, 0, img->dx*sizeof(int));
//project (sum of) columns to row [width]
for (x=0; x < img->dx; x++)
{
for (y=0; y < img->dy; y++)
{
row[x]+=img->st[y*img->pitch + x];
}
} |
snap image | // we can use vc_capt(&cpt)
// or vc_capt_request(&cpt)
// and vc_capt_wait(&cpt,-1);
// the snap times are the same (~ 35 ms)
I32 rc=0, err=0;
VCCamCfg cam;
VCCaptCfg cpt;
// init the camera
rc = vc_license_init(“vclib”);
if(rc<0){err=rc; goto end;}
rc = vc_cam_init(&cam, &cpt, NULL, NULL, NULL);
cpt.sen[0].img.type = IMAGE_GREY; //IMAGE_RGB; select this if rgb camera
if(rc<0){err=rc; goto end;}
cpt.sen[0].shutter = 12345;
rc= vc_capt(&cpt); //This function sends a request for an image acquisition and then waits for the image to be taken. There is no timeout.
rc= vc_capt_request(&cpt); // This function sends a request for an image acquisition.
// A successful image acquisition is based on a proper initialized and set up capture configuration
rc= vc_capt_wait(&cpt,-1); //This function waits for an image acquisition requested by the function named vc_capt_request() to be finished.
if(rc<0){err=rc; goto end;}
…
end:
vc_capt_deinit(&cpt);
vc_cam_deinit(&cam); |
save image | image img;
…
fwrite_image(fname, img); |
draw & fill rectangle | void drawRect(image *img, RECT r, U8 color)
{
lined(img, r.x, r.y, r.x + r.width, r.y, color);
lined(img, r.x + r.width, r.y, r.x + r.width, r.y + r.height, color);
lined(img, r.x + r.width, r.y + r.height, r.x, r.y + r.height, color);
lined(img, r.x, r.y, r.x, r.y + r.height, color);
}
void drawRect1( image *img, POINT p1, POINT p2, POINT p3, POINT p4, U8 color)
{
lined(img, p1.x, p1.y, p2.x, p2.y, color);
lined(img, p1.x, p1.y, p4.x, p4.y, color);
lined(img, p3.x, p3.y, p2.x, p2.y, color);
lined(img, p3.x, p3.y, p4.x, p4.y, color);
}
============
// use drawRect function
RECT roi;
…
drawRect(img, roi, 200);
============
POINT p1, p2, p3, p4;
…
drawRect1(img, p1, p2, p3, p4, 128);
POINT p[4];
// assign values to p
…
// fill rectangle
int pList[8];
for (x=0; x<4; x++)
{
pList[x*2] = p[x].x;
pList[x*2+1] = p[x].y;
}
fill_polygon_simple (img, 0, 4, pList, 255); |
standard error code | Most of the functions return a standard error code:
#define ERR_NONE 0 /* no error */
#define ERR_FORMAT -1 /* image format error */
#define ERR_TYPE -2 /* image type error */
#define ERR_MEMORY -3 /* out of memory */
#define ERR_LICENCE -5 /* licence required */
#define ERR_OPEN -19 /* open error */
#define ERR_MODEL -51 /* model does not fit licence */ |
measure time | double time_now()
{
struct timeval tv;
gettimeofday(&tv, NULL);
return ((double)tv.tv_sec + ((double)tv.tv_usec*1.0e-6));
} |
VC Camera
Kiểm Tra Hình Ảnh & AI
Phần mềm miễn phí (trên Linux và Windows) dành cho camera VC với ngôn ngữ tiếng Anh và tiếng Nhật.
Hỗ trợ các dòng camera VC NanoZ, VC proZ, và VC Nano 3D.

bottom of page