原创 C++使用foreach

#include <iostream> #include <algorithm> int main() { int intArr[] = { 1, 2, 3, 4, 5 }; std::cout << "std::for_

原创 rapidjson 簡單使用

#include "rapidjson/document.h" #include "rapidjson/writer.h" #include "rapidjson/stringbuffer.h" #include "rapidjson/r

原创 C++ 回調

C++11支持的lambda表達式和function類,可以替代一切回調

原创 HObject cv::Mat 互相轉換

// 轉換函數 HObject Mat2HObject(Mat& image) { HObject Hobj=HObject(); int hgt=image.rows; int wid=image.cols; int i; /

原创 STL文件讀寫操作

#include <iostream>#include <fstream>#include <string>using namespace std;int main(){// ifstream input("./in.txt", i

原创 海康威視攝像頭+opencv 實時讀取

#include <cstdio> #include <cstring> #include <iostream> #include "Windows.h" #include "HCNetSDK.h" #include

原创 C++ base64 opencv Mat 轉換

static std::string base64Decode(const char* Data, int DataByte) { //解碼錶 const char DecodeTable[] = { 0, 0, 0, 0, 0

原创 linux 下 build opencv

apt-get install build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev libtbb

原创 linux 和 windows 下用ffmpeg 操作usb攝像頭

windows :列設備  ffmpeg -list_devices true -f dshow -i dummy編碼爲H.264,保存爲本地文件  ffmpeg -f dshow -i video="Integrated Camera"

原创 fstream一次把整個文本文件內容讀到 string 裏

fstream一次把整個文本文件內容讀到 string 裏著名專家Dietmar Kuehl給過兩個方法    std::ifstream in("some.file");    std::istreambuf_iterator<char

原创 SAFE_RELEASE

#ifndef SAFE_RELEASE #define SAFE_RELEASE(p) \ if ((p)) { \ delete (p); \ (p) = NULL;