首页 文章 精选 留言 我的

精选列表

搜索[学习],共10000篇文章
优秀的个人博客,低调大师

《学习OpenCV3》第6章课后习题

//ExercisesatendofChapter5,《learningOpenCV3》 #include"stdafx.h" #include<opencv2/opencv.hpp> #include<iostream> usingnamespacecv; usingnamespacestd; voidhelp(constchar**argv){ cout<<"\n\n" <<"ThisprogramsolvestheExercisesattheendofChapter5\n" <<"Call:\n" <<argv[0]<<"<path/image_name>\n\n" <<"Forexample:"<<argv[0]<<"/test.jpg\n" <<endl; } intmain(intargc,constchar**argv) { help(argv); if(argc<2){ cout<<"\nERROR:Youhadtoofewparameters.\n"<<endl; return-1; } /************************************************************************/ /*5.1.Drawingpractice:loadorcreateanddisplayacolorimage.Drawoneexampleof everyshapeandlinethatOpenCVcandraw.*/ /************************************************************************/ Matsrc=imread("e:/template/lena.jpg"); cv::circle(src,Point(100,100),100,Scalar(255,255,255),2);//circle cv::rectangle(src,Point(0,0),Point(300,300),Scalar(255,255,255),2);//rectangle cv::line(src,Point(0,0),Point(300,300),Scalar(255,255,255),2);//line cv::ellipse(src,cv::Point(100,100),Size(100,100),45,0,180,Scalar(255,0,0),2);//ellipse /************************************************************************/ /*5.2.Grayscale:loadanddisplayacolorimage. a.Turnitintothree-channelgrayscale(itisstillanBGRimage,butitlooksgray totheuser). b.Drawcolortextontotheimage.*/ /************************************************************************/ //a Mattmp; cvtColor(src,tmp,COLOR_BGR2GRAY); cvtColor(tmp,src,COLOR_GRAY2BGR); //b putText(src,"puttext",Point(50,30),CV_FONT_HERSHEY_DUPLEX,1.0f,Scalar(0,255,0)); /************************************************************************/ /*5.5.Usecv::LineIteratortocountpixelsondifferentlinesegmentsin,say,a300×300image. a.Atwhatanglesdoyougetthesamenumberofpixelsfor4-connectedand 8-connectedlines? b.Forlinesegmentanglesotherthantheabove,whichcountsmorepixels: 4-connectedor8-connectedlines? c.Foragivenlinesegment,explainthedifferenceinthelengthofthelinecompared tothenumberofpixelsyoucountiteratingalongthelinefor both4-connectedand8-connected?Whichconnectednessisclosertothetrue linelength? /************************************************************************/ //a、 LineIteratorit_4_x(src,Point(0,0),Point(0,100),4); LineIteratorit_8_x(src,Point(0,0),Point(0,100),4); LineIteratorit_4_y(src,Point(0,0),Point(100,0),4); LineIteratorit_8_y(src,Point(0,0),Point(100,0),4); cout<<"it_4_x"<<it_4_x.count<<"it_8_x"<<it_8_x.count<<endl; cout<<"it_4_y"<<it_4_y.count<<"it_8_y"<<it_8_y.count<<endl; //btheansweris:4-connectedcountsmorepixelsthan8-connectedcounts LineIteratorit_4(src,Point(0,0),Point(100,100),4); LineIteratorit_8(src,Point(0,0),Point(100,100),8); cout<<"it_4"<<it_4.count<<"largethanit_8"<<it_8.count<<endl; //c //thedifferenceisthesameasthedifferencebetween4-connectedand8-connected //Ivelevethe8-connectedisclosertothetruelinelength. waitKey(); return0; } 来自为知笔记(Wiz) 目前方向:图像拼接融合、图像识别 联系方式:jsxyhelu@foxmail.com

优秀的个人博客,低调大师

docker学习系列2 保存对容器的修改

接上篇 docker容器虽然运行起来了。 但遇到了新的问题: 容器内安装的服务器是nginx,nginx对 PHPINFO 支持不好,对于ThiankPHP项目,简单的说在apache服务器下运行 http://localhost:8088/home/Index/index 能正常返回结果,而nginx返回404,必须要写成 http://localhost:8088/index.php?m=home&c=Index&a=demo 所以我需要修改nginx配置文件,使其支持。 由于容器本身是无状态的我修改完配置文件,关闭docker,下次在启动后还是原样,我需要保存修改。 下面是解决方法: 容器为了精简没有按照VIM,编辑文件不方便,要先安装 apt-get update; apt-get install vim 如果执行 apt-get update 超时了,得翻墙。 vi /etc/nginx/sites-enabled/default 编辑并修改配置文件,记得最好先备份 修改完新开个窗口 先执行 docker ps 查看正在运行的容器,复制 container id。 然后 docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]] 如 docker commit cb439fb2c714 finley/phpenv:tp3.2 commit 会基于对container的修改创建一个新的镜像 具体用法请参见官方文档:commit 注意: 经查,不推荐更改运行中的容器配置,容器本身是无状态的,当然也可以通过进入容器内部的方式进行更改: docker exec -it 这样的更改是无法持久化保存的,当容器重启后,更改就丢失了,正确的做法是将需要持久化保存的数据放在挂载的存储卷中,当配置需要改变时直接删除重建。 回顾: # 从别人那拉个镜像 docker pull eriksencosta/php-dev # 基于上面的镜像加入了自己的修改并提交为自己的镜像,还打了tag docker commit cb439fb2c714 finleyma/php-dev:tp3.2 问题: 这个项目的环境是有了,但是是多人开发,我如何将我的配好的镜像分享给他人呢?见下篇

优秀的个人博客,低调大师

spring cloud(学习笔记)微服务启动错误(1)

今天下午在启动spring cloud微服务的时候,报了这个错误: Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.2018-07-03 20:17:10.295 ERROR 19024 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter : ***************************APPLICATION FAILED TO START*************************** Description: Cannot determine embedded database driver class for database type NONE Action: If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active). Disconnected from the target VM, address: '127.0.0.1:55393', transport: 'socket' Process finished with exit code 1 刚开始我以为是端口被占用。果断cmd并输入netstat -aon,找半天没发现占用的端口,然后又网上看了一下, 转自:https://blog.csdn.net/Loser100/article/details/78190703?locationNum=9&fps=1 SpringBoot启动报错:Cannot determine embedded database driver class for database type NONE springboot启动时会自动注入数据源和配置jpa 解决办法一: 启动类中加入注解:@SpringBootApplication(exclude={DataSourceAutoConfiguration.class,HibernateJpaAutoConfiguration.class}) 解决方法二: 在Application.properties文件内配置数据源即可。代码如下: spring.datasource.url=jdbc:mysql://localhost:3306/test spring.datasource.username=root spring.datasource.password=123456 spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.datasource.max-idle=10 spring.datasource.max-wait=10000 spring.datasource.min-idle=5 spring.datasource.initial-size=5 我仔细的检查了一下,也加了注解,试了一下,我靠,没用啊,人生呐,真是改不完的bedug, 只好用出终极大招,拷贝我自己的代码,删除项目,从新从svn更新项目,导入运行,哎呦我去。怎么还是这问题?难道是我项目配置问题?不对啊,我其他的项目都没有问题啊。束手无策,只好求助小碗(一个认真工作的大佬); 通过反复调试,终于找到了。问题所在,pom.xml里面有一个错误的配置, <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <scope>runtime</scope> </dependency> 删了就可以运行,微服务也可以注册。配置文件请大家仔细检查。配置文件不对,什么都是扯淡。 小舟从此逝,江海寄余生。 --狐狸

优秀的个人博客,低调大师

Java学习(16)--System 类/Date 类/ Calendar类

System (1)系统类 ,提供了一些有用的字段和方法 (2)成员方法 A:运行垃圾回收器 public static void gc() B:退出 jvm public static void exit(int status): 终止当前正在运行的 Java虚拟机。参数用作状态码;根据惯例,非 0的状态码表示异常终止。 C:获取当前时间的毫秒值 public static long currentTimeMillis() D:数组复制 public static void arraycopy(Object src,int srcPos,Object dest,int destPos,intlength) 从指定源数组中复制一个数组, 复制从指定的位置开始, 到目标数组的指定位置结束。 示例: int [] arr = { 11, 22, 33, 44, 55}; int [] arr2 = { 6, 7, 8, 9, 10}; System.arraycopy(arr, 1, arr2, 2, 2); System. out.println(Arrays.toString (arr)); //[11, 22, 33, 44, 55] System.out.println(Arrays.toString(arr2));//[6, 7, 22, 33, 10] Date/DateFormat (1)Date是日期类,可以精确到毫秒。 A:构造方法 Date() Date(long time) B:成员方法 getTime() setTime(long time) C:日期和毫秒值的相互转换 案例:你来到这个世界多少天了 ? 代码: Scanner sc = newScanner(System. in ); // 键盘录入你的出生的年月日 System. out .println( " 请输入你的出生年月日 :" ); String line = sc.nextLine(); SimpleDateFormat sdf = newSimpleDateFormat( "yyyy-MM-dd" ); // 把该字符串转换为一个日期 Date d = sdf.parse(line); long myTime = d.getTime(); // 通过该日期得到一个毫秒值 long nowTime = System. currentTimeMillis (); // 获取当前时间的毫秒值 long time = nowTime - myTime; // 用 D-C得到一个毫秒值 long day = time / 1000 / 60 / 60 / 24; // 把 E的毫秒值转换为年 System. out .println( " 你来到这个世界: " + day + " 天" ); (1)DateFormat 针对日期进行格式化和针对字符串进行解析的类,但是是抽象类, 所以使用其子类 SimpleDateFormat A:SimpleDateFormat(Stringpattern) 给定模式 yyyy-MM-dd HH:mm:ss B:日期和字符串的转换 a:Date -- String format() b:String -- Date parse() 代码: // Date -- String Date d = new Date(); // 创建日期对象 // SimpleDateFormat sdf = new SimpleDateFormat(); // 创建格式化对象 SimpleDateFormat sdf =newSimpleDateFormat( "yyyy 年 MM月dd 日 HH:mm:ss" );//给定模式 // public final String format(Date date) String s = sdf.format(d); System. out .println(s); //String -- Date String str = "2008-08-08 12:12:12" ; //在把一个字符串解析为日期的时候,请注意格式必须和给定的字符串格式匹配 SimpleDateFormat sdf2 = newSimpleDateFormat( "yyyy-MM-dd HH:mm:ss" ); Date dd = sdf2.parse(str); System. out .println(dd); Date d = new Date(); // 创建日期对象 // SimpleDateFormat sdf = new SimpleDateFormat(); // 创建格式化对象 SimpleDateFormat sdf =newSimpleDateFormat( "yyyy 年 MM月dd 日 HH:mm:ss" );//给定模式 // public final String format(Date date) String s = sdf.format(d); System. out .println(s); //String -- Date String str = "2008-08-08 12:12:12" ; //在把一个字符串解析为日期的时候,请注意格式必须和给定的字符串格式匹配 SimpleDateFormat sdf2 = newSimpleDateFormat( "yyyy-MM-dd HH:mm:ss" ); Date dd = sdf2.parse(str); System. out .println(dd); Calendar (1)日历类,封装了所有的日历字段值,通过统一的方法根据传入不同的日历字段可以获取值。 (2)如何得到一个日历对象呢 ? Calendar rightNow = Calendar.getInstance();本质返回的是子类对象 (3)成员方法 A:根据日历字段得到对应的值 // 其日历字段已由当前日期和时间初始化: Calendar rightNow= Calendar.getInstance(); // 子类对象 int year = rightNow.get(Calendar.YEAR);// 获取年 int month = rightNow.get(Calendar.MONTH);// 获取月 int date =rightNow.get(Calendar.DATE);// 获取日 B:根据日历字段和一个正负数确定是添加还是减去对应日历字段的值 public void add(int field,int amount): 根据给定的日历字段和对应的时间,来对当前的日历进行操作。 // 5 年后的 10天前 c.add(Calendar.YEAR,5); c.add(Calendar.DATE, -10); C:设置日历对象的年月日 public final void set(int year,int month,int date): 设置当前日历的年月日如: c.set(2011, 11, 1); (4)案例: 计算任意一年的 2月份有多少天? //键盘录入任意的年份 Scanner sc =newScanner(System.in); System.out.println(" 请输入年份:"); int year = sc.nextInt(); //设置日历对象的年月日 Calendar c = Calendar.getInstance(); c.set(year, 2, 1); // 其实是这一年的3月 1日,把时间往前推一天,就是2月的最后一天 System. out .println(c.get(Calendar.MONTH)); c.add(Calendar.DATE, -1); System. out .println(c.get(Calendar.MONTH)); //获取这一天输出即可 System. out .println(c.get(Calendar.DATE)); BigInteger (1)可以让超过 Integer范围内的数据进行运算 (2)构造方法A:BigInteger(String s) (3)成员方法 public BigInteger add(BigInteger val): //加 public BigInteger subtract(BigInteger val): //减 public BigInteger multiply(BigInteger val): //乘 public BigIntegerdivide(BigIntegerval): //除 public BigInteger[]divideAndRemainder(BigIntegerval) ://返回商和余数的数组 BigDecimal (1)浮点数据做运算, 会丢失精度。所以,针对浮点数据的操作建议采用 BigDecimal。 (2)构造方法 A:BigDecimal(String s) (3)成员方法: public BigDecimal add(BigDecimal augend) //加 public BigDecimal subtract(BigDecimal subtrahend) //减 public BigDecimal multiply(BigDecimal multiplicand) //乘 public BigDecimal divide(BigDecimal divisor) //除 public BigDecimal divide(BigDecimal divisor,int scale,introundingMode) //商,几位小数 减 减

资源下载

更多资源
Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

Nacos

Nacos

Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。

Rocky Linux

Rocky Linux

Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。

Sublime Text

Sublime Text

Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,Python的插件,代码段等。还可自定义键绑定,菜单和工具栏。Sublime Text 的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。Sublime Text 是一个跨平台的编辑器,同时支持Windows、Linux、Mac OS X等操作系统。

用户登录
用户注册
修改密码
忘记密码