MATLAB IMAGE ACQUISITION TOOLBOX - RELEASE NOTES Guide de l'utilisateur Page 62

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 172
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 61
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());
Vue de la page 61
1 2 ... 57 58 59 60 61 62 63 64 65 66 67 ... 171 172

Commentaires sur ces manuels

Pas de commentaire