MATLAB IMAGE ACQUISITION TOOLBOX - RELEASE NOTES Guia do Utilizador Página 62: Storing Adaptor Data

/ 172
Índice
3
Providing Hardware Information
3-18
The demo adaptor provides an example, defining a class to hold additional format
information. This class, named
DemoDeviceFormat
, stores format information
such as width, height, and color space. The following example, taken from the demo
adaptor, shows how to instantiate an object of this derived class, assign values to
the data members of the class, and then store the object in the adaptor data of the
IDeviceFormat
object.
DemoDeviceFormat* rgbFormatInfo = new DemoDeviceFormat();
rgbFormatInfo->setFormatWidth(demo::RGB_FORMAT_WIDTH);
rgbFormatInfo->setFormatHeight(demo::RGB_FORMAT_HEIGHT);
rgbFormatInfo->setFormatNumBands(demo::RGB_FORMAT_BANDS);
rgbFormatInfo->setFormatColorSpace(imaqkit::colorspaces::RGB);
deviceFormat->setAdaptorData(rgbFormatInfo);
Accessing Adaptor Data
To access the adaptor data stored in an
IDeviceInfo
or
IDeviceFormat
object, use the
getAdaptorData()
member function of the object.
The following example, taken from the demo adaptor, shows how to retrieve the
adaptor data from the
IDeviceFormat
object. In the example,
selectedFormat
is a
DemoDeviceFormat
object. Note that because the
getAdaptorData()
member function
returns a handle to the
IMAQInterface
class, you must cast the returned object to your
defined class.
dynamic_cast<DemoDeviceFormat*>(selectedFormat->getAdaptorData());

Ficheiro PDF · ·

Imprimir

Imprimir documento

Partilha

Perguntas sobre MATLAB IMAGE ACQUISITION TOOLBOX - RELEASE NOTES

Ainda não há perguntas sobre este manual. Faça a primeira.

Fazer uma pergunta

Respondemos a partir do manual e indicamos a página. A pergunta é publicada no site depois de verificada.

Todas as perguntas e respostas ›

Manuais e produtos relacionados com Software MATLAB IMAGE ACQUISITION TOOLBOX - RELEASE NOTES