smaller reset larger        English  German         

Main Menu

All times are in GMT -8 (DST) :: The time is now 6:51 pm.

Sub Menu

Article Data
Article Ref
8694-QRJX-4026
Date Created
Mon, 18th Jul 2011
Date Modified
Tue, 11th Mar 2014
 
 
(Lost?)

   How to read images into HSDataBase without using the AcquisitionDevice in C++

Question 

How can I read images into a HSDataBase without using the AcquisitionDevice in  C++?

Answer 

HSDatabase lDB = mApplicationControl.GetDatabase();

 

HSView lView = lDB.AddView ("New View");

const long ltype = HSImage::hsImageType::hsImage32bppRgb;

HSImage lImage = lView.AddImage("New Image",COleVariant(ltype));

 

lImage.SetWidth( 10 );

lImage.SetHeight( 10 );

 

// RawImagePointer may be changed after the allocation from SetWidth/SetHeight

// (hsImage32bppRgb represent a DWORD, hsImage8bppGreyScale is a BYTE)

DWORD* lPtr = (DWORD*)lImage.GetRawImagePointer();

 

for( int i=0; i<10; i++ )

{

    for( int j=0; j<10; j++ )

    {

        // The two lines in here are both valid, the raw pointer, however, is faster

 

        //lImage.SetPixel(i,j,0xffffff);

        lPtr[j+i*(int)lImage.GetWidth()] = 0xffffff;

    }

}

How Useful Was This Article?      (Rating: 100%    Votes: 1)  

Select a Rating