当前位置: 首页 > news >正文

电机实验曲线数据提取

 

 

 

 

处理Python 代码供参考: 1、曲线数据还原

import cv2
import numpy as np
import matplotlib.pyplot as plt# 读取图像
image_path = '1.png'
image = cv2.imread(image_path)
image_copy = image.copy()  # 创建图像副本,用于叠加显示# 转换为灰度图像
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
# 检测边缘
edges = cv2.Canny(gray, 50, 150)# 霍夫变换检测直线
lines = cv2.HoughLinesP(edges, 1, np.pi / 180, threshold=100, minLineLength=50, maxLineGap=10)# 初始化掩码
grid_mask = np.zeros_like(gray)# 存储网格线的坐标
horizontal_lines = []
vertical_lines = []# 遍历检测到的直线
if lines is not None:for line in lines:x1, y1, x2, y2 = line[0]angle = np.abs(np.arctan2(y2 - y1, x2 - x1) * 180.0 / np.pi)# 判断是水平线还是垂直线if angle < 10 or angle > 170:horizontal_lines.append((x1, y1, x2, y2))elif 80 < angle < 100:vertical_lines.append((x1, y1, x2, y2))# 找到最近的边缘点,在给定的初始点附近找到最近的边缘点作为新的起始点
def find_nearest_edge_point(edges, x_start, y_start):h, w = edges.shapemin_dist = float('inf')nearest_point = (x_start, y_start)for y in range(max(0, y_start - 10), min(h, y_start + 10)):for x in range(max(0, x_start - 10), min(w, x_start + 10)):if edges[y, x] > 0:dist = (x - x_start) ** 2 + (y - y_start) ** 2if dist < min_dist:min_dist = distnearest_point = (x, y)return nearest_pointdef track_curve_kRPM(edges,x_start,y_start):h, w = edges.shape  # edges.shape返回一个包含图像高度和宽度的元组,将图像的高度和宽度分别赋值给变量h和wvisited = np.zeros((h, w), dtype=bool)  # np.zeros((h, w), dtype=bool)创建一个形状为(h, w)的布尔型二维数组,所有元素初始化为False。# 这个数组用于记录在曲线跟踪过程中哪些像素点已经被访问过。x1_start, y1_start = find_nearest_edge_point(edges, x_start, y_start)# 确认起始点在边缘上if edges[y1_start, x1_start] == 0:raise ValueError("未能找到边缘点,请检查起始点")curve_points = []start=x1_start,y1_startstack = [start]# stack是一个先进后出(LIFO) 或先进先出(FIFO) 的数据结构, 用于实现DFS或BFS算法, 从起始点开始逐步扩展, 找到与之相连的边缘像素点full_search_count = 0while len(stack) > 0:# 从stack中弹出(删除并返回)最后一个元素,这个元素是一个像素点的坐标(x, y)x, y = stack.pop()# 检查弹出的像素点坐标是否在图像范围内,以及是否已经被访问过。# 如果任一条件满足,说明该像素点无效或已被访问,则执行continue语句,跳过当前循环的剩余部分,继续执行下一次循环。if x < 0 or x >= w or y < 0 or y >= h or visited[y, x]:continue# 将当前像素点标记为已访问visited[y, x] = True# 将当前像素点的坐标添加到curve_points列表中,用于存储曲线上的所有点if (not is_point_near_vertical_line(x, y, vertical_lines, 2) and not is_point_near_horizontal_line(x, y,horizontal_lines,2)):curve_points.append((x, y))# (x+)(y+)neighbors = [(x + 1, y + 1), (x + 1, y), (x, y + 1),(x + 2, y + 2), (x + 2, y), (x, y + 2)# (x + 3, y + 2), (x + 3, y), (x, y + 3)# (x + 4, y + 4), (x + 4, y), (x, y + 4)]# # 遍历相邻像素点的坐标# for nx, ny in neighbors:#     # 检查相邻像素点是否在图像范围内、未被访问过、且是边缘像素点(像素值大于0)。#     # 如果所有条件都满足,说明该相邻像素点是有效的,可以加入stack#     if 0 <= nx < w and 0 <= ny < h and not visited[ny, nx] and edges[ny, nx] > 0:#         stack.append((nx, ny))# 针对曲线先从下到右上然后又转右下的情况point_count = 0for nx, ny in neighbors:if 0 <= nx < w and 0 <= ny < h and not visited[ny, nx] and edges[ny, nx] > 0:stack.append((nx, ny))point_count += 1return curve_points# 通过BFS/DFS跟踪曲线
# 通过BFS或DFS算法跟踪曲线。它接受边缘图像、起始点、搜索方向和阈值作为输入,返回曲线上的点集合
def track_curve_eff(edges, x1,y1,KRPM_points):direction="right_up"switch_direction = directionh, w = edges.shape  # edges.shape返回一个包含图像高度和宽度的元组,将图像的高度和宽度分别赋值给变量h和wvisited = np.zeros((h, w), dtype=bool)  # np.zeros((h, w), dtype=bool)创建一个形状为(h, w)的布尔型二维数组,所有元素初始化为False。# 这个数组用于记录在曲线跟踪过程中哪些像素点已经被访问过。curve_points = []start = find_nearest_edge_point(edges,x1,y1)stack = [start]# stack是一个先进后出(LIFO) 或先进先出(FIFO) 的数据结构, 用于实现DFS或BFS算法, 从起始点开始逐步扩展, 找到与之相连的边缘像素点while len(stack) > 0:# 从stack中弹出(删除并返回)最后一个元素,这个元素是一个像素点的坐标(x, y)# print(len(stack))x, y = stack.pop()# if len(stack) == 1:#     print("stack = 1 ")#     if switch_direction == "right_up":#         x, y = find_max_x_min_y(curve_points)  # 找到最右上的点#         print("x,y", x, y)#         nx, ny = find_nearest_edge_point(edges, x, y)  # 找附近的点#         print("near x,y", nx, ny)#         if 0 <= nx < w and 0 <= ny < h and not visited[ny, nx] and edges[ny, nx] > 0:#             stack.append((nx, ny))#             print("append:", x, y)# 检查弹出的像素点坐标是否在图像范围内,以及是否已经被访问过。# 如果任一条件满足,说明该像素点无效或已被访问,则执行continue语句,跳过当前循环的剩余部分,继续执行下一次循环。if x < 0 or x >= w or y < 0 or y >= h or visited[y, x]:# print("x:",x,"w:",w,"y:",y,"h:",h)continue# 将当前像素点标记为已访问visited[y, x] = True# 将当前像素点的坐标添加到curve_points列表中,用于存储曲线上的所有点if (        not is_point_near_vertical_line(x, y, vertical_lines, 4)and not is_point_near_horizontal_line(x, y,horizontal_lines,4)and not is_point_in_KRPM(x,y,KRPM_points)):curve_points.append((x, y))# if switch_direction == 'right_down':#     # (x+)(y+)#     neighbors = [(x + 1, y + 1),(x + 1, y),(x, y + 1),#                  (x + 2, y + 2),(x + 2, y),(x, y + 2),#                  (x + 3, y + 3),(x + 3, y),(x, y + 3),#                  (x + 4, y + 4),(x + 4, y),(x, y + 4)#                  ]## elif switch_direction == 'right_up':#     # (x+)(y-)#     neighbors = [(x + 1, y - 1),(x + 1, y),(x, y - 1),#                  (x + 2, y - 2),(x + 2, y),(x, y - 2),#                  (x + 3, y - 3),(x + 3, y),(x, y - 3),#                  (x + 4, y - 4),(x + 4, y),(x, y - 4)##                  ]if switch_direction == 'right_down':# (x+)(y+)neighbors = [(x + 1, y + 1), (x + 1, y), (x, y + 1),(x + 2, y + 1), (x + 2, y), (x, y + 2),(x + 3, y + 1), (x + 3, y), (x, y + 3)# (x + 4, y + 1), (x + 4, y), (x, y + 4)]elif switch_direction == 'right_up':# (x+)(y-)neighbors = [(x + 1, y - 1), (x + 1, y), (x, y - 1),(x + 2, y - 2), (x + 2, y), (x, y - 2),(x + 3, y - 3), (x + 3, y), (x, y - 3),(x + 4, y - 4), (x + 4, y), (x, y - 4)]else:raise ValueError("Invalid direction. Use 'right_down' or 'right_up'.")# 定义一个列表,包含当前像素点的16相邻像素点的坐标# 遍历相邻像素点的坐标# for nx, ny in neighbors:#     # 检查相邻像素点是否在图像范围内、未被访问过、且是边缘像素点(像素值大于0)。#     # 如果所有条件都满足,说明该相邻像素点是有效的,可以加入stack#     if 0 <= nx < w and 0 <= ny < h and not visited[ny, nx] and edges[ny, nx] > 0:#         stack.append((nx, ny))point_count = 0for nx, ny in neighbors:if 0 <= nx < w and 0 <= ny < h and not visited[ny, nx] and edges[ny, nx] > 0 and not is_point_in_KRPM(x,y,KRPM_points):stack.append((nx, ny))point_count += 1if point_count == 0:if direction == "right_up" and switch_direction == "right_up":switch_direction = "right_down"print("from up switch to down")# 针对曲线先从下到右上然后又转右下的情况return curve_pointsdef find_max_x_min_y(curve_points):if not curve_points:return Nonemax_x = 0min_y = 10000for x, y in curve_points:if x > max_x:max_x = xif y < min_y:min_y = y#print(max_x,min_y)return max_x,min_ydef is_point_near_horizontal_line(x, y, horizontal_lines, thickness=2):"""判断坐标 (x, y) 是否在水平线的范围内,考虑一定的厚度参数:x, y: 坐标horizontal_lines: 水平线的列表,每个元素为 (x1, y1, x2, y2)thickness: 厚度,默认为 2返回值:如果坐标 (x, y) 在水平线的范围内,则返回 True;否则返回 False"""for line in horizontal_lines:x1, y1, x2, y2 = line# 检查点的 y 坐标是否在水平线的 y 坐标范围内,考虑厚度if y1 - thickness <= y <= y1 + thickness:# 检查点的 x 坐标是否在水平线的 x 坐标范围内if min(x1, x2) <= x <= max(x1, x2):return Truereturn Falsedef is_point_near_vertical_line(x, y, vertical_lines, thickness=2):"""判断坐标 (x, y) 是否在垂直线的范围内,考虑一定的厚度参数:x, y: 坐标vertical_lines: 垂直线的列表,每个元素为 (x1, y1, x2, y2)thickness: 厚度,默认为 2返回值:如果坐标 (x, y) 在垂直线的范围内,则返回 True;否则返回 False"""for line in vertical_lines:x1, y1, x2, y2 = line# 检查点的 x 坐标是否在垂直线的 x 坐标范围内,考虑厚度if x1 - thickness <= x <= x1 + thickness:# 检查点的 y 坐标是否在垂直线的 y 坐标范围内if min(y1, y2) <= y <= max(y1, y2):return Truereturn Falsedef remove_KRPM_points_from_edges(edges, KRPM_points):edges_copy = edges.copy()for x, y in KRPM_points:edges_copy[y, x] = 0return edges_copydef is_point_in_KRPM(x, y, KRPM_points):return (x, y) in KRPM_points# call track function
# x_start, y_start = 69, 78  # KRPM 右下曲线
# x_start, y_start = 68,334   # Wout 抛物线 右上右下# 跟踪曲线
# 传入边缘图像、起始点和搜索方向,获得曲线点集合# KRPM 曲线控制
x_start, y_start = 69, 78  # KRPM 右下曲线
KRPM_points =track_curve_kRPM(edges,x_start,y_start)# 从 edges 中分离出 KRPM_points
edges_without_KRPM = remove_KRPM_points_from_edges(edges, KRPM_points)# EFF曲线控制
# x_start, y_start = 54,262  # Eff 抛物线 右上右下
# curve_points =track_curve_eff(edges,x_start,y_start,KRPM_points)# Wout
x_start, y_start = 68,334   # Wout 抛物线 右上右下
curve_points =track_curve_eff(edges,x_start,y_start,KRPM_points)# 检查是否找到了曲线点
if not curve_points:raise ValueError("没有找到曲线点,请检查起始点和方向")# 可视化提取的曲线数据点plt.figure(figsize=(12, 6))
# 激活第二个子图
plt.subplot(1, 2, 1)
plt.title("Edge Detection & Start Point")
# plt.imshow(edges, cmap='gray')
# plt.scatter(x_start, y_start, c='red')  # 可视化初始点
# plt.axis('on')curve_x, curve_y = zip(*KRPM_points)
plt.title("kRPM Track ")
plt.imshow(image, cmap='gray')
plt.scatter(curve_x, curve_y, s=1, c='red')
plt.axis('on')plt.subplot(1, 2, 2)
plt.title("Curve Tracking ")
curve_x, curve_y = zip(*curve_points)
plt.imshow(image, cmap='gray')
plt.scatter(curve_x, curve_y, s=1, c='red')
plt.axis('on')
plt.show()

2、直线数据还原

import cv2
import numpy as np
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression# 读取图像并转换为灰度图像
image = cv2.imread('1.png')
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)# 使用Canny边缘检测
edges = cv2.Canny(gray, 50, 150, apertureSize=3)# 使用霍夫变换检测直线
lines = cv2.HoughLinesP(edges, 1, np.pi / 180, threshold=100, minLineLength=100, maxLineGap=10)# 过滤掉水平和垂直线条并绘制检测到的线条
filtered_lines = []
for line in lines:x1, y1, x2, y2 = line[0]if abs(x1 - x2) > 10 and abs(y1 - y2) > 10:  # 过滤掉接近水平和垂直的线条filtered_lines.append((x1, y1, x2, y2))cv2.line(image, (x1, y1), (x2, y2), (0, 255, 0), 2)# 显示过滤后的直线
plt.imshow(cv2.cvtColor(image, cv2.COLOR_BGR2RGB))
plt.title('Filtered Lines')
plt.show()# 拟合直线方程
for line in filtered_lines:x1, y1, x2, y2 = linex_coords = np.array([x1, x2]).reshape(-1, 1)y_coords = np.array([y1, y2])reg = LinearRegression().fit(x_coords, y_coords)slope = reg.coef_[0]intercept = reg.intercept_print(f'Line: y = {slope:.2f}x + {intercept:.2f}')

 

 

相关文章:

电机实验曲线数据提取

处理Python 代码供参考: 1、曲线数据还原 import cv2 import numpy as np import matplotlib.pyplot as plt# 读取图像 image_path 1.png image cv2.imread(image_path) image_copy image.copy() # 创建图像副本&#xff0c;用于叠加显示# 转换为灰度图像 gray cv2.cvtCo…...

windows蓝牙驱动开发-调试及支持的HCI和事件

调试蓝牙配置文件驱动程序 开发蓝牙配置文件驱动程序时&#xff0c;可以使用驱动程序验证程序来协助其调试。 若要启用验证检查&#xff0c;必须为 Bthusb.sys 启用驱动程序验证程序。 如果不执行此操作&#xff0c;将禁用验证检查。 若要完全利用验证检查&#xff0c;请确保…...

Excel大数据量导入导出

github源码 地址&#xff08;更详细&#xff09; : https://github.com/alibaba/easyexcel 文档&#xff1a;读Excel&#xff08;文档已经迁移&#xff09; B 站视频 : https://www.bilibili.com/video/BV1Ff4y1U7Qc 一、JAVA解析EXCEL工具EasyExcel Java解析、生成Excel比较…...

Linux系统命令无法使用(glib库相关问题)

1.背景描述 Yum强制安装了一些软件&#xff0c;安装软件成功无报错&#xff0c;完成后不久突然发现系统出问题了&#xff0c;所有的命令无法使用了&#xff0c;如ls、mv、cat等基本命令报错。 relocation error&#xff1a; /lib64/libpthread.so.0: symbol_libc_dl_error_tsd …...

Qt修仙之路2-1 仿QQ登入 法宝初成

widget.cpp #include "widget.h" #include<QDebug> //实现槽函数 void Widget::login1() {QString userusername_input->text();QString passpassword_input->text();//如果不勾选无法登入if(!check->isChecked()){qDebug()<<"xxx"&…...

DeepSeek-V3 论文解读:大语言模型领域的创新先锋与性能强者

论文链接&#xff1a;DeepSeek-V3 Technical Report 目录 一、引言二、模型架构&#xff1a;创新驱动性能提升&#xff08;一&#xff09;基本架构&#xff08;Basic Architecture&#xff09;&#xff08;二&#xff09;多令牌预测&#xff08;Multi-Token Prediction&#xf…...

配置#include “nlohmann/json.hpp“,用于处理json文件

#include “nlohmann/json.hpp” // 需要安装 nlohmann/json.hpp 头文件 using json = nlohmann::json; 下载链接:https://github.com/nlohmann/json/tree/develop 1.下载并解压:首先,需要从nlohmann/json的GitHub仓库下载源代码,并解压得到的文件。 地址: nlohmann/json…...

索引失效的14种常见场景

在 MySQL 中&#xff0c;索引有时可能会失效&#xff0c;导致查询性能下降。以下是常见的 14 种场景&#xff0c;在这些场景下&#xff0c;索引可能会失效 1. 使用 OR 连接多个条件 场景: 当查询中包含 OR 时&#xff0c;如果 OR 连接的多个条件中有一个没有使用索引&#xff0…...

解决com.kingbase8.util.KSQLException: This _connection has been closed.

问题描述 一个消息管理系统,系统采用kingbase8数据库,数据库采用单体模式,后台应用也采用springboot单体模式。系统正式上线后,出现几个JDBC响应的异常信息: com.kingbase8.util.KSQLException: An I/O error occurred while sending to the backend.java.net.SocketTime…...

openAI官方prompt技巧(二)

1. 赋予 ChatGPT 角色 为 ChatGPT 指定一个角色&#xff0c;让其从特定的身份或视角回答问题。这有助于生成针对特定受众或场景的定制化回答。 例如&#xff1a; 你是一名数据分析师&#xff0c;负责我们的市场营销团队。请总结上个季度的营销活动表现&#xff0c;并强调与未…...

【非 root 用户下全局使用静态编译的 FFmpeg】

在非 root 用户下全局使用静态编译的 FFmpeg&#xff0c;可以按照以下方法操作&#xff1a; 1. 下载静态编译的 FFmpeg 如果你还没有下载静态编译的 FFmpeg&#xff0c;可以从官方网站获取&#xff1a; wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd6…...

【嵌入式 Linux 音视频+ AI 实战项目】瑞芯微 Rockchip 系列 RK3588-基于深度学习的人脸门禁+ IPC 智能安防监控系统

前言 本文主要介绍我最近开发的一个个人实战项目&#xff0c;“基于深度学习的人脸门禁 IPC 智能安防监控系统”&#xff0c;全程满帧流畅运行。这个项目我目前全网搜了一圈&#xff0c;还没发现有相关类型的开源项目。这个项目只要稍微改进下&#xff0c;就可以变成市面上目前…...

前端布局与交互实现技巧

前端布局与交互实现技巧 1. 保持盒子在中间位置 在网页设计中&#xff0c;经常需要将某个元素居中显示。以下是一种常见的实现方式&#xff1a; HTML 结构 <!doctype html> <html lang"en"> <head><meta charset"UTF-8"><m…...

idea 找不到或者无法加载主类

idea项目&#xff0c;之前一直是正常运行的&#xff0c;放假了之后再回来就遇到启动不了的问题。 WebApplication这个类右键运行的时候&#xff0c;也提示找不到主类。 对于这种之前运行没有问题&#xff0c;突然出问题的项目。 我的点是没有改动代码和数据的情况下项目就跑不起…...

Flink 调用海豚调度器 SQL 脚本实现1份SQL流批一体化的方案和可运行的代码实例

目录 一、流批一体化概述 二、Flink 与海豚调度器结合实现流批一体化的好处 2.1 代码复用性增强 2.2 开发和维护成本降低 2.3 数据一致性保证 2.4 提高系统的灵活性和可扩展性 三、实现思路步骤 3.1 环境准备 3.2 编写 SQL 脚本并上传到海豚调度器 3.3 实现资源下载功…...

ES6 Map 数据结构是用总结

1. Map 基本概念 Map 是 ES6 提供的新的数据结构&#xff0c;它类似于对象&#xff0c;但是"键"的范围不限于字符串&#xff0c;各种类型的值&#xff08;包括对象&#xff09;都可以当作键。Map 也可以跟踪键值对的原始插入顺序。 1.1 基本用法 // 创建一个空Map…...

go结构体详解

结构体简介 Golang 中没有“类”的概念&#xff0c;Golang 中的结构体和其他语言中的类有点相似。和其他面向对象语言中的类相比&#xff0c;Golang 中的结构体具有更高的扩展性和灵活性。 Golang 中的基础数据类型可以表示一些事物的基本属性&#xff0c;但是当我们想表达一…...

机器学习-关于线性回归的表示方式和矩阵的基本运算规则

最近在学习机器学习的过程中&#xff0c;发现关于线性回归的表示和矩阵的运算容易费解&#xff0c;而且随着学习的深入容易搞混&#xff0c;因此特意做了一些研究&#xff0c;并且记录下来和大家分享。 一、线性模型有哪些表示方式&#xff1f; 器学习中&#xff0c;线性模型…...

kafka 3.5.0 raft协议安装

前言 最近做项目&#xff0c;需要使用kafka进行通信&#xff0c;且只能使用kafka&#xff0c;笔者没有测试集群&#xff0c;就自己搭建了kafka集群&#xff0c;实际上笔者在很早之前就搭建了&#xff0c;因为当时还是zookeeper&#xff08;简称ZK&#xff09;注册元数据&#…...

后台管理系统网页开发

CSS样式代码 /* 后台管理系统样式文件 */ #container{ width:100%; height:100%; /* background-color:antiquewhite;*/ display:flex;} /* 左侧导航区域:宽度300px*/ .left{ width:300px; height: 100%; background-color:#203453; display:flex; flex-direction:column; jus…...

conda相比python好处

Conda 作为 Python 的环境和包管理工具&#xff0c;相比原生 Python 生态&#xff08;如 pip 虚拟环境&#xff09;有许多独特优势&#xff0c;尤其在多项目管理、依赖处理和跨平台兼容性等方面表现更优。以下是 Conda 的核心好处&#xff1a; 一、一站式环境管理&#xff1a…...

java 实现excel文件转pdf | 无水印 | 无限制

文章目录 目录 文章目录 前言 1.项目远程仓库配置 2.pom文件引入相关依赖 3.代码破解 二、Excel转PDF 1.代码实现 2.Aspose.License.xml 授权文件 总结 前言 java处理excel转pdf一直没找到什么好用的免费jar包工具,自己手写的难度,恐怕高级程序员花费一年的事件,也…...

UE5 学习系列(三)创建和移动物体

这篇博客是该系列的第三篇&#xff0c;是在之前两篇博客的基础上展开&#xff0c;主要介绍如何在操作界面中创建和拖动物体&#xff0c;这篇博客跟随的视频链接如下&#xff1a; B 站视频&#xff1a;s03-创建和移动物体 如果你不打算开之前的博客并且对UE5 比较熟的话按照以…...

页面渲染流程与性能优化

页面渲染流程与性能优化详解&#xff08;完整版&#xff09; 一、现代浏览器渲染流程&#xff08;详细说明&#xff09; 1. 构建DOM树 浏览器接收到HTML文档后&#xff0c;会逐步解析并构建DOM&#xff08;Document Object Model&#xff09;树。具体过程如下&#xff1a; (…...

Caliper 配置文件解析:config.yaml

Caliper 是一个区块链性能基准测试工具,用于评估不同区块链平台的性能。下面我将详细解释你提供的 fisco-bcos.json 文件结构,并说明它与 config.yaml 文件的关系。 fisco-bcos.json 文件解析 这个文件是针对 FISCO-BCOS 区块链网络的 Caliper 配置文件,主要包含以下几个部…...

优选算法第十二讲:队列 + 宽搜 优先级队列

优选算法第十二讲&#xff1a;队列 宽搜 && 优先级队列 1.N叉树的层序遍历2.二叉树的锯齿型层序遍历3.二叉树最大宽度4.在每个树行中找最大值5.优先级队列 -- 最后一块石头的重量6.数据流中的第K大元素7.前K个高频单词8.数据流的中位数 1.N叉树的层序遍历 2.二叉树的锯…...

如何在网页里填写 PDF 表格?

有时候&#xff0c;你可能希望用户能在你的网站上填写 PDF 表单。然而&#xff0c;这件事并不简单&#xff0c;因为 PDF 并不是一种原生的网页格式。虽然浏览器可以显示 PDF 文件&#xff0c;但原生并不支持编辑或填写它们。更糟的是&#xff0c;如果你想收集表单数据&#xff…...

C++ 设计模式 《小明的奶茶加料风波》

&#x1f468;‍&#x1f393; 模式名称&#xff1a;装饰器模式&#xff08;Decorator Pattern&#xff09; &#x1f466; 小明最近上线了校园奶茶配送功能&#xff0c;业务火爆&#xff0c;大家都在加料&#xff1a; 有的同学要加波霸 &#x1f7e4;&#xff0c;有的要加椰果…...

Python 实现 Web 静态服务器(HTTP 协议)

目录 一、在本地启动 HTTP 服务器1. Windows 下安装 node.js1&#xff09;下载安装包2&#xff09;配置环境变量3&#xff09;安装镜像4&#xff09;node.js 的常用命令 2. 安装 http-server 服务3. 使用 http-server 开启服务1&#xff09;使用 http-server2&#xff09;详解 …...

Golang——7、包与接口详解

包与接口详解 1、Golang包详解1.1、Golang中包的定义和介绍1.2、Golang包管理工具go mod1.3、Golang中自定义包1.4、Golang中使用第三包1.5、init函数 2、接口详解2.1、接口的定义2.2、空接口2.3、类型断言2.4、结构体值接收者和指针接收者实现接口的区别2.5、一个结构体实现多…...