自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(19)
  • 收藏
  • 关注

原创 blind-项目

python文字转语音(树莓派)环境前提:安装espeak,语音转换引擎(重要):sudo apt-get install espeak安装pyttsx3:sudo pip3 install pyttsx3基础代码:# 语音播报模块import pyttsx3# aiff文件转换成mp3编码文件模块from pydub import AudioSegment# 模块初始化engine = pyttsx3.init()rate = engine.getProperty('r

2022-02-22 18:13:40 435

原创 数组扩展维度问题

import numpy as npx_train=np.array([[3,5,6,4],[6,5,4,4]])print(x_train.shape)print(x_train)print("\n")x_train=np.expand_dims(x_train,axis=1)#x_train=np.expand_dims(x_train,axis=3)print(x_train.shape)print(x_train)

2021-12-08 16:55:28 1185

原创 树莓派通过motion进行实时监控

1.安装motion程序$ sudo apt-get install motion2.配置motion程序$ sudo vim /etc/default/motion把no改成yes,开启motion的daemon一直检测设备。$ sudo vim /etc/motion/motion.conf把daemon off改成daemon on确认视频流的接口是8081把stream_localhost on改成stream_localhost off,关闭localhost本地的限制。把sdl

2021-11-17 13:29:30 480

原创 解决python编码错误问题

SyntaxError: Non-UTF-8 code starting with ‘\xc7’.py文件里有中文字符python版本:3.6版本文件的第一行 加上coding=gbkpython版本:2.7版本文件的第一行 加上--coding:utf8 --

2021-11-17 12:00:10 564

原创 图:算法:拓扑排序

代码#include <stdio.h>#define MAXV 20 //最大顶点个数typedef int InfoType;//以下定义邻接矩阵类型typedef struct{ int no; //顶点编号 InfoType info; //顶点其他信息} VertexType; //顶点类型typedef struct //图的定义{ int edges[MAXV][MAXV]; //邻接矩阵 int n, e; //顶点数,弧数 Vertex

2021-11-12 01:26:05 102

原创 图某点到其它的最短路径——Dijkstra算法

代码#include <stdio.h>#define MaxSize 20#define INF 32767 //INF表示∞#define MAXV 20 //最大顶点个数typedef char InfoType;typedef struct{ int no; //顶点编号 InfoType info; //顶点其他信息} VertexType; //顶点类型typedef struct //图的定义{ int edges[MAXV][MAXV]; //

2021-11-12 01:23:50 224

原创 最小生成树算法——Kruskal算法

工程代码#include <stdio.h>#define MaxSize 20#define INF 32767 //INF表示∞#define MAXV 20 //最大顶点个数typedef char InfoType;typedef struct{ int no; //顶点编号 InfoType info; //顶点其他信息} VertexType; //顶点类型typedef struct //图的定义{ int edges[MAXV][MAXV];

2021-11-12 00:43:05 335

原创 最小生成树——prim算法

prim算法程序的一些讲解只是个人自身想法上去理解,可能会说得不是很准确,看不懂得话,就别看了,只是个人学习记录。#include <stdio.h>#define MAXV 20 //最多顶点数#define INF 32767 //INF表示∞typedef char InfoType;typedef struct{ int no; //顶点编号 InfoType info; //顶点其他信息} VertexType; //顶点类型typedef stru

2021-11-11 21:20:35 85

原创 TCP、UDP编程的小知识

TCP、UDP收发数据大小的问题数据包的发送数据包的接收

2021-11-09 00:24:03 2037

原创 python图片转为灰度图

python图片转为灰度图import cv2for i in range(1,50):#批量处理照片 img = cv2.imread('E:\\opencv_picture\\stairs\\'+str(i)+'.jpg',cv2.IMREAD_GRAYSCALE)#读入照片,并转灰度 img1 = cv2.resize(img,(50,50))#调整大小 cv2.imwrite('E:\\opencv_picture\\stairs_Grayscale\\'+str(i)+'.jpg',i

2021-11-07 19:24:39 996

原创 矩阵方式存储图,深度优先遍历代码(c++)

图的代码实现头文件#include <iostream>using namespace std;#define MAXV 7 //最大顶点个数typedef int weight; //邻接矩阵元素类型typedef char ElemType; //顶点数据元素类型//邻接矩阵类型typedef struct { weight arcs[MAXV][MAXV]; //邻接矩阵 ElemType data[MAXV]; //一维数组顶点表 int n; /

2021-11-04 18:42:34 349

原创 linux简单的服务端与客户端代码

linux简单的访问的代码#include <stdio.h>#include <unistd.h>#include <fcntl.h>#include <sys/socket.h>#include <arpa/inet.h>#include <netinet/in.h>#include <strings.h>#define MAXCONN 8int main(){ int listen_fd,comm

2021-11-03 14:01:25 404

原创 1. 两数之和

1. 两数之和如输入:nums = [2,7,11,15], target = 9输出:[0,1]解释:因为 nums[0] + nums[1] == 9 ,返回 [0, 1] 。利用哈希表算法:将target减去数组中的num[i],如果哈希表中没有对应的哈希值,则将其存入哈希表中;否则返回。class Solution { public int[] twoSum(int[] nums, int target) { Map<Integer, Integer>

2021-10-21 18:42:15 120

转载 53. 最大子序和

最大子序和 步骤:1、定义两个变量,一个记录当前最大值(result),一个记录后续值(sum)。 2、当后续值大于当前最大值,则更换最大值。 3、核心思想是:遍历迭代相加元素,前面的和小于0时,则抛弃之前的元素class Solution{public: int maxSubArray(vector<int> &nums) { //类似寻找最大最小值的题目,初始值一定要定义成理论上的最小最大值 int result = I

2021-10-14 20:19:54 101

原创 存在重复元素

217. 存在重复元素 C++方法1:利用vector容器 思想:先排序元素,后比较前后元素是否相等class Solution {public: bool containsDuplicate(vector<int>& nums) { sort(nums.begin(), nums.end());//排序元素 int n = nums.size(); for (int i = 0; i < n - 1; i++) {

2021-10-14 14:39:01 82

原创 自定义linux命令行

在linux下,自己实现命令mycopy,文件的复制,假设复制的源文件名为src.txt,目标文件名dest.txt。如下命令是:./mycopy src.txt dest.txt。 main()函数,获取命令行的参数的原理是:执行命令行时,系统底层会调用exec()函数,返回对应 参数传给main(),通过这两个步骤现实命令行交换。#include <unistd.h>#include <fcntl.h>#include <stdio.h&gt

2021-10-12 23:17:22 370

原创 Python切片[:]与[::]

概述[:]或[::]:是对序列(如字符串、列表等)中元素进行截取。[:]用法s[i:j] 表示从下标 i 截取序列s中的元素到下标 j,要符合i < j若i或j大于len(s),则被len(s)取代,如>>>a=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]>>>a[1:20][1, 2, 3, 4, 5, 6, 7, 8, 9]若 i 省略不写,表示为0若 j 省略不写,表示为len(s)大小若i&gt

2021-10-10 22:36:59 343

原创 获取类运行时结构

获取类运行时结构Class c1 = Class.forName("com.kuangstudy.AnnotationAndReflect.User");c1.getName() //获取包名+类名 c1.getSimpleName() //只获取类的名字//获取类的属性Field[] fields = c1.getFields();//只能找到public属性:源码强调:Member.PUBLIC, for (Field field : fields) {

2021-10-10 15:40:09 84

原创 数据结构_顺序表结构

#include "listinarray.h"//初始化空线性表void InitList(SqList &L){ L.length = 0;}//判断线性表是否为空bool ListEmpty(SqList L){ if (L.length == 0) return true; else return false;}//求出线性表长度int ListLength(SqList L){ return L.length;}//向线性

2021-10-09 13:06:12 96

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除