END_TEST START_TEST(dummy_distortion_round_trip) { /* This is the most basic distortion test: if there is no distortion, a point distorted/corrected would come back as the same point, up to floating point errors. */ double x=1., y=1.; double xres, yres; ap_52 ap = {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0}; /* no distortion */ distort_brown_affin (x, y, ap, &xres, &yres); correct_brown_affin (xres, yres, ap, &xres, &yres); ck_assert_msg( fabs(xres - x) < EPS && fabs(yres - y) < EPS, "Expected %f, %f, but got %f %f\n", x, y, xres, yres); }
END_TEST START_TEST(radial_distortion_round_trip) { /* Less basic distortion test: with radial distortion, a point distorted/corrected would come back as the same point, up to floating point errors and an error from the short iteration. */ double x=1., y=1.; double xres, yres; double iter_eps = 1e-2; /* Verified manually with calculator */ /* huge radial distortion */ ap_52 ap = {0.05, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0}; distort_brown_affin (x, y, ap, &xres, &yres); correct_brown_affin (xres, yres, ap, &xres, &yres); ck_assert_msg( fabs(xres - x) < iter_eps && fabs(yres - y) < iter_eps, "Expected %f, %f, but got %f %f\n", x, y, xres, yres); }
END_TEST START_TEST(shear_round_trip) { /* input */ double x = -1.0; // [mm] double y = 10.0; // [mm] ap_52 ap = {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0}; // affine parameters, see calibration /* output */ double xp, yp, x1, y1; distort_brown_affin (x, y, ap, &xp, &yp); correct_brown_affin (xp, yp, ap, &x1, &y1); ck_assert_msg( fabs(x1 - x) < EPS && fabs(y1 - y) < EPS, "Expected %f, %f, but got %f %f\n", x,y,x1,y1); }
END_TEST START_TEST(test_shear) { /* input */ double x = 1.0; // [mm] double y = 1.0; // [mm] ap_52 ap = {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0}; // affine parameters, see calibration /* output */ double xp, yp; distort_brown_affin (x, y, ap, &xp, &yp); ck_assert_msg( fabs(xp - 0.158529) < EPS && fabs(yp - 0.540302) < EPS, "Expected 0.158529, 0.540302, but got %f %f\n", xp, yp); }
int calibration_proc_c (/*ClientData clientData, Tcl_Interp* interp,*/ int argc, const char** argv) { int i, j, sel, i_img, k, n, sup; int intx1, inty1, intx2, inty2; coord_2d apfig1[11][11]; /* regular grid for ap figures */ coord_2d apfig2[11][11]; /* ap figures */ coord_3d fix4[4]; /* object points for preorientation */ coord_2d crd0[4][4]; /* image points for preorientation */ char filename[256], val[256]; const char *valp; //Tk_PhotoHandle img_handle; //Tk_PhotoImageBlock img_block; /* read support of unsharp mask */ fp1 = fopen ("parameters/unsharp_mask.par", "r"); if (! fp1) sup = 12; else { fscanf (fp1, "%d\n", &sup); fclose (fp1); } /* Get Selection value from TclTk */ // ChrisB: what does this do?? Set a value...... //valp = Tcl_GetVar(interp, "sel", TCL_GLOBAL_ONLY); //sel = atoi (valp); sel = 1; // set a value.... switch (sel) { case 1: /* read calibration parameter file */ fp1 = fopen_r ("parameters/cal_ori.par"); fscanf (fp1,"%s\n", fixp_name); for (i=0; i<4; i++) { fscanf (fp1, "%s\n", img_name[i]); fscanf (fp1, "%s\n", img_ori0[i]); } fscanf (fpp, "%d\n", &tiff_flag); fscanf (fp1, "%d\n", &chfield); fclose (fp1); /* create file names */ for (i=0; i<n_img; i++) { strcpy (img_ori[i], img_name[i]); strcat (img_ori[i], ".ori"); strcpy (img_addpar0[i], img_name[i]); strcat (img_addpar0[i], ".addpar0"); strcpy (img_addpar[i], img_name[i]); strcat (img_addpar[i], ".addpar"); strcpy (img_hp_name[i], img_name[i]); strcat (img_hp_name[i], "_hp"); } for (i=0; i<n_img; i++) { zoom_x[i] = imx/2, zoom_y[i] = imy/2, zoom_f[i] = 1; read_image (/*interp,*/ img_name[i], img[i]); sprintf(val, "camcanvas %d", i+1); //Tcl_Eval(interp, val); //img_handle = Tk_FindPhoto( interp, "temp"); //Tk_PhotoGetImage (img_handle, &img_block); //tclimg2cimg (interp, img[i], &img_block); sprintf(val, "newimage %d", i+1); //Tcl_Eval(interp, val); } break; case 2: puts ("Detection procedure"); strcpy(val,""); /* Highpass Filtering */ pre_processing_c (/*clientData, interp,*/ argc, argv); /* reset zoom values */ for (i=0; i<n_img; i++) { zoom_x[i] = imx/2; zoom_y[i] = imy/2; zoom_f[i] = 1; } /* copy images because the target recognition will set greyvalues to zero */ for (i=0; i<n_img; i++) { copy_images (img[i], img0[i]); } /* target recognition */ for (i=0; i<n_img; i++) { targ_rec (/*interp,*/ img[i], img0[i], "parameters/detect_plate.par", 0, imx, 1, imy, pix[i], i, &num[i]); sprintf (buf,"image %d: %d, ", i+1, num[i]); strcat(val, buf); if (num[i] > nmax) exit (1); } /* save pixel coord as approx. for template matching */ if (examine) for (i=0; i<n_img; i++) { sprintf (filename, "%s_pix", img_name[i]); fp1 = fopen (filename, "w"); for (j=0; j<num[i]; j++) fprintf (fp1, "%4d %8.3f %8.3f\n", pix[i][j].pnr, pix[i][j].x, pix[i][j].y); fclose (fp1); } sprintf(buf,"Number of detected targets, interaction enabled"); //Tcl_SetVar(interp, "tbuf", buf, TCL_GLOBAL_ONLY); //Tcl_Eval(interp, ".text delete 2"); //Tcl_Eval(interp, ".text insert 2 $tbuf"); //Tcl_SetVar(interp, "tbuf", val, TCL_GLOBAL_ONLY); //Tcl_Eval(interp, ".text delete 3"); //Tcl_Eval(interp, ".text insert 3 $tbuf"); break; case 3: pp1=0; pp2=0; pp3=0; pp4=0; for (i=0; i<n_img; i++) { sprintf (buf, "%d targets remain", num[i]); puts (buf); } fp1 = fopen_r ("parameters/man_ori.par"); for (i=0; i<n_img; i++) { fscanf (fp1, "%d %d %d %d\n", &nr[i][0], &nr[i][1], &nr[i][2], &nr[i][3]); } fclose (fp1); for (i=0; i<n_img; i++) { sprintf(val, "measure %d %d %d %d %d", nr[i][0], nr[i][1], nr[i][2], nr[i][3], i+1); //Tcl_Eval(interp, val); #if 0 // ChrisB: do we need this? valp = Tcl_GetVar(interp, "px0", TCL_GLOBAL_ONLY); pix0[i][0].x = atoi (valp); valp = Tcl_GetVar(interp, "py0", TCL_GLOBAL_ONLY); pix0[i][0].y = atoi (valp); valp = Tcl_GetVar(interp, "px1", TCL_GLOBAL_ONLY); pix0[i][1].x = atoi (valp); valp = Tcl_GetVar(interp, "py1", TCL_GLOBAL_ONLY); pix0[i][1].y = atoi (valp); valp = Tcl_GetVar(interp, "px2", TCL_GLOBAL_ONLY); pix0[i][2].x = atoi (valp); valp = Tcl_GetVar(interp, "py2", TCL_GLOBAL_ONLY); pix0[i][2].y = atoi (valp); valp = Tcl_GetVar(interp, "px3", TCL_GLOBAL_ONLY); pix0[i][3].x = atoi (valp); valp = Tcl_GetVar(interp, "py3", TCL_GLOBAL_ONLY); pix0[i][3].y = atoi (valp); #endif } /* write measured coordinates to file for next trial */ fp1 = fopen ("man_ori.dat", "w"); for (i=0; i<n_img; i++) for (j=0; j<4; j++) fprintf (fp1, "%f %f\n", pix0[i][j].x, pix0[i][j].y); fclose (fp1); break; case 4: /* read pixel coordinates of older pre-orientation */ /* read point numbers of pre-clicked points */ fp1 = fopen_r ("parameters/man_ori.par"); for (i=0; i<n_img; i++) { fscanf (fp1, "%d %d %d %d\n", &nr[i][0], &nr[i][1], &nr[i][2], &nr[i][3]); } fclose (fp1); /* read coordinates of pre-clicked points */ fp1 = fopen ("man_ori.dat", "r"); if (! fp1) break; for (i_img=0; i_img<n_img; i_img++) for (i=0; i<4; i++) { #if 0 fscanf (fp1, "%lf %lf\n", &pix0[i_img][i].x, &pix0[i_img][i].y); drawcross (interp, (int) pix0[i_img][i].x, (int) pix0[i_img][i].y, cr_sz+2, i_img, "red"); draw_pnr (interp, (int) pix0[i_img][i].x, (int) pix0[i_img][i].y, nr[i_img][i], i_img, "red"); #endif } fclose (fp1); break; case 5: puts ("Sort grid points"); for (i=0; i<n_img; i++) { /* read control point coordinates for man_ori points */ fp1 = fopen_r (fixp_name); k = 0; while ( fscanf (fp1, "%d %lf %lf %lf", &fix[k].pnr, &fix[k].x, &fix[k].y, &fix[k].z) != EOF) k++; fclose (fp1); nfix = k; /* take clicked points from control point data set */ for (j=0; j<4; j++) for (k=0; k<nfix; k++) { if (fix[k].pnr == nr[i][j]) fix4[j] = fix[k]; } /* get approx for orientation and ap */ read_ori (&Ex[i], &I[i], img_ori0[i]); fp1 = fopen (img_addpar0[i], "r"); if (! fp1) fp1 = fopen ("addpar.raw", "r"); if (fp1) { fscanf (fp1, "%lf %lf %lf %lf %lf %lf %lf", &ap[i].k1,&ap[i].k2,&ap[i].k3, &ap[i].p1,&ap[i].p2, &ap[i].scx,&ap[i].she); fclose (fp1);} else { printf("no addpar.raw\n"); ap[i].k1=ap[i].k2=ap[i].k3=ap[i].p1=ap[i].p2=ap[i].she=0.0; ap[i].scx=1.0; } /* transform clicked points */ for (j=0; j<4; j++) { pixel_to_metric (pix0[i][j].x, pix0[i][j].y, imx,imy, pix_x, pix_y, &crd0[i][j].x, &crd0[i][j].y, chfield); correct_brown_affin (crd0[i][j].x, crd0[i][j].y, ap[i], &crd0[i][j].x, &crd0[i][j].y); } /* raw orientation with 4 points */ raw_orient (Ex[i], I[i], ap[i], mmp, 4, fix4, crd0[i], &Ex[i]); sprintf (filename, "raw%d.ori", i); write_ori (Ex[i], I[i], filename); /* sorting of detected points by back-projection */ sortgrid_man (/*interp,*/ Ex[i], I[i], ap[i], mmp, imx,imy, pix_x,pix_y, nfix, fix, num[i], pix[i], chfield, i); /* adapt # of detected points */ num[i] = nfix; for (j=0; j<nfix; j++) { #if 0 if (pix[i][j].pnr < 0) continue; intx1 = (int) pix[i][j].x ; inty1 = (int) pix[i][j].y ; drawcross (interp, intx1, inty1, cr_sz, i, "white"); draw_pnr (interp, intx1, inty1, fix[j].pnr, i, "white"); #endif } } /* dump dataset for rdb */ if (examine == 4) { /* create filename for dumped dataset */ sprintf (filename, "dump_for_rdb"); fp1 = fopen (filename, "w"); /* write # of points to file */ fprintf (fp1, "%d\n", nfix); /* write point and image coord to file */ for (i=0; i<nfix; i++) { fprintf (fp1, "%4d %10.3f %10.3f %10.3f %d ", fix[i].pnr, fix[i].x, fix[i].y, fix[i].z, 0); for (i_img=0; i_img<n_img; i_img++) { if (pix[i_img][i].pnr >= 0) { /* transform pixel coord to metric */ pixel_to_metric (pix[i_img][i].x, pix[i_img][i].y, imx,imy, pix_x, pix_y, &crd[i_img][i].x, &crd[i_img][i].y, chfield); fprintf (fp1, "%4d %8.5f %8.5f ", pix[i_img][i].pnr, crd[i_img][i].x, crd[i_img][i].y); } else { fprintf (fp1, "%4d %8.5f %8.5f ", pix[i_img][i].pnr, 0.0, 0.0); } } fprintf (fp1, "\n"); } fclose (fp1); printf ("dataset dumped into %s\n", filename); } break; case 6: puts ("Orientation"); strcpy(buf, ""); for (i_img=0; i_img<n_img; i_img++) { for (i=0; i<nfix ; i++) { pixel_to_metric (pix[i_img][i].x, pix[i_img][i].y, imx,imy, pix_x, pix_y, &crd[i_img][i].x, &crd[i_img][i].y, chfield); crd[i_img][i].pnr = pix[i_img][i].pnr; } /* save data for special use of resection routine */ if (examine == 4) { printf ("try write resection data to disk\n"); /* point coordinates */ sprintf (filename, "resect_%s.fix", img_name[i_img]); write_ori (Ex[i_img], I[i_img], img_ori[i_img]); fp1 = fopen (filename, "w"); for (i=0; i<nfix; i++) fprintf (fp1, "%3d %10.5f %10.5f %10.5f\n", fix[i].pnr, fix[i].x, fix[i].y, fix[i].z); fclose (fp1); /* metric image coordinates */ sprintf (filename, "resect_%s.crd", img_name[i_img]); fp1 = fopen (filename, "w"); for (i=0; i<nfix; i++) fprintf (fp1, "%3d %9.5f %9.5f\n", crd[i_img][i].pnr, crd[i_img][i].x, crd[i_img][i].y); fclose (fp1); /* orientation and calibration approx data */ write_ori (Ex[i_img], I[i_img], "resect.ori0"); fp1 = fopen ("resect.ap0", "w"); fprintf (fp1, "%f %f %f %f %f %f %f", ap[i_img].k1, ap[i_img].k2, ap[i_img].k3, ap[i_img].p1, ap[i_img].p2, ap[i_img].scx, ap[i_img].she); fclose (fp1); printf ("resection data written to disk\n"); } /* resection routine */ /* ================= */ if (examine != 4) orient (/*interp,*/ Ex[i_img], I[i_img], ap[i_img], mmp, nfix, fix, crd[i_img], &Ex[i_img], &I[i_img], &ap[i_img], i_img); /* ================= */ /* resection with dumped datasets */ if (examine == 4) { printf("Resection with dumped datasets? (y/n)"); scanf("%s",buf); if (buf[0] != 'y') continue; strcpy (buf, ""); /* read calibration frame datasets */ for (n=0, nfix=0, dump_for_rdb=0; n<100; n++) { sprintf (filename, "resect.fix%d", n); fp1 = fopen (filename, "r"); if (! fp1) continue; printf("reading file: %s\n", filename); printf ("reading dumped resect data #%d\n", n); k = 0; while ( fscanf (fp1, "%d %lf %lf %lf", &fix[nfix+k].pnr, &fix[nfix+k].x, &fix[nfix+k].y, &fix[nfix+k].z) != EOF) k++; fclose (fp1); /* read metric image coordinates */ sprintf (filename, "resect_%d.crd%d", i_img, n); printf("reading file: %s\n", filename); fp1 = fopen (filename, "r"); for (i=nfix; i<nfix+k; i++) fscanf (fp1, "%d %lf %lf", &crd[i_img][i].pnr, &crd[i_img][i].x, &crd[i_img][i].y); nfix += k; } /* resection */ orient (/*interp,*/ Ex[i_img], I[i_img], ap[i_img], mmp, nfix, fix, crd[i_img], &Ex[i_img], &I[i_img], &ap[i_img], i_img); } /* save orientation and additional parameters */ write_ori (Ex[i_img], I[i_img], img_ori[i_img]); fp1 = fopen (img_addpar[i_img], "w"); fprintf (fp1, "%f %f %f %f %f %f %f", ap[i_img].k1, ap[i_img].k2, ap[i_img].k3, ap[i_img].p1, ap[i_img].p2, ap[i_img].scx, ap[i_img].she); fclose (fp1); } //Tcl_Eval(interp, ".text delete 3"); //Tcl_Eval(interp, ".text delete 1"); //Tcl_Eval(interp, ".text insert 1 \"Orientation and self calibration \""); //Tcl_Eval(interp, ".text delete 2"); //Tcl_Eval(interp, ".text insert 2 \"...done, sigma0 for each image -> \""); //Tcl_SetVar(interp, "tbuf", buf, TCL_GLOBAL_ONLY); //Tcl_Eval(interp, ".text insert 3 $tbuf"); break; case 7: checkpoint_proc (/*interp*/); #if 0 sprintf(val,"blue: planimetry, yellow: height"); Tcl_SetVar(interp, "tbuf", val, TCL_GLOBAL_ONLY); Tcl_Eval(interp, ".text delete 2"); Tcl_Eval(interp, ".text insert 2 $tbuf"); Tcl_SetVar(interp, "tbuf", buf, TCL_GLOBAL_ONLY); Tcl_Eval(interp, ".text delete 3"); Tcl_Eval(interp, ".text insert 3 $tbuf"); #endif break; case 8: /* draw additional parameter figures */ //Tcl_Eval(interp, "clearcam"); /* read orientation and additional parameters */ for (i=0; i<n_img; i++) read_ori (&Ex[i], &I[i], img_ori[i]); for (i=0; i<n_img; i++) { fp1 = fopen_r (img_addpar[i]); fscanf (fp1,"%lf %lf %lf %lf %lf %lf %lf", &ap[i].k1, &ap[i].k2, &ap[i].k3, &ap[i].p1, &ap[i].p2, &ap[i].scx, &ap[i].she); fclose (fp1); } for (i_img=0; i_img<n_img; i_img++) { /* create undistorted grid */ for (i=0; i<11; i++) for (j=0; j<11; j++) { apfig1[i][j].x = i * imx/10; apfig1[i][j].y = j * imy/10; } /* draw undistorted grid */ for (i=0; i<10; i++) for (j=0; j<10; j++) { intx1 = (int) apfig1[i][j].x; inty1 = (int) apfig1[i][j].y; intx2 = (int) apfig1[i+1][j].x; inty2 = (int) apfig1[i][j+1].y; //drawvector (interp, intx1, inty1, intx2, inty1, 1, i_img, "black"); //drawvector (interp, intx1, inty1, intx1, inty2, 1, i_img, "black"); } for (j=0; j<10; j++) { intx1 = (int) apfig1[10][j].x; inty1 = (int) apfig1[10][j].y; inty2 = (int) apfig1[10][j+1].y; //drawvector (interp, intx1, inty1, intx1, inty2, 1, i_img, "black"); } for (i=0; i<10; i++) { intx1 = (int) apfig1[i][10].x; inty1 = (int) apfig1[i][10].y; intx2 = (int) apfig1[i+1][10].x; //drawvector (interp, intx1, inty1, intx2, inty1, 1, i_img, "black"); } /* distort grid */ for (i=0; i<11; i++) for (j=0; j<11; j++) { /* transform to metric, distort and re-transform */ pixel_to_metric (apfig1[i][j].x, apfig1[i][j].y, imx,imy, pix_x,pix_y, &apfig2[i][j].x, &apfig2[i][j].y, chfield); distort_brown_affin (apfig2[i][j].x, apfig2[i][j].y, ap[i_img], &apfig2[i][j].x, &apfig2[i][j].y); metric_to_pixel (apfig2[i][j].x, apfig2[i][j].y, imx,imy, pix_x,pix_y, &apfig2[i][j].x, &apfig2[i][j].y, chfield); /* exaggerate distortion by factor 5 */ apfig2[i][j].x = 5*apfig2[i][j].x - 4*apfig1[i][j].x; apfig2[i][j].y = 5*apfig2[i][j].y - 4*apfig1[i][j].y; } /* draw distorted grid */ for (i=0; i<10; i++) for (j=0; j<10; j++) { intx1 = (int) apfig2[i][j].x; inty1 = (int) apfig2[i][j].y; intx2 = (int) apfig2[i+1][j].x; inty2 = (int) apfig2[i+1][j].y; //drawvector (interp, intx1, inty1, intx2, inty2, 3, i_img, "magenta"); intx2 = (int) apfig2[i][j+1].x ; inty2 = (int) apfig2[i][j+1].y ; //drawvector (interp, intx1, inty1, intx2, inty2, 3, i_img, "magenta"); } for (j=0; j<10; j++) { intx1 = (int) apfig2[10][j].x; inty1 = (int) apfig2[10][j].y; intx2 = (int) apfig2[10][j+1].x; inty2 = (int) apfig2[10][j+1].y; //drawvector (interp, intx1, inty1, intx2, inty2, 3, i_img, "magenta"); } for (i=0; i<10; i++) { intx1 = (int) apfig2[i][10].x; inty1 = (int) apfig2[i][10].y; intx2 = (int) apfig2[i+1][10].x; inty2 = (int) apfig2[i+1][10].y ; //drawvector (interp, intx1, inty1, intx2, inty2, 3, i_img, "magenta"); } } break; } return TCL_OK; }
int mouse_proc_c (int click_x, int click_y, int kind, int num_image, volume_par *vpar, \ control_par *cpar){ int i, j, n, zf; double x, y; double xa12, xb12, ya12, yb12; int k, pt1, intx1, inty1, count, intx2, inty2, pt2; candidate cand[maxcand]; printf("entered mouse_proc_c \n"); if (zoom_f[0] == 1) {zf = 2;} else { zf = zoom_f[0];} n=num_image; if (examine) zf *= 2; switch (kind) { /* -------------------------- MIDDLE MOUSE BUTTON ---------------------------------- */ case 3: /* generate epipolar line segments */ /* get geometric coordinates of nearest point in img[n] */ x = (float) (click_x - cpar->imx/2)/zoom_f[n] + zoom_x[n]; y = (float) (click_y - cpar->imy/2)/zoom_f[n] + zoom_y[n]; pixel_to_metric (&x, &y, x,y, cpar); x -= I[n].xh; y -= I[n].yh; correct_brown_affin (x, y, ap[n], &x, &y); k = nearest_neighbour_geo (geo[n], num[n], x, y, 0.05); if (k == -999){ printf ("No point near click coord! Click again! \n"); return -1; } pt1 = geo[n][k].pnr; intx1 = (int) ( cpar->imx/2 + zoom_f[n] * (pix[n][pt1].x-zoom_x[n])); inty1 = (int) ( cpar->imy/2 + zoom_f[n] * (pix[n][pt1].y-zoom_y[n])); rclick_points_intx1=intx1; rclick_points_inty1=inty1; //drawcross (interp, intx1, inty1, cr_sz+2, n, "BlueViolet"); printf ( "pt1,nx,ny,n,sumg: %d %d %d %d %d\n", pt1, pix[n][pt1].nx, pix[n][pt1].ny, pix[n][pt1].n, pix[n][pt1].sumg); for (i = 0; i < cpar->num_cams; i++) if (i != n) { /* calculate epipolar band in img[i] */ epi_mm (i, geo[n][k].x,geo[n][k].y, Ex[n],I[n], G[n], Ex[i],I[i], G[i], *(cpar->mm), vpar, &xa12, &ya12, &xb12, &yb12); /* search candidate in img[i] */ printf("\ncandidates in img: %d\n", i); find_candidate_plus_msg (geo[i], pix[i], num[i], xa12, ya12, xb12, yb12, pix[n][pt1].n, pix[n][pt1].nx, pix[n][pt1].ny, pix[n][pt1].sumg, cand, &count, i, vpar, cpar); distort_brown_affin (xa12,ya12, ap[i], &xa12,&ya12); distort_brown_affin (xb12,yb12, ap[i], &xb12,&yb12); xa12 += I[i].xh; ya12 += I[i].yh; xb12 += I[i].xh; yb12 += I[i].yh; metric_to_pixel(&xa12, &ya12, xa12, ya12, cpar); metric_to_pixel(&xb12, &yb12, xb12, yb12, cpar); intx1 = (int) ( cpar->imx/2 + zoom_f[i] * (xa12 - zoom_x[i])); inty1 = (int) ( cpar->imy/2 + zoom_f[i] * (ya12 - zoom_y[i])); intx2 = (int) ( cpar->imx/2 + zoom_f[i] * (xb12 - zoom_x[i])); inty2 = (int) ( cpar->imy/2 + zoom_f[i] * (yb12 - zoom_y[i])); rclick_intx1[i]=intx1; rclick_inty1[i]=inty1; rclick_intx2[i]=intx2; rclick_inty2[i]=inty2; // drawvector ( interp, intx1, inty1, intx2, inty2, 1, i, val); rclick_count[i]=count; for (j=0; j<count; j++) { pt2 = cand[j].pnr; intx2 = (int) ( cpar->imx/2 + zoom_f[i] * (pix[i][pt2].x - zoom_x[i])); inty2 = (int) ( cpar->imy/2 + zoom_f[i] * (pix[i][pt2].y - zoom_y[i])); rclick_points_x1[i][j]=intx2; rclick_points_y1[i][j]=inty2; //drawcross (interp, intx2, inty2, cr_sz+2, i, "orange"); } } break; case 4: /* delete points, which should not be used for orientation */ j = kill_in_list (n, num[n], click_x, click_y); if (j != -1) { num[n] -= 1; printf ("point %d deleted", j); } else { printf ("no point near click coord !"); } break; } printf("finished mouse_proc_c \n"); return 0; }