⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ic2wc.c

📁 做立体视觉时的标定算法
💻 C
字号:
/*******************************************************************************\*                                                                               ** This program allows a user to interactively convert 2D image coordinates      ** into 3D world coordinates.  The perform the conversion the program requires   ** a calibrated camera model of the form generated by ccal, ccal_fo, n_al,       ** or ncal_fo.                                                                   **                                                                               ** History                                                                       ** -------                                                                       **                                                                               ** 01-Apr-95  Reg Willson (rgwillson@mmm.com) at 3M St. Paul, MN                 **       Filename changes for DOS port.                                          **                                                                               ** 30-May-93  Reg Willson (rgw@cs.cmu.edu) at Carnegie-Mellon University         **       Original implementation.                                                **                                                                               *\*******************************************************************************/#include <stdio.h>#include <math.h>#include "cal_main.h"#define MIN_X	0#define MAX_X	575#define MIN_Y	0#define MAX_Y	383main (argc, argv)    int       argc;    char    **argv;{    FILE     *data_fd;    double    Xw,              Yw,              Zw,              Xf,              Yf,              atof ();    char      temp[256];    if (argc != 2) {	(void) fprintf (stderr, "syntax: %s datafile\n", argv[0]);	exit (-1);    }    /* load up the camera parameters and calibration constants from the given data file */    if ((data_fd = fopen (argv[1], "r")) == NULL) {	(void) fprintf (stderr, "%s: unable to open file \"%s\"\n", argv[0], argv[1]);	exit (-1);    }    load_cp_cc_data (data_fd, &cp, &cc);    fclose (data_fd);    (void) fprintf (stdout, "\n Input file: %s\n\n", argv[1]);    print_cp_cc_data (stdout, &cp, &cc);    while (1) {	/* prompt for the image coordinates and Zw coordinate */	(void) fprintf (stdout, "\n Enter Xf [%d:%d] : ", MIN_X, MAX_X);	if (gets (temp) == NULL)	    break;	Xf = atof (temp);	(void) fprintf (stdout, "\n Enter Yf [%d:%d] : ", MIN_Y, MAX_Y);	if (gets (temp) == NULL)	    break;	Yf = atof (temp);	(void) fprintf (stdout, "\n Enter Zw [mm] : ");	if (gets (temp) == NULL)	    break;	Zw = atof (temp);	/* determine the corresponding X and Y world coordinates */	image_coord_to_world_coord (Xf, Yf, Zw, &Xw, &Yw);	(void) fprintf (stdout,			"\n    [Xf,Yf], Zw = [%.2lf, %.2lf], %.2lf  -->  [Xw,Yw,Zw] = [%.2lf, %.2lf, %.2lf]\n",			Xf, Yf, Zw, Xw, Yw, Zw);    }    (void) fprintf (stdout, "\n\n");    return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -