res

边缘检测

放肆的年华 提交于 2019-12-02 05:56:41
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。 本文链接: https://blog.csdn.net/Mind_programmonkey/article/details/99476665 Canny边缘检测 使用高斯滤波器,以平滑图像,滤除噪声。 计算图像中每个像素点的梯度强度和方向。 应用非极大值(Non-Maximum Suppression)抑制,以消除边缘检测带来的杂散响应。 应用双阈值(Double-Threshold)检测来确定真实的和潜在的边缘。 通过抑制孤立的弱边缘最终完成边缘检测。 1 高斯滤波器 2 梯度和方向 3 非极大值抑制 4 双阈值检测 import cv2 import matplotlib . pyplot as plt % matplotlib inline import numpy as np def cv_show ( name , img ) : cv2 . imshow ( name , img ) cv2 . waitKey ( 0 ) cv2 . destroyAllWindows ( ) 1 2 3 4 5 6 7 8 9 img = cv2 . imread ( "lena.jpg" , cv2 . IMREAD_GRAYSCALE ) v1 = cv2 . Canny

python数据类型

回眸只為那壹抹淺笑 提交于 2019-12-02 02:34:12
1. 数字类型 1 # 1.整型 2 num = -1000000000000000000000000000000000000000000000000 3 print(num, type(num)) 4 5 # 2.小数 6 num = 3.14 7 print(num, type(num)) 8 9 # 3.布尔 10 res = True 11 print(res, type(res), isinstance(res, int)) 12 print(3.14 + True) 13 14 # 4.复数 15 num = complex(5, 4) # 5 + 4j 16 print(num + (4 + 5j)) 17 18 # 数字类型直接的相互转化 ***** 19 a = 10 20 b = 3.74 21 c = True 22 print(int(a), int(b), int(c)) 23 print(float(a), float(b), float(c)) 24 print(bool(a), bool(b), bool(c)) 2. 字符串类型 1 # 1.定义: 可以有多种引号嵌套 2 3 # 需求:你是"好学生" 4 s1 = "你是\"好学生\"" 5 print(s1) 6 # 可以通过引号的嵌套,使内部不同的引号在不转义的情况下直接输出 7 s2 =

使用axios请求数据,post请求出错。因为axios传递的请求参数是json格式,而后端接口要求是formData

别说谁变了你拦得住时间么 提交于 2019-12-01 16:45:45
设置请求头标准写法 const config = { headers : { adminSign : 'admin' } } ; that . axios . get ( dataUrl + "myadmin/info" , config ) . then ( res => { console . log ( res , "首页表格成功" ) ; that . artistNum = res . data . info . artist_num ; that . allNum = res . data . info . all_num ; that . dataFilter ( res . data . info . data ) ; } ) . catch ( err => { console . log ( err , "首页表格失败" ) ; } ) ; 设置请求头 // 请求参数类型为FromData时候的headers的配置 let FromDataconfig = { headers : { 'Content-Type' : 'multipart/form-data;boundary = ' + new Date ( ) . getTime ( ) } } axios . post ( '/account/' , data , FromDataconfig )

axios获取数据 增删改查

左心房为你撑大大i 提交于 2019-12-01 16:40:39
<!DOCTYPE html> < html lang = " en " > < head > < title > </ title > < meta charset = " UTF-8 " > < meta name = " viewport " content = " width=device-width, initial-scale=1 " > < script src = " ./vue.js " > </ script > <!-- 1. 引入axios文件 --> < script src = " ./axios.js " > </ script > < style > #app { width : 600px ; margin : 10px auto ; } .tb { border-collapse : collapse ; width : 100% ; } .tb th { background-color : #0094ff ; color : white ; } .tb td,.tb th { padding : 5px ; border : 1px solid black ; text-align : center ; } .add { padding : 5px ; border : 1px solid black ; margin-bottom :

[LeetCode] 187. Repeated DNA Sequences

大憨熊 提交于 2019-12-01 14:06:26
重复的DNA序列。给的input是一个DNA序列,请输出所有出现多次的DNA子序列。这题有位运算的做法但是个人觉得用hashset的做法更方便。 思路是用两个hashset,一个存子序列是否出现过(seen),另一个存最后的输出(res)。当某个子序列在seen中已经有了,就存入res;最后输出res里面所有的子序列。 时间O(n) - n是input字符串长度 空间O(n) - 用了两个hashset 1 /** 2 * @param {string} s 3 * @return {string[]} 4 */ 5 var findRepeatedDnaSequences = function(s) { 6 let seen = new Set(); 7 let res = new Set(); 8 for (let i = 0; i < s.length - 9; i++) { 9 const str = s.substring(i, i + 10); 10 if (seen.has(str)) { 11 res.add(str); 12 } else { 13 seen.add(str); 14 } 15 } 16 return Array.from(res); 17 }; 来源: https://www.cnblogs.com/aaronliu1991/p/11689679

P2572 [SCOI2010]序列操作

允我心安 提交于 2019-12-01 11:57:42
没什么好说的,细节题 注释放代码里 #include<bits/stdc++.h> using namespace std; const int N=1e5+7; template <class I> inline void read(I &x){ int f=1; char c; for(c=getchar();c<'0'||c>'9';c=getchar()) if(c=='-') f=-1; for(x=0;c>='0'&&c<='9';x=(x<<3)+(x<<1)+(c&15),c=getchar()); x*=f; } int n,m; bool a[N]; struct tree{ int l=1<<30,r=0,sum=0,lm1=0,rm1=0,lm0=0,rm0=0,mx1=0,mx0=0,op1=-1; bool xr=0; tree(int l=0,int r=0,int sum=0,int lm1=0,int rm1=0,int lm0=0,int rm0=0,int mx1=0,int mx0=0,int op1=-1,bool xr=0): l(l),r(r),sum(sum),lm1(lm1),rm1(rm1),lm0(lm0),rm0(rm0),mx1(mx1),mx0(mx0),op1(op1),xr(xr){} #define l(x) t[x

23. Merge k Sorted Lists

瘦欲@ 提交于 2019-12-01 10:26:31
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. Example: Input: [ 1->4->5, 1->3->4, 2->6 ] Output: 1->1->2->3->4->4->5->6直接复用归并排序即可 /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ class Solution { public: ListNode* mergeKLists(vector<ListNode*>& lists) { ListNode *res=NULL; for(int i=0;i<lists.size();++i) { if(NULL==res) { res=lists[i]; continue; } res=merge(res,lists[i]); } return res; } ListNode* merge(ListNode *l1,ListNode *l2) { if(NULL==l1)return

vue qs插件的使用

雨燕双飞 提交于 2019-12-01 10:06:12
参考: https://blog.csdn.net/weixin_43851769/article/details/86505164 qs 是一个增加了一些安全性的查询字符串解析和序列化字符串的库。 步骤: 1. 安装 npm install qs 2. 在需要用到的组件中 import qs from 'qs’ qs.parse()——将URL解析成对象的形式 qs.stringify()——将对象 序列化成URL的形式,以&进行拼接 qs.stringify()使用: methods: { getData() { let _this = this,        params = { param1: _this.param1,        param2: _this.param2 } }; _this.axios.get('****', qs.stringify(params)).then(function(res) { if (res.status == 200 && res.data.result == 0) { alert('success'); }else{         alert('fail');       } }).catch(function(err) { console.log(err); }) }, } 个人是没用qs,采用其他方式传的:

select_related与prefetch_related

余生长醉 提交于 2019-12-01 08:36:25
# select_related与prefetch_related # # select_related帮你直接连表操作 查询数据 括号内只能放外键字段 # # res = models.Book.objects.all().select_related('publish') # # for r in res: # # print(r.publish.name) # # res = models.Book.objects.all().select_related('publish__xxx__yyy__ttt') # # print(res) # # res = models.Book.objects.all() # """ # select_related:会将括号内外键字段所关联的那张表 直接全部拿过来(可以一次性拿多张表)跟当前表拼接操作 # 从而降低你跨表查询 数据库的压力 # # 注意select_related括号只能放外键字段(一对一和一对多) # res = models.Book.objects.all().select_related('外键字段1__外键字段2__外键字段3__外键字段4') # """ # # prefetch_related 不主动连表 # res = models.Book.objects.prefetch_related(

Express multer 文件上传

拥有回忆 提交于 2019-12-01 08:06:39
npm multer 文件上传 Express app 范本就不写了,仅记录一下上传部分的代码。 const fs = require('fs'); const express = require('express'); const multer = require('multer'); const multer_dest = multer({dest: 'public/uploads/'}); const async_route_wrap = fn => { return function wrap(...args) { const ret = fn(...args); const next = args[args.length - 1]; return Promise.resolve(ret).catch(next); }; }; const index = async(req, res) => { res.send(`<form method="post" action="/upload" enctype="multipart/form-data"> <input type="file" name="file1"/> <button type="submit">upload</button> </form`); }; const upload = async(req, res