hikvision SDK使用学习/实践

海康威视相机-LINUX SDK 开发 海康工业相机LINUX下开发 阅读详情
AI摘要

本文档概述了使用MVS库中的摄像头操作函数,如设备枚举、句柄管理、图像采集和参数设置,展示了C++类camera中实现的相关操作。

  函数介绍

//1. 枚举设备


 int MV_CC_EnumDevices(unsigned int nTLayerType, 
              MV_CC_DEVICE_INFO_LIST *pstDevList);
//2. 创建设备句柄

int MV_CC_CreateHandle(void **handle, const MV_CC_DEVIEC_INFO *pstDevInfo);
//参数:

handle  [out]  //设备句柄,输出参数;

pstDevInfo  [in]  //设备信息版本、MAC地址、传输层类型以及其它设备信息;

//返回值:

//成功,返回MV_OK (0);失败,返回错误码。

//3. 关闭设备

int MV_CC_CloseDevice(void *handle);
//参数:

handle  [in]  //设备句柄,MV_CC_CreateHandle或MV_CC_CreateHandleWithoutLog的[out]参数。

//4. 释放句柄

int MV_CC_DestroyHandle(void *handle);
// 5. 注册图像数据回调函数,支持获取chunk信息

int MV_CC_RegisterImageCallBackEx(void *handle, const char *pEventName, \
                  cbEvent cbEvent, void *pUser);
//参数:

//pEventName  [in]  事件名;

//fEventCallBack  [in]  接收Event事件的回调函数

//pUser  [in]  用户自定义变量

//6. 开始采集图像

int MV_CC_StartGrabbing(void *handle);
//7. 获取一帧图像数据

int MV_CC_GetOneFrame(void *handle, unsigned char *pData, \
            unsigned int nDataSize, \
           MV_FRAME_OUT_INFO *pFrameInfo
); 
//参数:

pData  [in] // 用于保存图像数据的缓存地址;

nDataSize  [in] // 缓存区大小;

pFrameInfo  [out] // 获取到的帧信息;

//8. 获取相机节点值

int MV_CC_GetIntValue(void *handle, const char *strKey, MVCC_INTVALUE *pIntValue);
//参数:

strKey  [in] // 节点名称;

pIntValue  [out] // 获取到的节点值;



//可以用来获取需要的节点值。

自己实践代码:

camera.hpp



#ifndef CAMERA_CLASS_H_INCLUDED
#define CAMERA_CLASS_H_INCLUDED



#include "/opt/MVS/include/MvCameraControl.h"
#include "opencv2/core.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/imgproc.hpp"
#include <cmath>
#include <cstddef>
#include <fcntl.h>
#include <iostream>
#include <opencv2/opencv.hpp>
#include <opencv2/video/video.hpp>
#include <opencv4/opencv2/imgproc/types_c.h>
#include <opencv4/opencv2/opencv.hpp>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
#include <vector>
using namespace std;
using namespace cv;
class camera;


#ifdef __cplusplus
extern "C"{

class camera {
private:
  void *handle;
  bool g_bExit;
  int nRet;
  unsigned int g_nPayloadSize;
  unsigned char *pDataForRGB;
  unsigned char *pData;
  unsigned char *pDataForSaveImage;
  MV_CC_DEVICE_INFO *pDeviceInfo;
  MV_CC_DEVICE_INFO_LIST stDeviceList;
  MVCC_INTVALUE stParam;
  MV_FRAME_OUT stOutFrame;
  MV_CC_PIXEL_CONVERT_PARAM CvtParam;
  MV_SAVE_IMAGE_PARAM_EX stSaveParam;
  MV_FRAME_OUT_INFO_EX stImageInfo;

public:
  camera();
  
使用海康威视的SDK,利用WPF设计一个网络摄像头的显示控制程序(上位机) 利用海康威视的SDK,使用WPF设计一个网络摄像头的控制程序,实现在页面上实时显示视频,并实现抓图以及对通道的配置。 阅读详情

相关推荐

海康SDK对接系列教程(一)- 总览

海康SDK开发介绍

hengju的博客 2万+

海康威视SDK二次开发实战包

本文还有配套的精品资源,点击获取 简介:海康威视SDK是为视频监控系统开发提供的一套工具集,支持远程访问、视频流处理和报警事件管理。开发者可以使用该SDK定制开发应用程序,如监控客户端、录像回放软件或报警系统。本开发包提供丰富的API接口和相关文档,便于将海康威视监控设备集成到应用中。用户将按照文档指导安装、配置SDK,学习API,连接设备,处理视频流和报警事件,并进行录像...

weixin_30633869的博客 2538

海康威视SDK实战开发指南

在视频监控行业,SDK(Software Development Kit,软件开发包)是推动系统集成与二次开发的重要工具。海康威视SDK作为业界领先的视频监控软件开发包,以其强大的功能和高效的性能,广泛应用于多种视频监控场景和安全领域。本章将深入探讨海康威视SDK的基础知识,包括其核心功能、优势、以及如何在项目中有效地应用。海康威视SDK的设计理念是为了提供给开发者一个集成化的开发环境,使他们能够在遵守海康威视版权和使用规定的前提下,灵活地使用SDK进行软件开发。

weixin_42315569的博客 747

海康威视摄像头Python SDK开发套件

软件开发工具包(SDK)是提供给开发者的一系列开发工具、库函数、文档和指南的集合,用于创建软件应用。对于海康威视摄像头而言,其SDK允许开发者通过各种编程语言对摄像头进行编程控制,实现图像捕获、视频流传输、存储、回放等功能。SDK的主要组成部分通常包含:API(应用程序接口):允许开发者调用特定的函数来控制硬件设备。驱动程序:硬件设备与操作系统之间的桥梁,确保操作系统能够正确识别和操作硬件。配置文件和工具:为开发者提供必要的配置帮助和调试工具,以便于开发和测试。

weixin_34535286的博客 1219

对单周期 RISC-V 处理器进行扩展

对单周期 RISC-V 处理器进行扩展

xiaoxian666的博客 1484

STM32驱动LED矩阵:IS31FL3731与查理复用技术实践

LED矩阵显示是嵌入式系统中常见的人机交互方式,其核心在于高效的驱动技术。查理复用(Charlieplexing)作为一种创新的矩阵扫描方式,通过引脚复用技术,用N个引脚驱动N²-N个LED,大幅提升了硬件资源利用率。IS31FL3731驱动芯片集成了这一技术,配合STM32F410RB微控制器的强大性能,可实现144个LED的精准控制。这种组合在艺术装置、信息展示等场景中展现出独特优势,既能呈现丰富的视觉效果,又能通过内置PWM调光实现256级亮度控制。通过I2C接口通信,开发者可以轻松实现字符显示、图像

weixin_29193359的博客 280

HDMI设计6--Video PHY Controller IP

Reference:https://china.xilinx.com/content/dam/xilinx/support/documentation/ip_documentation/vid_phy_controller/v2_2/pg230-vid-phy-controller.pdf 1. 序 Video PHY Controller IP是为实现与视频(DisplayPort和HDMI™技术)MAC传输或接收子系统的即插即用连接而设计的。视频MAC层和PHY层的接口是标准化的,能...

Archar_Saber的博客 8343

海思MPP平台千兆以太网驱动集成与测试指南

千兆以太网(GE)是嵌入式视觉系统中音视频流传输与边缘控制的核心物理接口,其底层驱动需兼顾DMA高效调度、中断实时响应与PHY链路稳定性。在Linux嵌入式环境中,GE驱动通常基于net_device框架实现,并深度耦合于SoC专用媒体处理平台(如海思MPP),通过硬件抽象层(HAL)屏蔽寄存器操作,提供零拷贝、RGMII时序适配、描述符环管理等关键能力。技术价值体现在降低CPU负载、保障1080p@30fps实时推流、支持ONVIF/RTSP协议交互及固件远程升级。典型应用场景包括网络摄像机(IPC)、A

weixin_42599908的博客 91

告别OFDM卡顿:用MATLAB手把手仿真AFDM波形,搞定高铁、无人机通信的时变信道难题

本文详细介绍了如何使用MATLAB仿真AFDM波形,解决高铁和无人机通信中的时变信道难题。通过仿射变换技术,AFDM在多普勒频移严重的场景下表现优异,显著提升通信质量。文章包含参数配置、波形生成、性能对比等实战内容,适合通信工程师和研究人员参考。

weixin_27014595的博客 323

HFSS实战项目——基片集成波导(SIW)带通滤波器

设计了一款直接耦合的SIW带通滤波器, 采用直接耦合的形式, 工作频率覆盖19~21 GHz, 通带内插入损耗小于1.5 dB, 回波损耗小于-20 dB, 带外抑制特性良好.

2401_87464239的博客 4903

10分钟搞定小红书爆款笔记爬取!Selenium模拟登录+数据解析全流程,新手也能落地

小红书爬虫实战的核心,是**“模拟真人操作+解析结构化数据”**——Selenium解决了动态页面和登录的问题,lxml解决了数据提取的问题,pandas解决了数据存储的问题。新手学爬虫不用一开始就啃复杂的反爬机制,先从这类“可见即可爬”的场景入手,掌握“模拟操作→数据解析→数据保存”的全流程,再逐步叠加异常处理、批量爬取、反爬应对等功能。需要注意的是:爬取数据仅用于个人学习和研究,不得用于商业用途,且需遵守小红书的用户协议,不要过度爬取导致服务器压力。

专注于Python爬虫开发,分享爬虫技巧、项目实战与反爬经验,使用Scrapy、BeautifulSoup等工具,解决数据抓取难题。 1732

设计原则:面向对象设计原则详解

我们在应用程序开发中,一般要求尽量两做到可维护性和可复用性。 应用程序的复用可以提高应用程序的开发效率和质量,节约开发成本,恰当的复用还可以改善系统的可维护性。而在面向对象的设计里面,可维护性复用都是以面向对象设计原则为基础的,这些设计原则首先都是复用的原则,遵循这些设计原则可以有效地提高系统的复用性,同时提高系统的可维护性。面向对象设计原则和设计模式也是对系统.........

黄规速博客:学如逆水行舟,不进则退 4万+

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

上一篇: extern关键字
下一篇: git问题error: remote origin already exists.
^花九九
博客等级 码龄6年 144粉丝 47原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值