Quantcast
Channel: Machine Vision topics
Viewing all articles
Browse latest Browse all 1268

NI-IMAQ's imgSessionSaveBufferEx function does not save any PNG file as intended

$
0
0
int main() { INTERFACE_ID interfaceID; SESSION_ID sessionID; unsigned int bitsPerPixel, plotFlag; if (imgInterfaceOpen("img0", &interfaceID) == IMG_ERR_GOOD) // "img0" is interfacename, opens an interface named img0 { std::cout << "Interface is open" << std::endl; if (imgSessionOpen(interfaceID, &sessionID) == IMG_ERR_GOOD) { std::cout << "Session is open" << std::endl; // 30 sept 2021: try GRAB // 1. imgInterfaceOpen (DONE) // 2. imgSessionOpen (DONE) // 3. imgGrabSetup (DONE) // 4. imgSessionStartAcquisition (DONE) // 5. imgGrab (DONE) // 6. User specific functions // 7. imgSessionStop Acquisition (DONE) // 8. imgClose (DONE) //3. imgGrabSetup imgGrabSetup(sessionID, TRUE); //manually start acquisition with imgSessionStartAcquisition //4. imgSessionStartAcquisition imgSessionStartAcquisition(sessionID); //5. imgGrab (sessionID, buffer address, uint32 waitForNext) imgGrab(sessionID, NULL, TRUE); //6. imgSessionSaveBufferEx to save a buffer of a session to PNG imgSessionSaveBufferEx(sessionID, NULL, reinterpret_cast<Int8*>(const_cast<char*>("test.png"))); std::cout << "Image saved" << std::endl; //7. imgSessionStop Acquisition imgSessionStopAcquisition(sessionID); std::cout << "Stop acquisition" << std::endl; imgClose(sessionID, FALSE); // closes the session using the imgClose function std::cout << "Session is closed" << std::endl; } imgClose(interfaceID, FALSE); // closes the interface using the imgClose function std::cout << "Interface is closed" << std::endl; } }

 

I have a frame grabber PCIe-1437. I used to work with it using LABVIEW but now I'm trying to work with it using C++.

 

I'm exploring the function imgGrab() and I'm trying to see what kind of output I would get by obtaining a PNG file with imgSessionSaveBufferEx().

According to the NI-IMAQ function reference manual, I should get a PNG file. However, no such file was produced.

 

Also, my end goal is to produce an interference signal shown below.

shiquan35_0-1633577467675.png

 

 

Hence, my enquiries are these:

1. Did I misunderstand about how to implement imgGrab() and imgSessionSaveBufferEx() ?

2. Is there any advice on how can I achieve my goal?


Viewing all articles
Browse latest Browse all 1268

Trending Articles