LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Circular Buffer and Camera Data Read

Hello, I have a ZWO ASI 183MM camera, the protocol for acquiring the data is by calling a function repeatedly over a loop. But the problem is that the FPS is quite low in my case. I have attached the data acquisition part for it, I believe that can be improved by utilizing a Circular Buffer. Can anyone suggest me, how can I implement it in my case.

 

The Code:

 

 

long lBuffSize= height*width;
unsigned char *pBuffer= (unsigned char *) malloc(lBuffSize) ;
double *imBuffer= (double *) malloc(lBuffSize*8) ;

 

ASIStartVideoCapture(cameranumber);

Timer();
int q=0 ;

while(1)
{

exposurestatus=ASIGetVideoData(cameranumber, pBuffer, lBuffSize, exposure*2+500);
value=0;
if(exposurestatus==0)
{
ConvertArrayType (pBuffer, VAL_UNSIGNED_CHAR, imBuffer, VAL_DOUBLE, lBuffSize);
MaxMin1D (imBuffer, height*width, &maxvalue , &maxvalloc ,&minvalue , &minvalloc);

for (int i=29; i>=0; i--)
{
colors[i].dataValue.valDouble = (double)(value);
value = value + ((maxvalue - minvalue) / 29.0);
}

PlotIntensity (panelHandle_2, VIDEOPANEL_GRAPH, imBuffer, width, height, VAL_DOUBLE, colors, 0xffffff, 30, 0, 0);

}

0 Kudos
Message 1 of 2
(840 Views)

One approach I've used in the past with instruments that output data very quickly is to use the Thread Safe Queue library.  This runs in a different thread, can receive the data and add to a dynamically enlarging data queue.  

 

Then your main thread can pull the data out when it has time and process.

0 Kudos
Message 2 of 2
(756 Views)