[GRASS-SVN] r54317 - in grass/trunk/imagery/i.ortho.photo: . i.photo.camera
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Dec 16 15:14:13 PST 2012
Author: mmetz
Date: 2012-12-16 15:14:13 -0800 (Sun, 16 Dec 2012)
New Revision: 54317
Added:
grass/trunk/imagery/i.ortho.photo/i.photo.camera/
grass/trunk/imagery/i.ortho.photo/i.photo.camera/i.ortho.camera.html
Removed:
grass/trunk/imagery/i.ortho.photo/i.photo.camera/camera.h
grass/trunk/imagery/i.ortho.photo/i.photo.camera/description.html
grass/trunk/imagery/i.ortho.photo/i.photo.camera/globals.h
grass/trunk/imagery/i.ortho.photo/i.photo.camera/mod_cam_info.c
Modified:
grass/trunk/imagery/i.ortho.photo/i.photo.camera/Makefile
grass/trunk/imagery/i.ortho.photo/i.photo.camera/main.c
Log:
i.photo.camera update
Modified: grass/trunk/imagery/i.ortho.photo/i.photo.camera/Makefile
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.camera/Makefile 2012-11-21 12:38:16 UTC (rev 53950)
+++ grass/trunk/imagery/i.ortho.photo/i.photo.camera/Makefile 2012-12-16 23:14:13 UTC (rev 54317)
@@ -1,16 +1,12 @@
MODULE_TOPDIR = ../../..
-PGM = i.photo.camera
+PGM = i.ortho.camera
-EXTRA_CFLAGS = -I../libes
+EXTRA_CFLAGS = -I../lib
-LIBES = $(IORTHOLIB) $(IMAGERYLIB) $(GISLIB) $(VASKLIB) $(CURSES) $(GMATHLIB)
-DEPENDENCIES= $(IMAGERYDEP) $(IORTHODEP) $(GISDEP) $(VASKDEP) $(GMATHDEP)
+LIBES = $(IORTHOLIB) $(IMAGERYLIB) $(GISLIB) $(GMATHLIB)
+DEPENDENCIES= $(IMAGERYDEP) $(IORTHODEP) $(GISDEP) $(GMATHDEP)
include $(MODULE_TOPDIR)/include/Make/Module.make
-default: etc
-
-$(PGM).tmp.html: description.html
- $(INSTALL_DATA) $< $@
- $(INSTALL_DATA) *.png $(GISBASE)/docs/html/
+default: cmd
Deleted: grass/trunk/imagery/i.ortho.photo/i.photo.camera/camera.h
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.camera/camera.h 2012-11-21 12:38:16 UTC (rev 53950)
+++ grass/trunk/imagery/i.ortho.photo/i.photo.camera/camera.h 2012-12-16 23:14:13 UTC (rev 54317)
@@ -1 +0,0 @@
-#include "globals.h" /* external variables */
Deleted: grass/trunk/imagery/i.ortho.photo/i.photo.camera/description.html
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.camera/description.html 2012-11-21 12:38:16 UTC (rev 53950)
+++ grass/trunk/imagery/i.ortho.photo/i.photo.camera/description.html 2012-12-16 23:14:13 UTC (rev 54317)
@@ -1,114 +0,0 @@
-<H2>DESCRIPTION</H2>
-
-<EM>i.photo.camera</EM> creates or modifies entries in a camera reference
-file. For ortho-photo rectification, a camera reference file is required for
-computation of scanned image to photo-coordinate transformation parameters.
-There are two coordinate systems: The image coordinate system (in pixels)
-and the photo coordinate system (in milli-meters). The inner orientation
-establishes a relation between the pixels and the image coordinates with
-help of fiducial marks.
-
-<P>
-
-The first prompt in the program will ask you for the name of
-the camera reference file to be created or modified. You may
-create a new camera reference file by entering a new name, or modify an
-existing camera reference file by entering the name of an existing camera file.
-
-<P>
-After entering the camera file name, following menu is displayed:
-<P>
-Please provide the following information
-
-
-<P>
-<PRE>
-
- CAMERA NAME: <EM>camera name</EM>______
- CAMERA IDENTIFICATION: <EM>identification</EM>___
- CALIBRATED FOCAL LENGTH mm.:_________________
- POINT OF SYMMETRY (X) mm.:_________________
- POINT OF SYMMETRY (Y) mm.:_________________
- MAXIMUM NUMBER OF FIDUCIALS:_________________
-
- AFTER COMPLETING ALL ANSWERS, HIT <ESC> TO CONTINUE
- (OR <Ctrl-C> TO CANCEL)
-</PRE>
-
-The camera name and identification describe the camera reference file.
-The calibrated focal length and the point of symmetry are used in computing
-the photo-to-target transformation parameters. These values should be entered
-from the camera calibration report (usually available from the photograph
-supplier).
-
-<p>
-<img src="photo.camera.png" alt="Sketch of aerial photo"><br>
-<i>This example is the camera Zeiss LMK9 265-002A belonging to the Hellenic
-Military Geographical Survey (HMGS) and calibrated in December 1985</i>
-<p>
-
-The photo coordinate system origin is the so-called calibrated principal
-point (PP, Principal Point of Symmetry) which is in the center of the image.
-The origin of the axes is at the intersection of the radii traced from the
-fiducial marks. In the ideal case of no deviations in the camera (see camera
-calibration certificate) the center is the origin and the values are 0 for
-both X and Y of Point of Symmetry. But usually the principal point does not
-fall on the intersection of the radii at the center of the picture. This
-excentricity is usually of the order of a few micrometers. <P>
-
-You are then asked to enter the X and Y photo coordinates of each fiducial
-as follows.
-These fiducials (or reseau) marks are index marks imaged on film which serve
-as reference photo coordinate system. The maximum number of fiducials will
-determine the number of fiducial or reseau coordinate pairs to be entered
-below. The origin is the center of the image (or the point of symmetry) and
-X and Y are left-right and up-down. The order is up to the user, but must be
-kept consistent throughout the rectification process.
-<P>
-
-On this screen you should enter the fiducial or
-reseau photo-coordinates as given in the camera calibration report. The X,
-and Y coordinates are in milli-meters from the principle point.
-
-<P>
-Please provide the following information
-<PRE>
- Fid# FID ID X Y
-
- 1__ _____ 0.0___ 0.0___
- 2__ _____ 0.0___ 0.0___
- 3__ _____ 0.0___ 0.0___
- 4__ _____ 0.0___ 0.0___
- 5__ _____ 0.0___ 0.0___
- 6__ _____ 0.0___ 0.0___
- 7__ _____ 0.0___ 0.0___
- 8__ _____ 0.0___ 0.0___
- 9__ _____ 0.0___ 0.0___
- 10_ _____ 0.0___ 0.0___
-
- next: end__
-
- AFTER COMPLETING ALL ANSWERS, HIT <ESC> TO CONTINUE
- (OR <Ctrl-C> TO CANCEL)
-</PRE>
-The input display is repeated until the number of MAXIMUM FIDUCIALS
-is reached.
-
-
-<H2>SEE ALSO</H2>
-
-<EM>
-<A HREF="i.ortho.photo.html">i.ortho.photo</A>,
-<A HREF="i.photo.2image.html">i.photo.2image</A>,
-<A HREF="i.photo.2target.html">i.photo.2target</A>,
-<A HREF="i.photo.init.html">i.photo.init</A>
-</EM>
-
-
-<H2>AUTHOR</H2>
-
-Mike Baba, DBA Systems, Inc.
-
-<p>
-<i>Last changed: $Date$</i>
-
Deleted: grass/trunk/imagery/i.ortho.photo/i.photo.camera/globals.h
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.camera/globals.h 2012-11-21 12:38:16 UTC (rev 53950)
+++ grass/trunk/imagery/i.ortho.photo/i.photo.camera/globals.h 2012-12-16 23:14:13 UTC (rev 54317)
@@ -1,22 +0,0 @@
-#ifdef MAIN
-#define GLOBAL
-#else
-#define GLOBAL extern
-#endif
-/* State flags Most are Toggles */
-GLOBAL char Data_Loaded; /* is there data in memory */
-
- /* used for abnormal exit logic */
-GLOBAL char Files_Open; /* is there data in memory */
-
-GLOBAL struct Ortho_Camera_File_Ref cam_info;
-
-GLOBAL char *camera;
-
-/* hold the names of files etc. mostly used by main.c */
-GLOBAL char *N_path;
-GLOBAL char *N_name;
-GLOBAL char *N_camera;
-
-/* mod_cam_info.c */
-int mod_cam_info(int, struct Ortho_Camera_File_Ref *);
Copied: grass/trunk/imagery/i.ortho.photo/i.photo.camera/i.ortho.camera.html (from rev 53950, grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.camera/description.html)
===================================================================
--- grass/trunk/imagery/i.ortho.photo/i.photo.camera/i.ortho.camera.html (rev 0)
+++ grass/trunk/imagery/i.ortho.photo/i.photo.camera/i.ortho.camera.html 2012-12-16 23:14:13 UTC (rev 54317)
@@ -0,0 +1,114 @@
+<H2>DESCRIPTION</H2>
+
+<EM>i.photo.camera</EM> creates or modifies entries in a camera reference
+file. For ortho-photo rectification, a camera reference file is required for
+computation of scanned image to photo-coordinate transformation parameters.
+There are two coordinate systems: The image coordinate system (in pixels)
+and the photo coordinate system (in milli-meters). The inner orientation
+establishes a relation between the pixels and the image coordinates with
+help of fiducial marks.
+
+<P>
+
+The first prompt in the program will ask you for the name of
+the camera reference file to be created or modified. You may
+create a new camera reference file by entering a new name, or modify an
+existing camera reference file by entering the name of an existing camera file.
+
+<P>
+After entering the camera file name, following menu is displayed:
+<P>
+Please provide the following information
+
+
+<P>
+<PRE>
+
+ CAMERA NAME: <EM>camera name</EM>______
+ CAMERA IDENTIFICATION: <EM>identification</EM>___
+ CALIBRATED FOCAL LENGTH mm.:_________________
+ POINT OF SYMMETRY (X) mm.:_________________
+ POINT OF SYMMETRY (Y) mm.:_________________
+ MAXIMUM NUMBER OF FIDUCIALS:_________________
+
+ AFTER COMPLETING ALL ANSWERS, HIT <ESC> TO CONTINUE
+ (OR <Ctrl-C> TO CANCEL)
+</PRE>
+
+The camera name and identification describe the camera reference file.
+The calibrated focal length and the point of symmetry are used in computing
+the photo-to-target transformation parameters. These values should be entered
+from the camera calibration report (usually available from the photograph
+supplier).
+
+<p>
+<img src="photo.camera.png" alt="Sketch of aerial photo"><br>
+<i>This example is the camera Zeiss LMK9 265-002A belonging to the Hellenic
+Military Geographical Survey (HMGS) and calibrated in December 1985</i>
+<p>
+
+The photo coordinate system origin is the so-called calibrated principal
+point (PP, Principal Point of Symmetry) which is in the center of the image.
+The origin of the axes is at the intersection of the radii traced from the
+fiducial marks. In the ideal case of no deviations in the camera (see camera
+calibration certificate) the center is the origin and the values are 0 for
+both X and Y of Point of Symmetry. But usually the principal point does not
+fall on the intersection of the radii at the center of the picture. This
+excentricity is usually of the order of a few micrometers. <P>
+
+You are then asked to enter the X and Y photo coordinates of each fiducial
+as follows.
+These fiducials (or reseau) marks are index marks imaged on film which serve
+as reference photo coordinate system. The maximum number of fiducials will
+determine the number of fiducial or reseau coordinate pairs to be entered
+below. The origin is the center of the image (or the point of symmetry) and
+X and Y are left-right and up-down. The order is up to the user, but must be
+kept consistent throughout the rectification process.
+<P>
+
+On this screen you should enter the fiducial or
+reseau photo-coordinates as given in the camera calibration report. The X,
+and Y coordinates are in milli-meters from the principle point.
+
+<P>
+Please provide the following information
+<PRE>
+ Fid# FID ID X Y
+
+ 1__ _____ 0.0___ 0.0___
+ 2__ _____ 0.0___ 0.0___
+ 3__ _____ 0.0___ 0.0___
+ 4__ _____ 0.0___ 0.0___
+ 5__ _____ 0.0___ 0.0___
+ 6__ _____ 0.0___ 0.0___
+ 7__ _____ 0.0___ 0.0___
+ 8__ _____ 0.0___ 0.0___
+ 9__ _____ 0.0___ 0.0___
+ 10_ _____ 0.0___ 0.0___
+
+ next: end__
+
+ AFTER COMPLETING ALL ANSWERS, HIT <ESC> TO CONTINUE
+ (OR <Ctrl-C> TO CANCEL)
+</PRE>
+The input display is repeated until the number of MAXIMUM FIDUCIALS
+is reached.
+
+
+<H2>SEE ALSO</H2>
+
+<EM>
+<A HREF="i.ortho.photo.html">i.ortho.photo</A>,
+<A HREF="i.photo.2image.html">i.photo.2image</A>,
+<A HREF="i.photo.2target.html">i.photo.2target</A>,
+<A HREF="i.photo.init.html">i.photo.init</A>
+</EM>
+
+
+<H2>AUTHOR</H2>
+
+Mike Baba, DBA Systems, Inc.
+
+<p>
+<i>Last changed: $Date$</i>
+
Modified: grass/trunk/imagery/i.ortho.photo/i.photo.camera/main.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.camera/main.c 2012-11-21 12:38:16 UTC (rev 53950)
+++ grass/trunk/imagery/i.ortho.photo/i.photo.camera/main.c 2012-12-16 23:14:13 UTC (rev 54317)
@@ -20,39 +20,35 @@
/* select_camera */
/* select a camera reference file for a given imagery group */
-#define MAIN 1
#include <stdlib.h>
#include <string.h>
-#ifdef DEBUG
-#include <unistd.h> /* for sleep() */
-#endif
-
#include <grass/gis.h>
#include <grass/glocale.h>
#include "orthophoto.h"
-#include "globals.h"
int main(int argc, char *argv[])
{
struct GModule *module;
struct Option *group_opt, *camera_opt;
+ /* options for
+ * camera name
+ * camera definition
+ * calibrated focal length
+ * principal point of symmetry x,y
+ * fiducial coordinates in mm from the principal point */
- char *location;
- char *mapset;
- char group[GNAME_MAX];
-
- static int have_old;
+ const char *location;
+ const char *mapset;
+ char *group;
char *camera;
+ struct Ortho_Camera_File_Ref cam_info;
-
- /* must run in a term window */
- G_putenv("GRASS_UI_TERM", "1");
-
G_gisinit(argv[0]);
module = G_define_module();
- module->keywords = _("imagery, orthorectify");
+ G_add_keyword(_("imagery"));
+ G_add_keyword(_("orthorectify"));
module->description =
_("Interactively select and modify the imagery group camera reference file.");
@@ -76,42 +72,34 @@
location = G_location();
mapset = G_mapset();
- strcpy(group, group_opt->answer);
+ group = group_opt->answer;
- if (!camera_opt->answer) {
- /* select the camera to use */
- if (!I_ask_camera_any(
- _("Enter a camera reference file to be used with this imagery group"),
- camera)) {
- exit(EXIT_SUCCESS);
- }
- }
- else {
+ /* group must be in current mapset */
+ if (!I_find_group(group))
+ G_fatal_error(_("No group '%s' in current mapset"), group);
+
+ if (camera_opt->answer) {
if (G_legal_filename (camera_opt->answer) < 0)
G_fatal_error(_("<%s> is an illegal file name"),
camera_opt->answer);
else
strcpy(camera, camera_opt->answer);
}
+ else {
+ /* use user-provided camera definition */
+ I_put_cam_info(camera, &cam_info);
+ }
+
/* I_put_camera (camera); */
I_put_group_camera(group, camera);
G_message(
_("Group [%s] in location [%s] mapset [%s] now has camera file [%s]"),
group, location, mapset, camera);
-#ifdef DEBUG
- /* slight pause before the screen is cleared */
- sleep(3);
-#endif
- /* show the camera info for modification */
- if (I_find_camera(camera)) {
- have_old = 1;
- I_get_cam_info(camera, &cam_info);
- }
- mod_cam_info(have_old, &cam_info);
- I_put_cam_info(camera, &cam_info);
+ /* print camera info */
+
exit(EXIT_SUCCESS);
}
Deleted: grass/trunk/imagery/i.ortho.photo/i.photo.camera/mod_cam_info.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/i.photo.camera/mod_cam_info.c 2012-11-21 12:38:16 UTC (rev 53950)
+++ grass/trunk/imagery/i.ortho.photo/i.photo.camera/mod_cam_info.c 2012-12-16 23:14:13 UTC (rev 54317)
@@ -1,111 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <grass/vask.h>
-#include "orthophoto.h"
-#include "globals.h"
-
-#define NLINES 10
-
-int mod_cam_info(int have_old, struct Ortho_Camera_File_Ref *cam_info)
-{
- long fidnum[NLINES];
- char next[20];
- char next_line[20];
- int i;
- int atnum;
- int line;
- int startfid;
- int endfid;
-
- if (!have_old)
- strcpy(cam_info->cam_name, "DBA SYSTEMS CAMERA");
-
- V_clear();
- V_line(1, " Please provide the following information:");
- V_line(2,
- "+------------------------------------------------------------------------------+");
- V_line(4, " Camera Name");
- V_line(5, " Camera Identification");
- V_line(6, " Calibrated Focal Length mm.");
- V_line(7, " Point of Symmetry: X-coordinate mm.");
- V_line(8, " Point of Symmetry: Y-coordinate mm.");
- V_line(9, " Maximum number of fiducial or reseau marks");
- V_line(11,
- "+-----------------------------------------------------------------------------+");
- V_ques(cam_info->cam_name, 's', 4, 55, 20 - 1);
- V_ques(cam_info->cam_id, 's', 5, 55, 20 - 1);
- V_ques(&(cam_info->CFL), 'd', 6, 55, 20 - 1);
- V_ques(&(cam_info->Xp), 'd', 7, 55, 20 - 1);
- V_ques(&(cam_info->Yp), 'd', 8, 55, 20 - 1);
- V_ques(&(cam_info->num_fid), 'i', 9, 55, 20 - 1);
- V_intrpt_ok();
- if (!V_call())
- exit(0);
-
- /* get fiducail or reseau info NUMLINES at a time */
- startfid = 0;
- while (startfid >= 0 && startfid < cam_info->num_fid) {
- V_clear();
- {
- V_line(1,
- " Please provide the following information:");
- V_line(2,
- "+--------------------------------------------------------------------------+");
- V_line(4,
- " Fid# Fid Id Xf Yf");
- }
- endfid =
- startfid + NLINES <=
- cam_info->num_fid + 1 ? startfid + NLINES : cam_info->num_fid;
-
- atnum = 0;
- line = 6;
- for (i = startfid; i < endfid; i++) {
-
- fidnum[atnum] = i + 1;
-
- V_const(&fidnum[atnum], 'i', line, 13, 5);
- V_ques(cam_info->fiducials[i].fid_id, 's', line, 21, 6);
- V_ques(&(cam_info->fiducials[i].Xf), 'd', line, 33, 10);
- V_ques(&(cam_info->fiducials[i].Yf), 'd', line, 49, 10);
-
- atnum++;
- line++;
- }
-
- line += 2;
- *next = 0;
-
- if (endfid >= cam_info->num_fid)
- strcpy(next, "end");
- else
- sprintf(next, "%d", endfid);
- sprintf(next_line, next);
- V_line(line, " Next:");
- V_ques(next, 's', line, 34, 5);
- V_line(line + 2,
- "+--------------------------------------------------------------------------+");
- V_intrpt_ok();
- if (!V_call())
- exit(0);
-
- if (*next == 0)
- break;
- if (strcmp(next, "end") == 0)
- break;
- if (sscanf(next, "%d", &endfid) != 1)
- continue;
- if (endfid < 0)
- endfid = 0;
- if (endfid > cam_info->num_fid) {
- endfid = cam_info->num_fid - NLINES + 1;
- if (endfid < 0)
- endfid = 0;
- }
-
- startfid = endfid;
- }
-
- return 0;
-}
More information about the grass-commit
mailing list