Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This document describes the sample code that is included in the SDK and can be found in C:\Aptina Imaging\samples.

They use VS2013VS2015, and Qt 5.9.7 4 where applicable.  Also, for some samples VS2008/VS2010/VS2012/VS2013 solutions files are available.

NOTE: for Qt application set a System Variable of "QTDIR" set to the Qt installation location; for example, Capplications, you'll need to install Qt's VS2015 plugin and then in VS2015 set the following "Qt Versions" via the "Qt VS Tools" menu;

  • Name "msvc2015_64" and path to 64-bit Qt (e.g C:\Qt\Qt5.

...

  • 9.

...

  • 4\5.

...

  • 9.4\msvc2015_64)
  • Name "msvc2015" and path to 32-bit Qt (e.g. C:\Qt\Qt5.9.4\5.9.4\msvc2015)


Most pre-built executables are in C:\Aptina Imaging.

Each application is noted as being Command Line-based, GUI-based, or a plug-in.

...

The following sample applications are described below:

Table of Contents

BlankDlg

BlankDlg.exe is a sample Visual Studio blank dialog plug-in built using Visual Studio C++. It is a starting point for the customization of a plug-in.

...

BlankQtDlg

BlankQtDlg.dll is a sample QT blank dialog plug-in built using Visual Studio C++. It is a starting point for the customization of a plug-in.

...

Also, the Python script "create_new_dlg.py" can be used to make a copy of the BlankQtDlg source into the DevWare directory, while making all necessary file name changes and string substitutions to create a new plug-in project.

NOTE: for Qt applications, ensure that you have a System Variable of "QTDIR" set to the location of your Qt installation files; for example, C:\Qt\Qt5.4.0\5.4\msvc2012_opengl

Csharp_ApBase_COM_Sample

Csharp_ApBaseCOM.exe is a Command Line based C# sample of using ApBase's COM interface built using Visual Studio C#. The sample performs the following actions:
1. Starts ApBase_COM and then displays the sensor name found.
2. Loads the default initialization preset.
3. Sets up the capture/save parameters.
4. Grab the frame and saves it, and verifies there were no errors.
5. Exits ApBase_COM.

Please refer to the "ApBase COM Development Guide" document for usage details, found via:
start->All Programs->Aptina Imaging->Docs->Development Guides->ApBase COM Development Guide

Csharp_sample

Csharp_Samples.exe is a Command Line based C# sample of using DevSuite's COM interface built using Visual Studio C#. The sample expects an A-2020SOC sensor to be connected, and performs the following actions:
1. Starts DevWare and then verifies that a SOC2020 is connected.
2. Loads the default initialization preset.
3. Verifies that the sensor is outputting valid frames.
4. Captures a default image.
5. Adjusts AE exposure via a FW variable.
6. Captures the adjusted image.
7. Exits DevWare.
Please refer to the DevWare COM Interface document for usage details

DelphiSample

DelphiSample.exe is a GUI based Sample Delphi Pascal MIDLIB application that displays the image sensor data in a window and can read/write registers. It allows the user to input the image size if it is not the default image size.

DialogDll

This is a sample Devware Plugin Dialog which is built using Visual Studio C++. The plugin demonstrates how to modify sensor registers, general registers and interact with image data. Please refer to the The Dialog Plug-in API for DevWare document for more information on developing Devware Plugins. Note that the DLL must reside in the C:\Aptina Imaging\Plugins directory.

DirectShowSample

This sample program demonstrates how to select Aptinaonsemi's device as a Directshow source filter and render its capture pin to show a preview window; it assumes Windows SDK 7.1 has been installed and the "Release" version of the "directshow" baseclasses has been compiled and located at;

...

IPTransportDLL is a sample Visual Studio C++ transport DLL. A transport DLL allows a user to use non-Aptina onsemi Hardware to run with Devware or any other MIDLIB application.
This sample is specific to UDP packet processing.
Note this sample requires npcap, and it is upon the user to acquire it to get the sample to compile.

For more information on creating a transportDLL please refer to the "Transport DLL Development Guide".

JPEGcapture_SOC

This Visual Studio C++ Command Line based MIDLIB application demonstrates how to capture a JPEG images from the MT9T111 (SOC3130), MT9T112 (SOC3132) and the MT9S311 (A-R20B). The image/sensor information will output to stdout and image data will be saved to supplied output filename (default is img.jpg). Thumbnail dimensions, timeout value and camera to use can also be supplied as optional parameters.
Usage:
JPEGcapture_SOC [-output <filename>] [-thumbnail <w> <h>] [-cam <num>] [-timeout <iterations>] [-help]
Output Example:
sensorName = A-3130SOC
width = 1600
height = 1200
bufferSize = 3840512
imageType = 15
Grabbing frame
Saving frame to "filename"...[done]

JPEGcapture_SOC2010

This Visual Studio C++ Command Line based MIDLIB application demonstrates how to capture a JPEG images from the MT9D111 (MI-2010SOCJ).Usage:
JPEGcapture_SOC2010
Output Example:
sensorName = A-2010SOCJ
sensorType = 16
width = 1600
height = 1200
pixelBytes = 2
pixelBits = 16
bufferSize = 3840512
imageType = 15
shipAddr = 186
num_regs = 1055
Grabbing frame G[done]
Saving frames to "img.jpg"...[done]

LabVIEW

Sample LabVIEW Applications demonstrate how to use LabVIEW with DevWare's COM interface (folder DevWare_COM_sample), ApBase COM interface (folder ApBase_COM_sample), and ApBase API interface (folder ApBase_API_sample).

The applications create a process flow with GUI, which connects to the given interface, captures images on demand, and demonstrates how to read and write sensor registers.

...

MatlabApBaseCOM

Sample Matlab Application demonstrates how to use Matlab with DevWareApBase's COM interface. The code connects to DevWare ApBase through the COM interface, reads a single sensor register, and captures a raw image. The code also demonstrates how to write values into multiple registers using one function call.ApBase COM can also be used with Matlab; please see the example in that document under the "Quick Start" sectioninitializes the device, grabs and image, and converts it to RGB.

The complete set of ApBaseCOM documentation can be found here.

Python_Samples

The Python directory contains sample Python scripts that can be called from DevWare and stand-alone samples.

These examples can be executed by loading the .INI file into DevWare and executing the presets.

  • DevWare Python Introduction.ini provides various examples of Python INI file usage.
    Also, refer to DevWare Python Introduction.pdf for an introduction and examples.
  • Exposure-demo.ini shows an example of increasing and decreasing exposure from an INI preset.
  • AR0132_read_embedded.ini grabs 6 frames and prints the embedded data registers that changed.
  • Gain-exp-sweep.ini performs Gain Sweep via the optional Register Dialog "Scripts" feature, for the AR0330.
    It create creates 2 Custom Toolbars; One for "Gain Sweep" and another for "Exposure Sweep".
  • Mode-transition.ini captures images to .raw files across a mode transition.
  • QTM.ini sets a long file name for snapshot in DevWare.
  • TimingSample_py.ini is an example that creates a simple Python GUI, reads several register values and does some simple frame rate/timing calculations.
  • videocapture.ini is a Python script that implements simple video recording.

...

  • ColorPipe.py shows calling the ApBase API to do image processing as in DevWareX, on a RAW file.
  • convert_12bit_to_8 or 10bit.py converts 12 bit raw file of Aptina onsemi sensors to 8 bit and 10 bit raw files.
  • LiveStream_OpenCV.py shows calling the ApBase API from DevSuite and OpenCV to stream a live image.
  • NoiseMeasurement.py uses shows calling the ApBase API from DevSuite to do noise measurement for raw files and write the results to text files.
  • NoiseMeasurement_capture.py shows calling the ApBase API from DevSuite to do noise measurement on live captured images.
  • RenderRawVideoToWmv.py shows calling the ApBase API from DevSuite to do a video conversion from RAW image.
  • RGBIRVideoCapture.py shows calling the ApBase API from DevSuite to creates a video file from an RGB-IR sensor.
  • SimpleCapture.py shows calling ApBase API from DevSuite to do an image capture.
  • SimpleCapture_Ubuntu.py same as SimpleCapture.py except coded for Ubuntu._
  • SimpleCaptureAvi.py shows calling ApBase API from DevSuite to capture 100 frames and create an AVI video file.
  • SimpleCaptureNumpy.py shows calling ApBase API from DevSuite to capture an image and then conversion in to a Numpy array.

RawToRGB

RawToRGB is a Command Line based Visual Studio C++ application that converts a raw image to RGB using ApBase.

RecordRGBIR

This Visual Studio C++ application creates a video file from an RGB-IR sensor.
The video will have RGB images and IR images alternating.

This is an example of how to use the ApBase and RgbIR4x4Pipe libraries. The RgbIR4x4Pipe integrates with ApBase to do IR processing on images sent through the software color pipe.

A Python version can be found under "Python_Samples".

SampleAFMDLL

This is another sample Devware Plugin Dialog (using Visual Studio C++) which is used to control Auto Focus Mechanics. It allows the user to control an AF module by providing the I2C address, Min/Max positions and step sizes. Please refer to the The Dialog Plug-in API for DevWare and Auto Focus Mechanics Plugins Development Guide document for more information. Note that the DLL must reside in the C:\Aptina Imaging\Plugins directory.

...

SimpleCapture is a Command Line based Visual Studio C++ ApBase API application that can capture one or several continuous raw images and save in a file. Some image/sensor information will output to the console.
Usage:
SimpleCapture
SimpleCapture <num_frames>
SimpleCapture <num_frames> <width> <height>
Output Example:
Log file: ship_log0.txt
sensorName = A-1000ERS
sensorType = 65
width = 1280
height = 720
pixelBytes = 2
pixelBits = 10
bufferSize = 1843712
imageType = Bayer 10
shipAddr = 32
num_regs = 503
Saving frames to img.raw...Grabbing frame
.[done]

SimpleCapture_Midlib

 

This is a sample of using the LibUSB transport for Linux and MacOS. It opens the camera, initializes it, captures 1 or more images and exits.

The file "readme.txt" has usage information.

SimpleCaptureAVI

SimpleCaptureAVI is a Command Line based Visual Studio C++ MIDLIB application can capture one or several continuous raw images and saves them as a .avi file. Some image/sensor information will output to the stdout. Note that the application assumes the sensor has already been programmed to stream data.
Usage:
SimpleCaptureAVI
SimpleCaptureAVI <num_frames>
SimpleCaptureAVI <num_frames> <width> <height>
Output Example:
sensorName = A-1000ERS
sensorType = 65
width = 1280
height = 720
pixelBytes = 2
pixelBits = 10
bufferSize = 1843712
imageType = Bayer 10
shipAddr = 32
num_regs = 503
Opening AVI file – img.avi…
Grabbing frames
[done]

...

SimpleCSharp is the C# .NET version of SimpleCapture.

SimpleDualContext

SimpleDualContext is a GUI-based based Visual Studio C++ MIDLIB application that demonstrates rapid switching of two contexts for MI-351.

SimpleOpenCL

SimpleOpenCL is a sample plugin that uses OpenCL.

...

Simple is a GUI-based QT Visual Studio C++ ApBase application that can display image output for all Aptina onsemi sensors. It has a very simple demosaic algorithm in order to display output for Bayer only parts. It also includes examples of how to read and write registers.
Note that the application expects the width and height to match the SDAT's values of "Width" and "Height".

NOTE: for Qt applications, ensure that you have a System Variable of "QTDIR" set to the location of your Qt installation files; for example, C:\Qt\Qt5.4.0\5.4\msvc2012_opengl

TransportDLL

TransportDLL is a sample Visual Studio C++ transport DLL. A transport DLL allows a user to use non-Aptina onsemi Hardware to run with Devware or any other MIDLIB application. For more information on creating a transportDLL please refer to the "Transport DLL Development Guide"

Also, there is a Python script "create_new_transport.py" for creating a new transport based on this transport.