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

  • 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 99
5 Acquiring Image Data
5-22
Your thread function must accept a single parameter, which is defined as a pointer to
the object itself, i.e., the this pointer. The thread function returns a value that indicates
success or failure. For more information, see the documentation at the Microsoft
Developer Network Web site (msdn.microsoft.com).
The following is an acquisition thread function that you can use with the example
MyDeviceAdaptor. Replace the skeletal implementation you used in “Starting an
Acquisition Thread” on page 5-10 with this code.
DWORD WINAPI MyDeviceAdaptor::acquireThread(void* param) {
MyDeviceAdaptor* adaptor = reinterpret_cast<MyDeviceAdaptor*>(param);
MSG msg;
while (GetMessage(&msg,NULL,0,0) > 0) {
switch (msg.message) {
case WM_USER:
// Check if a frame needs to be acquired.
while(adaptor->isAcquisitionNotComplete()) {
// Insert Device-specific code here to acquire frames
// into a buffer.
if (adaptor->isSendFrame()) {
// Get frame type & dimensions.
imaqkit::frametypes::FRAMETYPE frameType =
adaptor->getFrameType();
int imWidth = adaptor->getMaxWidth();
int imHeight = adaptor->getMaxHeight();
// Create a frame object.
imaqkit::IAdaptorFrame* frame =
adaptor->getEngine()->makeFrame(frameType,
imWidth,
imHeight);
// Copy data from buffer into frame object.
frame->setImage(imBuffer,
imWidth,
imHeight,
0, // X Offset from origin
0); // Y Offset from origin
// Set image's timestamp.
frame->setTime(imaqkit::getCurrentTime());
// Send frame object to engine.
adaptor->getEngine()->receiveFrame(frame);
} // if isSendFrame()
// Increment the frame count.
adaptor->incrementFrameCount();
Vue de la page 99
1 2 ... 95 96 97 98 99 100 101 102 103 104 105 ... 171 172

Commentaires sur ces manuels

Pas de commentaire