Nanoimaging Lab Blog

Microscopy, Common Lisp, Image processing, Hardware.

On Distortion of a Dichromatic Image Splitter

basldfalsd ldajsfsl das ist ein test \(a+b=\sqrt{c}\)

\[ \begin{align*} \mathbf{x}' = R \mathbf{x} + \mathbf{t} \end{align*} \]

with rotation matrix that rotates towards left: \[ \begin{align*} R = \begin{pmatrix} \cos\alpha & \sin\alpha \ -\sin\alpha & \cos\alpha \end{pmatrix} \end{align*} \]

Generate Maxima Code to find the three parameters of a rigid transform
1
2
3
4
5
6
7
8
9
10
11
12
13
14
(with-open-file (s "/dev/shm/optim.max" :direction :output
         :if-exists :supersede
         :if-does-not-exist :create)
  (format s "load(minpack)$~%")
  (format s "g(p,tx,ty):=[")
  (loop for (dist imdist iml imr lx ly x y) in
       *cleaned-point-correspondence* and i from 0 do
       (format s "cos(p)*(~f)+sin(p)*(~f)+tx-(~f), -sin(p)*(~f)+cos(p)*(~f)+ty-(~f)~c~%" x y lx x y ly (if (= i (1- (length *cleaned-point-correspondence*)))
                                                #\Space #\,)))
  (format s "];~%")
  (format s "minpack_lsquares(g(p,tx,ty),[p,tx,ty],[.04,244.2,-0.7]);~%"))

;; maxima fitting result:
;; [[.05325489544613618, - 244.3662184306725, .01563720868233511],  25.96634987708376, 1]