Download Adaptor Kit PDF

TitleAdaptor Kit
LanguageEnglish
File Size2.0 MB
Total Pages172
Document Text Contents
Page 1

Image Acquisition Toolbox™

Adaptor Kit User's Guide

R2017a

Page 2

How to Contact MathWorks

Latest news: www.mathworks.com

Sales and services: www.mathworks.com/sales_and_services

User community: www.mathworks.com/matlabcentral

Technical support: www.mathworks.com/support/contact_us

Phone: 508-647-7000

The MathWorks, Inc.
3 Apple Hill Drive
Natick, MA 01760-2098

Image Acquisition Toolbox™ Adaptor Kit User's Guide
© COPYRIGHT 2005–2017 by The MathWorks, Inc.
The software described in this document is furnished under a license agreement. The software may be used
or copied only under the terms of the license agreement. No part of this manual may be photocopied or
reproduced in any form without prior written consent from The MathWorks, Inc.
FEDERAL ACQUISITION: This provision applies to all acquisitions of the Program and Documentation
by, for, or through the federal government of the United States. By accepting delivery of the Program
or Documentation, the government hereby agrees that this software or documentation qualifies as
commercial computer software or commercial computer software documentation as such terms are used
or defined in FAR 12.212, DFARS Part 227.72, and DFARS 252.227-7014. Accordingly, the terms and
conditions of this Agreement and only those rights specified in this Agreement, shall pertain to and
govern the use, modification, reproduction, release, performance, display, and disclosure of the Program
and Documentation by the federal government (or other entity acquiring for or through the federal
government) and shall supersede any conflicting contractual terms or conditions. If this License fails
to meet the government's needs or is inconsistent in any respect with federal procurement law, the
government agrees to return the Program and Documentation, unused, to The MathWorks, Inc.

Trademarks

MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See
www.mathworks.com/trademarks for a list of additional trademarks. Other product or brand
names may be trademarks or registered trademarks of their respective holders.
Patents

MathWorks products are protected by one or more U.S. patents. Please see
www.mathworks.com/patents for more information.

https://www.mathworks.com
https://www.mathworks.com/sales_and_services
https://www.mathworks.com/matlabcentral
https://www.mathworks.com/support/contact_us
http://www.mathworks.com/trademarks
http://www.mathworks.com/patents

Page 86

5 Acquiring Image Data

Format Frame Types

Signed 16- and 32-bit formats; both little-endian and big-endian;
in regular and flip formats.
Floating-point and double formats; both little-endian and big-
endian formats; in regular and flip formats.

Color 8-, 24-, 32-, and 48-bit RGB formats; both little-endian and big-
endian; regular and flip; packed and planar (see “Understanding
Packed and Planar Formats” on page 5-8).
Frame types that specify the order of the bytes of color data (RGB
or GBR) and specify where the blank byte is located (XRGB or
XGBR).
Formats that represent colors in 4-bits (4444), 5-bits (555), 5- or 6-
bits (565), or 10-bits (101010).
Formats that use the YUV color space.

Suggested Algorithm

Your adaptor's getFrameType() function must return the appropriate frame type that
describes the data returned by your device for the specified format.

If your device supports multiple color formats, you do not need to expose all the formats
to toolbox users. You can simply provide one color format and handle the low-level details
in your adaptor with FRAMETYPE.

Example

The following example shows a skeletal implementation of the getFrameType()
function. An actual implementation might select the frame type based on the format the
user selected.

virtual imaqkit::frametypes::FRAMETYPE getFrameType() const {

return imaqkit::frametypes::FRAMETYPE:MONO8;

}

Understanding Packed and Planar Formats

The adaptor kit IAdaptorFrame class defines many FRAMETYPE enumerations that
cover the many possible types of image data devices can return. For example, some
devices can return color images in packed or nonpacked (planar) formats. These formats

5-8

Page 87

Specifying the Format of the Image Data

describe how the bytes of red, green, and blue data are arranged in memory. In packed
formats, the red, green, and blue triplets are grouped together. In nonpacked formats,
all the red data is stored together, followed by all the green data, followed by all the blue
data. The following figure illustrates this distinction.

Packed and Planar Formats

To get more information about video formats, go to the fourcc.org Web site.

5-9

Page 171

Using the Test Suite Functions and Properties

This example shows the basic workflow of creating and running a test using some of the
functions outlined in the previous section.

Get installed hardware information recognizable using the winvideo adaptor.

info = imaqhwinfo('winvideo');

Identify the Device IDs.

info.DeviceIDs

Get information about available formats for the camera under test identified in the last
step. If it is the first camera, use DeviceId of 1.

info.DeviceInfo(1).SupportedFormats

Choose a format, for example MJPG_800x600, and create the test object, with an
estimated frame rate of 15.
testObj = imaqkit.AdaptorTest.createTest('winvideo', 1, 'MJPG_800x600', 15);

By default, tests create verbose logs. To run tests with concise logs set the ConciseLog
property to true and then run tests.

testObj.ConciseLog = true;

To run individual tests, call specific test functions, such as:

testObj.runObjectCreationAndPreviewTest;

testObj.runInteractiveDevicePropertiesTest;

Run all automated tests.

testObj.runAllAutomatedTests;

8-17

Similer Documents