c++
子墨777
Try to make yourself more excellent!
展开
-
c++ unordered_map
#include <iostream>#include <unordered_map> int main(){ // simple comparison demo std::unordered_map<int , char> exp= {{1,'b'},{2,'c'},{3,'d'}}; auto search = exp.find(2); if(search !=exp.end()){ std::cout&l.原创 2020-08-11 16:30:23 · 186 阅读 · 0 评论 -
C++ std::thread 简单的生产者和消费者
#include #include #include #include #include #include std::deque data;std::mutex m_mux;//全局互斥所int num=0;void product_thread(){ while(true){ std::unique_lock lck(m_mux);原创 2017-04-12 21:38:01 · 1652 阅读 · 0 评论 -
c++ 读取文本文档中的数据到二维数组中
C++ 读取文本文档中的数据到二维数组中,首先计算文本文档中有多少行数据,读取数据然后进行输出。#include #include #include using namespace std;int CountLines(char *filename){ ifstream ReadFile; int n=0; string tmp; ReadFile.o原创 2017-08-15 10:36:56 · 3959 阅读 · 0 评论 -
C++ 怎么依次读取多个TXT里面的数据,放到一个数组里面
C++ 怎么依次读取多个TXT里面的数据,放到一个数组里面/* int j_num_fea =0; std::string ss1; long int num_total_lines=0; // long long int LINES[5]; long long int start_lines=0; int row=9 ,col=8;原创 2017-08-22 17:12:16 · 4536 阅读 · 0 评论 -
c++ 连续读取某个文件夹下面的多个文件
#include <iostream>#include <fstream>#include <ctime>#include <cstdio>#include <cstdlib>#include <vector>#include <string.h>using namespace std;v原创 2018-10-22 17:01:08 · 5843 阅读 · 1 评论 -
opencv trackbar selected parameters
//// opencv trackbar#include<opencv2/core/core.hpp>#include<opencv2/imgproc/imgproc.hpp>#include<opencv2/highgui/highgui.hpp>#include<iostream>using namespace cv;usin...原创 2018-10-28 18:39:12 · 131 阅读 · 0 评论 -
opencv trackbar binary image threshold
//// Created by shanghaitech on 18-10-28.//#include<opencv2/imgproc/imgproc.hpp>#include<opencv2/highgui/highgui.hpp>#include<iostream>using namespace std;using namespace cv...原创 2018-10-29 12:25:43 · 291 阅读 · 0 评论 -
Leaining ROS
1:配置Ubuntu的软件源配置Ubuntu要求允许接受restricted、universe和multiverse的软件源,2.Setup your sources.listsudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources原创 2016-11-08 16:35:34 · 217 阅读 · 0 评论 -
c++ 函数的递归调用
#include"iostream"using namespace std;int age(int);int main (){ cout<<age(5)<<endl; return 0;} int age(int n) { int c; if(n==1)c=10; else c=age(n-1)+2; return c; }原创 2016-08-24 23:01:02 · 615 阅读 · 0 评论 -
opencv 循环读取多张图片
for (int i=1;i原创 2016-01-26 17:07:06 · 2440 阅读 · 0 评论 -
opencv 如何输出某个pixel 的三维坐标
极简单的输出某个pixel所对应的三维的坐标:Point p;p.x = 440; p.y = 160;reprojectImageTo3D(disp_sgbm, XYZ, Q, false, -1);cout (p)原创 2016-01-28 18:55:32 · 2045 阅读 · 0 评论 -
opencv 图片通过按键保存图片
int take_photos(char *left, char *right){ //定义和初始化变量int i = 0;IplImage* img = 0;char image_name[13];CvCapture* capture1 = cvCreateCameraCapture( 0 ); CvCapture* capture2 = cv原创 2016-03-01 17:55:49 · 3451 阅读 · 0 评论 -
opencv 霍夫圆变换识别网球 通过滑动条来修改参数
//2011/06/14 #include "cv.h" #include "highgui.h" #include #include"iostream"using namespace std ;IplImage* src = NULL ; IplImage* dst = NULL ; IplImage* img = NULL ; IplImage* img1 =原创 2016-05-15 20:03:31 · 870 阅读 · 0 评论 -
opencv识别两个网球
#include "cxcore.h" #include "cv.h" #include "highgui.h" #include "iostream"using namespace std; // 内轮廓填充 // 参数: // 1. pBinary: 输入二值图像,单通道,位深IPL_DEPTH_8U。 // 2原创 2016-05-08 20:49:11 · 1667 阅读 · 0 评论 -
数字图像处理之二直方图规定化
clear; close all; I=imread('D:/567.png'); dif=zeros(256,256);%%变量的定义及其初始化 dif=double(dif); H_SML=zeros(256);%单映射变量定义初始化 H_GML=zeros(256);%组映射变量定义初始化 src=zeros(256);%源图像像素分为256个等级 dst=z原创 2016-06-04 17:48:05 · 2329 阅读 · 0 评论 -
计算a+b
题目描述: 求整数a,b的和。输入: 测试案例有多行,每行为a,b的值。输出: 输出多行,对应a+b的结果。样例输入: 1 24 56 9样例输出: 3915#includeusing namespace std;int main(){ int a, b; while(cin>>a>>b) cout<<a原创 2016-09-03 19:58:50 · 590 阅读 · 0 评论 -
opencv 打开网络摄像头
闲着没事从同学那里找到了个openwrt ,突然间想起来OPENCV可以很轻松的打开自带的摄像头,刚开始学习OPENCV 打开过若干次笔记本的摄像头,OPENCV能否打开网络摄像头呢?在百度上搜资料看到别人曾经做到过OPENCV+openwrt做无线监控的项目,觉得OPENCV从网络摄像头获取视频也必定可以实现,其他的论坛里也找到过相关的资料 。我在自己的电脑上面试试了试刚开始老是不行,直接原创 2015-11-03 10:55:44 · 8597 阅读 · 2 评论