Click here to Skip to main content
15,887,371 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
CSS
01626 typedef struct _StructBufferStatus
01627 {
01629     long ImageBufferCount;
01638     unsigned char **ImageBuffers;
01644     int LastValidFrame;
01647     long TotalFramesSavedToBuffer;
01653     float ImageBufferSizeInMegabytes;
01655 } StructBufferStatus;


long ImageBufferCount
The number of image buffers that are curerently allocated.

unsigned char ** ImageBuffers
A pointer to the image buffers.

int LastValidFrame
The index of the last frame in the buffer that has been written to, when receiving images from the camera.

long TotalFramesSavedToBuffer
The total number of frames that have been saved to the image buffers, since the current capture or download was started.

float ImageBufferSizeInMegabytes
The number of megabytes that have been reserved for the image buffers.

VB
MS_CAMERACONTROL_API const StructBufferStatus MS_GetBufferStatus  ( long  CameraID,
  int *  pStatus = NULL
 )


Returns:
a struct containing the current values of the status

Parameters:
CameraID This is the unique Camera ID value of the camera you want to apply this function to.
This must be the same value that was returned by MS_InitializeCameraID() when you initialized this camera.

pStatus Returns the status code of the operation. See Status Codes for more information.
This parameter is optional. If it is not passed, then the status will not be returned.

C#
MS_CAMERACONTROL_API int MS_GetGrayscaleImage  ( long  CameraID,
  unsigned char *  pIn,
  unsigned char *  pOut,
  int *  pStatus = NULL
 )


Attention:
You must manually allocate the buffer pOut before you call this function, and free this buffer when you are finished using it.
The size of this buffer must be StructCurrentImageSize.ImageWidthFromCamera * StructCurrentImageSize.ImageHeightFromCamera * 1, because each pixel will be 8 bits.

Returns:
the value of *pStatus

Parameters:
CameraID This is the unique Camera ID value of the camera you want to apply this function to.
This must be the same value that was returned by MS_InitializeCameraID() when you initialized this camera.

pIn This is the pointer to the image buffer to process.
This should be set to either a frame from the StructBufferStatus::ImageBuffers, or the pImage pointer passed to one of the callback functions.

pOut This is the pointer to the processed image.

pStatus Returns the status code of the operation. See Status Codes for more information.
This parameter is optional. If it is not passed, then the status will not be returned.
Posted
Comments
louisejackie 24-Feb-13 9:37am    
Hi nv3, I've pasted the interface here,thank you very much for your kind heart.The documentation pasted above are the two funtions I used to get image buffer index and transfer data to user allocated memory. I hope this will give you some hints on how to solve my problem.Many thanks and happy Lanterns Day!

1 solution

From what I see in the documentation, image buffers are filled in a round robin fashion. At the beginning (until the first wrap-around occurs) buffers 0 ... LastValidFrame should be valid. When ImageBufferCount frames have been filled, they start reusing the buffers, starting again with buffer 0. After the wrap around occurred, all buffers should be good to read. But the buffer with index LastValidFrame is the newest, and buffer with index LastValidFrame+1 is the oldest.

Hope that helps you figure out, which buffers to access.
 
Share this answer
 
Comments
louisejackie 3-Mar-13 0:55am    
Hi nv3! I've sent my questions to the vendor's technique support team.They haven't replied me yet.I thought it will be a while before I can figure it out.
nv3 3-Mar-13 5:14am    
That's certainly a good idea. Meanwhile you can try to work it out with the basic understanding that I have outlined in my answer. Let me know if you run into any further problems.
louisejackie 3-Mar-13 5:19am    
Thanks a lot. I run into another problem here. How to process data in Doc and display the result in View? I have it posted in a new question.Give a glance at it if you are convenient.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900