40m QIL Cryo_Lab CTN SUS_Lab TCS_Lab OMC_Lab CRIME_Lab FEA ENG_Labs OptContFac Mariner WBEEShop
  TCS elog  Not logged in ELOG logo
Message ID: 37     Entry time: Mon May 17 19:41:13 2010
Author: Aidan 
Type: Computing 
Category: Frame Grabber 
Subject: C code that calls MATLAB engine and centroiding algorithms 

This is an amended version of simple_take.c.


The files below are all in the directory /opt/EDTpdv/hartmann/src

  1. simple_hartmann.c   - the C code to access the frame grabber, retrieve an image, load the MATLAB engine and pass the image to MATLAB for centroiding
  2. centroid_image.m  - the MATLAB routine that centroids the image
  3. get_defocus.m - the MATLAB function that determines the defocus in the centroids
  4. build_simple_hartmann.sh - a shell script I wrote that contains the compile and link options to build the thing correctly 
Attachment 1: simple_hartmann.c  13 kB  | Show | Hide all | Show all
Attachment 2: centroid_image.m  3 kB  | Hide | Hide all | Show all
function centroids = centroid_image(image, centroids)
% This function centroids a supplied image. It returns a centroids structure
% 'centroids' structure
% --------------------
% centroids.image_background_level  - the background intensity of an image
%                                     with no illumination on it
%          .spot_radius             - the radius of a hartmann spot
%          .spot_threshold_level    - the minimum intensity of pixels used to
... 98 more lines ...
Attachment 3: get_defocus.m  2 kB  | Show | Hide all | Show all
Attachment 4: build_simple_hartmann.sh  740 Bytes  | Hide | Hide all | Show all

gcc -O2 -I/opt/EDTpdv -I/apps/matlab_R2008b/extern/include -I/apps/matlab_R2008b/simulink/include -DMATLAB_MEX_FILE -c -D_GNU_SOURCE -fexceptions -I/apps/matlab_R2008b/extern/include -DMX_COMPAT_32 -O -DNDEBUG simple_hartmann.c

gcc -O2 -I/opt/EDTpdv -I/apps/matlab_R2008b/extern/include -I/apps/matlab_R2008b/simulink/include -DMATLAB_MEX_FILE -c -D_GNU_SOURCE -fexceptions -I/apps/matlab_R2008b/extern/include -DMX_COMPAT_32 -O -DNDEBUG /apps/matlab_R2008b/extern/src/mexversion.c

gcc -O2 -O -I/opt/EDTpdv -o /opt/EDTpdv/hartmann/bin/simple_hartmann simple_hartmann.o mexversion.o -L/opt/EDTpdv -lpdv -lpthread -lm -ldl -Wl,-rpath-link,/apps/matlab_R2008b/bin/glnxa64 -L/apps/matlab_R2008b/bin/glnxa64 -leng -lmx -lstdc++
ELOG V3.1.3-