Pulnix TMC-7DSP User Manual Page 6

  • Download
  • Add to my manuals
  • Print
  • Page
    / 32
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 5
5
Image acquisition program
The first part of the project was to create a program, which grabs a frame from digital camera
(Pulnix TMC-7DSP connected to DT 3153 frame grabber board) and transfers it to MatLab
workspace. Similar image acquisition is available in MatLab Image Acquisition ToolBox. By
making the program by ourselves, it will become more modifiable and cheaper.
The program was programmed by using C programming language and C-MEX protocol. C-MEX
protocol enables importing of C-language programs into Matlab. More information about C-MEX is
available in MathWorks support.
[1]
I used example files (“acq2host.c" and "acq2host.h”) provided by Data Translation as a basis for the
program. The major modifications I made to the program were adding the C-MEX function (called
the gateway routine) and modifying the type of grabbed image data. In the original program
acquired image was only shown in a pop-up window. In the new program we needed the picture to
be stored into a 3D array, which could be transferred into MatLab. Also the presentation of the
grabbed image would be done from MatLab, if needed.
The program must be compiled and run using MatLab. See chapter “How to use the program”.
When the program is run for the first time, the camera is initialized. After that program acquires an
image or closes the camera, depending if there is any parameter. If there is a parameter, camera will
close. NOTE! Camera has to be closed before you exit MatLab.
Image acquisition works as follows:
- The frame is read to the allocated buffer.
- Buffer is read to 3D array created by mex function “mxCreateNumericArray”.
- Array is transferred to MatLab.
- Transferred array must be processed in Matlab using matrix functions before it can be
handled as a normal RGB picture. See "Acquire.m".
The image buffer which is read from the camera is in different dimensions than the normal MatLab
RGB image. Buffer dimensions are 4x640x480, and MatLab RGB dimensions for the same picture
are 480x640x3. (Alpha channel can not be used in MatLab.) This is why we have to process the
array to be able to see the actual image in MatLab. Matrix functions are easy and fast to use in
MatLab which is why operations are done in there instead of the c-program.
How to use the program
To compile program in MatLab, use command
‘mex FrameCapt.c DtColorSdk.lib DtLineScan.lib Olfg32.lib Olimg32.lib’
Make sure you have all the libraries in the same folder as your FrameCapt.c. Select VC++ as the
compiler.
After compiling, you can use command ‘FrameCapt’
1. To initialize the camera.
If camera is not initialized and you give the command
‘FrameCapt’,
camera will be initialized. After successful initialization ‘Camera initialized’ is prompted.
Page view 5
1 2 3 4 5 6 7 8 9 10 11 ... 31 32

Comments to this Manuals

No comments