C # video Surveillance Series (9): Server-side-data capture (grab + video)

Source: Internet
Author: User
Tags int size

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:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.