param

通过可视化找到图片最佳的二值化的值

依然范特西╮ 提交于 2019-11-29 14:00:37
在图片预处理的过程中,我们常常需要二值化图片,但是二值化值一个个去试,比较麻烦。下面通过trackbar来可视化连续二值化图片的情景。代码如下: import cv2 def threshTrackbar(img): """ 使二值化图片过程可视化 :param img: 待二值化的灰度图 :return thr_v,Shading:阈值,大于阈值时替代的值 """ img_copy = img def nothing(x): pass # Create a window cv2.namedWindow('image') cv2.setMouseCallback('image', OnMouseAction) # create trackbars for color change cv2.createTrackbar('thr', 'image', 121, 255, nothing) cv2.createTrackbar('Shading', 'image', 255, 255, nothing) while (True): cv2.imshow('image', img) k = cv2.waitKey(1) & 0xFF # 通过关闭窗口的右上角关闭 if cv2.getWindowProperty('image', cv2.WND_PROP_AUTOSIZE) < 1:

Python模块学习之xlrd、xlutils、openpyxl 读写/追加Excel文件

落爺英雄遲暮 提交于 2019-11-29 13:43:42
Python操作Excel的四个工具包 xlrd : 对Excel进行 读 相关操作,注意只能操作 .xls xlwt : 对Excel进行 写 相关操作,注意只能操作 .xls ,且只能创建一个全新的Excel然后进行写入和保存。 xlutils :对Excel进行 读、写 相关操作,注意只能操作 .xls openpyxl : 对Excel进行 读、写 相关操作,可操作 2010版的 .xlsx / .xlsm 工具包Python官网相关介绍文档 xlrd : http://xlrd.readthedocs.io/en/latest/ xlwt : http://xlwt.readthedocs.io/en/latest/ xlutils : http://xlutils.readthedocs.io/en/latest/ openpyxl : http://openpyxl.readthedocs.io/en/latest/ xlrd 简单使用 #!/usr/bin/env python #-*- coding:utf-8 -*- import xlrd import os def read_excel(line_num, table_name='Sheet1', excel_name='/FAQ.xls', excel_path='../../resource/): '''

htaccess Redirect directory name to parameter

怎甘沉沦 提交于 2019-11-29 13:28:25
I would like to redirect all paths like this: myurl.com/worldwide/en myurl.com/worldwide/pt myurl.com/worldwide/de to: myurl.com/worldwide/index.php?lang=en myurl.com/worldwide/index.php?lang=pt myurl.com/worldwide/index.php?lang=de Just to be clear a dynamic redirection of the pathname after /worldwide Actually ideally I would like to keep the original url (e.g. myurl.com/worldwide/de ) but load the same php file with the language directory as a param but not sure if this is possible? Thanks Use this code RewriteEngine On RewriteBase /worldwide/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond

Struts2非字段校验器配置风格

白昼怎懂夜的黑 提交于 2019-11-29 13:21:10
一 视图 1 registForm.jsp <%@ page contentType="text/html; charset=GBK" language="java" errorPage="" %> <%@taglib prefix="s" uri="/struts-tags"%> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>请输入您的注册信息</title> <s:head/> </head> <body> <h2>请输入您的注册信息</h2> <s:fielderror/> <s:form action="regist" validate="true"> <s:textfield name="name" label="用户名"/> <s:textfield name="pass" label="密码"/> <s:textfield name="age" label="年龄"/> <s:textfield name="birth" label="生日"/> <s

byte[]合并

亡梦爱人 提交于 2019-11-29 12:20:41
直接上代码吧。 /** * 合并两个byte数组 * 将pByteA的前numA和pByteB的前numB合并 * @param pByteA * @param numA * @param pByteB * @param numB * @return */ public static byte[] getMergeBytes(byte[] pByteA, int numA, byte[] pByteB, int numB){ // int aCount = pByteA.length; // int bCount = pByteB.length; byte[] b = new byte[numA+numB]; for(int i=0;i<numA;i++){ b[i] = pByteA[i]; } for(int i=0;i<numB;i++){ b[numA + i] = pByteB[i]; } return b; } 当然上面是比较笨的方法,也可以用System.arraycopy方法来实现。 转载于:https://my.oschina.net/u/860952/blog/549237 来源: https://blog.csdn.net/chouchou8654/article/details/100807765

ORM之Dapper

こ雲淡風輕ζ 提交于 2019-11-29 11:22:15
一、前言 上一篇【 分层架构设计 】我们已经有了架构的轮廓,现在我们就在这个轮廓里面造轮子。项目要想开始,肯定先得确定ORM框架,目前市面上的ORM框架有很多,对于.net人员来说很容易就想到以ADO.NET为基础所发展出来的ORM框架EntityFramework。不得不说EntityFramework是一个功能很强大的ORM框架,到现在最新的EF分别是EF6(.Net Framework)和EF Core(.Net Core)两个版本。 但是这里我使用的另一个叫Dapper的ORM框架,原因是因为EF太重了,而Dapper是一个轻量级开源的ORM类,他是通过扩展IDbConnection提供一些有用的扩展方法去查询您的数据库,所以Ado.Net支持的数据库,他都可以支持。在速度方面具有“King of Micro ORM”的头衔,几乎与使用原始的ADO.NET数据读取器一样快。第一次使用了他之后,就深深的喜欢上他了。 github地址: https://github.com/StackExchange/Dapper Dapper文档: https://dapper-tutorial.net/dapper 二、Dapper实现 2.1、Dapper的方法 从Dapper文档中,我们知道,Dapper支持一下的方法: Execute :执行一次或多次命令并返回受影响的行数

jQuery写一个简单的弹幕墙

你。 提交于 2019-11-29 10:56:41
概述 近几年由于直播,弹幕流行起来,之前看到过用js制作弹幕墙的思路,觉得很有趣。自己就花了点时间把他做成了更灵活的jQuery插件,现在分享出来。 详细 代码下载: http://www.demodashi.com/demo/10371.html 1、此插件逻辑简单,注释清晰,下载及用 2、如果读者能理解源码当然更好 3、读者可以根据实际需要修改样式或布局 一、准备工作 1、主流浏览器(非ie),ie9+ 2、掌握html、css、js基础 二、实现思路 1、文件结构 bullet-screen.js:插件主js bullet_screen.css:样式文件 index.html:运行入口文件 jquery-1.9.1.min.js:jQuery文件(版本没有要求) 2、页面布局 一个弹幕墙容器接收弹幕 一个文本框输入弹幕 一个发送按钮 一个清屏按钮 3、主要代码 html部分代码 <body> <div class="container"> </div> <div class="menu-bar"> <input type="text" placeholder="弹幕内容" id="bullet-text"/> <span class="btn send">发送弹幕</span> <span class="btn close">关闭弹幕</span> </div> </body

How to work with infinity arguments in a function (like PHP's isset())

别等时光非礼了梦想. 提交于 2019-11-29 10:48:34
问题 You know how PHP's isset() can accept multiple (no limit either) arguments? Like I can do: isset($var1,$var2,$var3,$var4,$var5,$var6,$var7,$var8,$var9,$var10,$var11); //etc etc How would I be able to do that in my own function? How would I be able to work with infinity arguments passed? How do they do it? 回答1: func_get_args will do what you want: function infinite_parameters() { foreach (func_get_args() as $param) { echo "Param is $param" . PHP_EOL; } } You can also use func_get_arg to get a

快递鸟物流单号查询api接口集成,有需要的可以直接用

本小妞迷上赌 提交于 2019-11-29 10:14:32
​​随着网购的发展,快递业也随之壮大。快递查询接口对接的需求量也越来越大,下面是对免费快递接口做的整理,并附上调用流程,分享给大家。 项目开发中,有些需求难免会用到关于快递的一些Api接口;本篇主要介绍的是快递鸟的查询Api接口。 可实现需求: App中直接集成实现快递物流信息查询Api接口 在微信公众号、微商城、电商网站平台中,根据用户输入的订单号,我们的后台识别订单号并根据快递鸟查询快递Api接口,实现自动查询的功能等。 官方网址: http://www.kdniao.com 即时查询api: http://www.kdniao.com/api-track 需要登录 ,申请一下 用户ID 和 API key • 应用场景 ① 买家物流查询:轨迹跟踪、包裹进度、预计送达时间、派送人联系方式等。 ② 卖家物流跟踪:是否超区、转件、多次派送、拒收 ③ 平台监控管理:假交易监控、匹配卖家发货与顾客确认收货时间。 可实现多种语言demo,以javademo为例: import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io

javascript、js数组排序、多条件数组排序

时光毁灭记忆、已成空白 提交于 2019-11-29 10:06:35
开发时经常遇到 排序问题, 比如 遇到 对数据进行 多条件排序 /** * 搜索表单 * @typedef {Object} Condition * @property {string} key 关键字 * @property {boolean} isAscending 是否升序 */ /** * 数组排序 (带条件类型) * @param arr 原数据 * @param {[Condition]} condition 条件列表 * @returns {[]} */ var fns = function (arr, condition) { /** * 开始排序 * @param {object} itemA 对比值A * @param {object} itemB 对比值B * @param {[Condition]} condition 条件列表 * @param {number} index 当前条件排序下标 * @returns {number} */ var sort = function (itemA, itemB, condition, index) { if (!condition[index]) return 0 const { key, isAscending = true } = condition[index] const a = itemA[key]