home *** CD-ROM | disk | FTP | other *** search
/ vis-ftp.cs.umass.edu / vis-ftp.cs.umass.edu.tar / vis-ftp.cs.umass.edu / pub / Software / ASCENDER / ascender.tar.Z / ascender.tar / Epipolar / epidefs.lisp < prev    next >
Lisp/Scheme  |  1996-02-20  |  4KB  |  133 lines

  1. ;;; EPIDEFS.LISP
  2. ;;;
  3. ;;; Global variable and function definitions for the epipolar matcher
  4. ;;;
  5. ;;; Author: Robert T. Collins
  6. ;;; Date: Mar 1, 1995
  7. ;;; based on my earlier epipolar.lisp, written Dec 28, 1993
  8. ;;;
  9. ;-----------------------------------------------------------------
  10. ; (c) Copyright 1995 by The University of Massachusetts
  11. ;------------------------------------------------------------------
  12.  
  13. (in-package 'epipolar :nicknames '(epi))
  14.  
  15.  
  16. (defvar *RCDE* nil  "tells whether we are running under RCDE")
  17. (defvar *demo-mode* nil "tells whether to display things while processing")
  18. (defvar *debug-mode* nil "tells whether to print informational messages")
  19. (defvar *pause-mode* nil "either :views, :lines, or nil")
  20. (defvar *topdown-line-finder* t   ;;BobC 2/20/96 - default is topdown
  21.    "whether to use the topdown line finder rather than the ISR")
  22.  
  23. (defvar *num-z-buckets* 24 "default number of histogram buckets")
  24. (defvar *current-histogram* nil "height histogram for this image")
  25. (defvar *accum-histogram* nil "accumulated height histogram")
  26.  
  27. ;;; The following values must be set for each site.
  28.  
  29. (defvar *lowz* nil)
  30. (defvar *highz* nil)
  31. (defvar *midz* nil)
  32.  
  33. (defun set-global-height-range (lowz highz)
  34.   "Set the global height range used by the epipolar matching system"
  35.   (setf *lowz* lowz)
  36.   (setf *highz* highz)
  37.   (setf *midz* (+ *lowz* (/ (- *highz* *lowz*) 2.0)))
  38.   (list *lowz* *highz*))
  39.  
  40.  
  41. ;;;----------------------------------------------------------------
  42. ;;; Display windows (only used when *demo-mode* is t)
  43.  
  44. (defvar *epipolar-display-frame* nil "Frame containing epipolar matching demo")
  45. (defvar *reference-pane* nil "reference view")
  46. (defvar *other-pane* nil "other view")
  47. (defvar *current-hist-pane* nil "shows current height histogram")
  48. (defvar *accum-hist-pane* nil "shows accumulated height histogram")
  49.  
  50. ;;;----------------------------------------------------------------
  51. ;;; Color and thickness settings when displaying (*demo-mode* is t)
  52.  
  53. ;;color/thickness of histogram plot
  54. (defvar *histogram-color* "GREEN")
  55. (defvar *histogram-thickness* 3)
  56.  
  57. ;;color/thickness of epipolar region boundaries
  58. (defvar *epipolar-color* "CYAN")
  59. (defvar *epipolar-thickness* 3)
  60.  
  61. ;;color/thickness of data lines
  62. (defvar *line-color* "GREEN")
  63. (defvar *line-thickness* 1)
  64.  
  65. ;;color/thickness of potential matches
  66. (defvar *match-color* "YELLOW")
  67. (defvar *match-thickness* 3)
  68.  
  69.  
  70. ;;;----------------------------------------------------------------
  71. ;;; Projection structures (for non-RCDE use)
  72.  
  73. (defstruct projection 
  74.   (projmat nil)          ;;3x4 projection matrix
  75.   (inverse-projmat nil)  ;;3x4 inverse projection matrix
  76.   )
  77.  
  78.  
  79. ;;;----------------------------------------------------------------
  80. ;;; View structure
  81.  
  82. (defstruct view
  83.   (label nil)            ;;identifying label
  84.   (image nil)            ;;full resolution image
  85.   (projection nil)       ;;camera projection
  86.   (projfile nil)         ;;projection read filename (for rcde)
  87.   (line-tokenset nil)    ;;isr2 line tokenset 
  88.   (line-grid nil)        ;;isr2 grid (for fast spatial access)
  89.   (topdown-linelist nil) ;;when using topdown line finder   
  90.   (topdown-edgels nil)   ;;when using topdown line finder   
  91.   (window nil)           ;;where/how to display 
  92.   )
  93.  
  94.  
  95. ;;;----------------------------------------------------------------
  96. ;;; Manipulating homogeneous coordinate vectors for point and lines
  97.  
  98. (defsubst pt-to-nvec (x y)
  99.   (la:normalize x y 1.0))
  100.  
  101. (defsubst nvec-to-pt (nvec)
  102.   (list (/ (first nvec) (third nvec)) (/ (second nvec) (third nvec))))
  103.  
  104. (defsubst nvec-to-pt-values (nvec)
  105.   (values (/ (first nvec) (third nvec)) (/ (second nvec) (third nvec))))
  106.  
  107. (defsubst nvec-to-line (nvec)
  108.   (la:normalize2 nvec))
  109.  
  110. (defsubst endpoints-to-line (pt1 pt2)
  111.   (nvec-to-line (la:cross-product (list (car pt1) (cadr pt1) 1.0)
  112.                   (list (car pt2) (cadr pt2) 1.0))))
  113.  
  114. (defsubst pt-vec-to-line (pt vec)
  115.   (nvec-to-line (la:cross-product (list (car pt) (cadr pt) 1.0) vec)))
  116.  
  117. (defsubst line-intersection-pt (nvec1 nvec2)
  118.   (nvec-to-pt (la:cross-product nvec1 nvec2)))
  119.  
  120.  
  121. ;;;----------------------------------------------------------------
  122. ;;; miscellaneous development tools
  123.  
  124.  
  125. (defvar *%%lastfilename* nil)
  126.  
  127. (defun cl (&optional (filename *%%lastfilename*))
  128.   (let ((path (merge-pathnames user::*epipolar-directory* filename)))
  129.     (setf *%%lastfilename* filename)
  130.     (load (compile-file path))))
  131.  
  132.  
  133.