- 博客(33)
- 收藏
- 关注
原创 ubuntu中用qtcreator搭建opencv工程,编译时提示:找不到lopencv_imgcodecs
opencv_imgcodecs only exists in opencv3, not opencv2.4(where all of its functionality is in highgui)也就是说opencv版本的问题
2018-05-30 14:03:37
2406
1
原创 python字符串和int,float相互转化
(1)str转为int或者float如果是一个变量,则直接类型转化: vr=666>>> vr666>>> str(vr)'666'>>> int(vr)666但是大部分情况是对list数据进行转化,则:方法一:使用map(eval,vr)>>> vr=['1','2','3']>>>
2018-05-29 14:58:30
97933
原创 python按列读取文本数据
工作需要按照列读取文本文件,解决过程记录如下:(1)易读写法:import csvimport numpy as npwith open('imu0.csv','r') as f: timestamps=[] omega=[] alpha=[] for row in f.readlines(): row=row.split(',') ...
2018-05-29 14:39:30
27818
1
原创 排序算法性质总结
(1)稳定性:在排序之前,如果关键字Ki==Kj,并且i<j,称关键字Ki在Kj之前;如果在排序之后,Ki依然在Kj之前,则为稳定排序,反之为不稳定排序稳定排序有:冒泡排序,插入排序,归并排序,基数排序。 不稳定排序有:快速排序,希尔排序,简单选择排序,堆排序。 (2)算法的时间复杂度与初始排序无关:选择排序,堆排序,归并排序,基数排序在平均情况,最坏情况,最好情况下的时间复杂度均一致...
2018-05-27 11:05:29
1147
原创 python:按行读入,排序然后输出
题目描述给定n个字符串,请对n个字符串按照字典序排列。输入描述:输入第一行为一个正整数n(1≤n≤1000),下面n行为n个字符串(字符串长度≤100),字符串中只含有大小写字母。输出描述:数据输出n行,输出结果为按照字典序排列的字符串。示例1输入9captocatcardtwotooupboatboot输出boatbootcapcardcattotootwoup...
2018-05-26 22:00:53
11343
原创 关于C++ vector等容器排序问题
C++ vector排序参考 https://blog.youkuaiyun.com/upc_xbt/article/details/53305962注意:#include<iostream>#include<vector>#include<algorithm>using namespace std;int main(){ int num=0; c...
2018-05-26 21:29:18
2195
原创 python 报错:str=input() File "<string>", line 1, in <module> NameError: name 'hello' is not defined
简单的程序:str=input()print(str)结果报错:str=input() File "<string>", line 1, in <module> NameError: name 'hello' is not defined原来时python版本的问题:这是python3的语法,但是自己电脑时python2.7改为:str=raw_input()pri...
2018-05-26 20:16:58
29290
1
原创 python输出列表不带中括号和引号
平时python输出list字符串时,会自动加上引号和中括号。比如str=['hello','world']>>> str['hello', 'world']方法1可以用join方法:>>> print " ".join(str)hello world其中:Python join() 方法用于将序列中的元素以指定的字符连接生成一个新的字符串。比如:str...
2018-05-26 20:12:29
67753
6
原创 python通过os.walk读取文件夹中的连续图片
之前读取并处理文件夹中的连续图片,都是先将其时间戳或者文件名保存到txt。处理时读取txt文件。今天尝试了python中的os.walk。不需要事先保存图像名称,很方便。代码如下:#!/usr/bin/env pythonprint "importing libraries"import time, sys, osimport argparseimport cv2import numpy...
2018-05-23 15:28:10
2378
原创 python 正则表达式检验匹配数字和email
import redef match_signal(src,dst): m=re.match(src,dst) if m!=None: print('match ok') # print(m.group(0)) # print(m.group(1)) # print(m.group(2)) print(m.group()) else: print('fail') ...
2018-05-12 15:07:13
2660
原创 qDebug输出QString数据带引号的问题
在使用qDebug输出QString,直接输出会有问题:QString str1="welcome";qDebug()<<str1;注意不是QDebug输出:"welcome"如果想输出不带引号的正确的方法如下:使用如下函数转换一下:const char * qPrintable(const QString & str)QString str1="welcome";qDeb...
2018-04-05 10:15:38
10098
6
转载 vector对结构体排序的sort算法
转载自从最简单的vector中sort用法到自定义比较函数comp后对结构体排序的sort算法sort函数在使用中非常好用,也非常简单,而且效率与冒泡或者选择排序不是一个数量级。本文就sort函数在vector中的用法分为sort函数入门用法与自定义comp比较函数比较结构体这两个最基本的功能讲讲其用法:1、sort入门:使用sort需要包含algorithm头文件,完整代码如下#include&...
2018-03-20 20:37:02
1008
原创 char *输出的问题,以及指针的问题
char *word="again";cout<<word<<endl;cout<<(*word)<<endl;输出结果为:againachar *word="again";表示在静态存储区分配空间,并把“again”放在内存区域,因为静态存储区里的数据是不能改变!!!而在栈了也分配空间,并把"again”在静态存储区的首地址放在栈里的内存中
2018-03-11 20:36:08
5087
原创 IEEE Xplore格式检查生成pdf并进行认证
提交的论文需要通过IEEE Xplore格式检查,取得认证收条(认证收条就是IEEE格式审查后发送的邮件)。您好,1、如果您是第一次使用该系统,请用您的邮箱注册;2、请将您的源文件(Word或Latex)上传到IEEE,过几分钟后您将收到PDF文件,该文件为您的终稿3、将该PDF文件上传到IEEE中,您将收到一封邮件,格式为(Congratulations! The following PD...
2018-03-10 13:06:19
12711
7
原创 C++读写文件,vector排序等
C++文件读写时,遇到的问题如下:// ConsoleApplication1.cpp: 定义控制台应用程序的入口点。//#include "stdafx.h"#include<iostream>#include<sstream>#include<fstream>#include<string>#include<vector&g...
2018-03-02 16:59:31
472
原创 指针的按值传递,按址传递以及指针的引用
指针作为形参,最常用的是按址传递,如下:swap(int a, int b){ int t = a; a = b; b = t;} swap1(int *a, int *b){ int t = *a; *a = *b; *b = t; }int main(){ int a=2, b =3; swap(a,b...
2018-02-15 00:09:05
464
转载 PCL—低层次视觉—点云分割(RanSaC)
PCL—低层次视觉—点云分割(RanSaC) - IronStark - 博客园var currentBlogApp = 'ironstark', cb_enable_mathjax=true;var isLogined=false; MathJax.Hub.Config({ tex2jax: { inlineMath: [['$','$'], ['\\(
2018-02-07 19:18:33
829
原创 简单的点云读取与可视化
环境为vs2017+pcl1.8.1在pcl官网Simple Cloud Visualization 教程中 #include //... void foo () { pcl::PointCloudpcl::PointXYZRGB>::Ptr cloud; //... populate cloud pcl::visualization::CloudVie
2018-02-06 18:39:34
4742
原创 mysql5.7遇到的问题
(1)安装成功后,在命令提示符中输入mysql 提示错误。解决办法:将mysql根目录加到path中:(2)登录时mysql -u root -p命令后输入密码提示:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)修改为:mysql -u root
2018-01-30 21:26:46
1603
原创 C++ 模板函数和模板类的实现
学习C++模板时练习的代码。模板函数:templatevoid swapNum(T &a, T &b){ T temp; temp = b; b = a; a = temp;}调用的时候: int aa = 5, bb = 6; swapNum(aa, bb); cout 模板类相对复杂,注意3点:(1)必须将类中方法的声明和定义都写在头文
2018-01-28 19:42:03
2943
原创 c++实现在实例化时为每个对象添加唯一ID
用类的静态成员变量实现,在构造函数中增加ID的值,然后析构函数中减小ID的值。这样就保证了每次实例化时的ID唯一。然后将该静态成员变量赋值给私有变量即可。具体代码如下:类的声明:#pragma once#includeclass tank{public: tank(); ~tank(); void fire(); static int getCount(); int ge
2018-01-28 16:01:40
4375
原创 c++读写文件
c++读写文件与容器等结合:// try_code.cpp: 定义控制台应用程序的入口点。//#include "stdafx.h"#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;struct
2018-01-21 22:06:45
312
原创 vs读取txt文件一直失败
在工程目录下用记事本新建了一个txt文件,try.txt,然后用vs读取该txt文件 string file = "try.txt"; ifstream in; in.open(file.data()); if (!in.is_open()) { cout << "can't open the txt"<<endl; } string line; cou
2018-01-21 20:15:21
8957
3
原创 vector和list等容器之间的相互赋值
使用assign成员函数: list authors = { "jie","rice","pig" }; vectorarticles = { "a","an","the" }; articles.assign(authors.begin(), authors.end()); for (auto c : articles) { cout << c << endl; }
2018-01-18 10:32:33
6144
原创 C/C++ 获取数组的有效长度
(1)字符数组。采用如下strlen()最简单。char b[] = "abc";cout 输出3注意:存储字符串的字符数组末尾有一个'/0'字符,因此cout << sizeof(b) / sizeof(b[0]) << endl;cout 得到的结果都为4,应该修改。(2)其他情况,则如下都行:int a[] = { 1,2,3 };cout << sizeof(a)/sizeof(a[
2018-01-17 19:10:04
15320
原创 C++ 模板,二分法寻找vector中指定元素位置
练习模板,vector的时候,尝试写二分法。代码记录如下:#include "stdafx.h"#include #include#includeusing namespace std;//二分法寻找指定元素在vector的位置//注意二分法中的元素要事先排序templateint find_element(vector&ver, T num){ auto beg=
2018-01-17 17:58:46
2514
原创 TortoiseGit 代码版本回退及返回
toiseGit 代码回退1 项目右键选择然后点击 show log2 选中需要回退的代码版本 3. 右键 选择“ Reset "masterto this ”4. 选择hard 代码返回如果想要再回退到原来的新版本,那么右键项目,选择TortoiseGit 然后点击show reflog,然后就会出现各种版本号,然后同上, 右键选择reset to
2018-01-12 15:48:36
26573
1
转载 在VS2013 使用C语言库函数,出现出现错误,提示使用不安全函数use _CRT_SECURE_NO_WARNINGS
在VS2013 使用C语言库函数,出现出现错误,提示使用不安全函数use _CRT_SECURE_NO_WARNINGS
2018-01-12 15:33:40
434
原创 类中定义数组提示:静态成员引用必须与特定对象相对
class A {private:int outHeight = 24;int outWidth = 660;unsigned short distData[outHeight * outWidth];}想定义类中数组,但是,会提示:静态成员引用必须与特定对象相对。当改为静态成员变量:static int outHeight = 24;提示:带有类内初始值设定项
2018-01-11 18:24:34
964
原创 C++ extern 在命名空间中的使用
在C++中使用命名空间中的全局变量,如何声明,才不会重复定义呢?(1)在test.h 中声明namespace try{ extern double gCameraMatrix[9]; extern double gDistCoeffs[4];}在test.cpp中定义namespace try{ double gCameraMatrix[9]; double gDi
2018-01-11 10:29:49
4871
原创 pcl画线并实时更新
在pcl中,有一类可以画两点之间线段的函数,绘制点之间连线的方法十分有用,例如,显示两组点云之间的对应点关系时,可方便用户直观的观看点云之间的对应关系。它是可视化函数pcl::visualizeton的一员。具体用法如下:#include#include#include#includeusing namespace std; typedefpcl::PointClo
2018-01-05 17:50:00
8758
3
原创 点云实时显示
激光雷达要用到点云的实时显示,所以记录下来。simpleVis(pcl::PointCloud::ConstPtr cloud, pcl::PointCloud::ConstPtr cloud2) { boost::shared_ptr viewer(new pcl::visualization::PCLVisualizer("3D Viewer")); viewer->initCamer
2018-01-05 16:50:29
3768
5
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人