Objective
Video recording function is one of the most important functions in the monitoring system, in addition to the function of this article, you need to consider the appropriate storage strategy: storage size, time period, storage letter and so on.
Body
First, grasp the picture
This feature does not find the corresponding code in VC + + server, but Google to a section of CSDN Help code:
int ret=GetJpegImage(aa,bb,cc,dd);
if(ret==0)
{
CString str;
str.Format("ch%02d_%s.jpg",iLastSelect,csStartTime);
FILE *pFile=fopen(str.GetBuffer(0),"wb");//Buffer应该是个缓冲区
if(pFile)
{
fwrite(bb,cc,1,pFile); //存储图像
fclose(pFile);
Another piece of code: http://topic.csdn.net/t/20060721/09/4894821.html
C#:
byte[] imageBuf = new byte[704*576*2];
int size = 704*576*2;
HikVisionSDK.GetJpegImage(ChannelHandle, imageBuf, out size, 100);
using (MemoryStream ms = new MemoryStream(imageBuf))
{
Image image = Image.FromStream(ms, true);
image.Save("C:\\1.jpg");
}
Note the Getjpegimage parameter description!! And please note that because of this example, the previous (Getjpegimage/getoriginalimage) API error, please update!!
public static extern int GetOriginalImage(IntPtr hChannelHandle, byte[] ImageBuf, out int Size);
public static extern int GetJpegImage(IntPtr hChannelHandle, byte[] ImageBuf, out int Size, uint nQuality);
Save as BMP method Please try it yourself, should be similar: