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

lamp做网站的论文注册一个公司多少钱

lamp做网站的论文,注册一个公司多少钱,wordpress横向主题,wordpress区块链模板旋转变换原理 旋转是仿射变换的一种,通过变换矩阵实现图像绕指定中心旋转,保持直线和平行性不变。其数学表示为: 其中: ( c x , c y ) (c_x, c_y) (cx​,cy​) 是旋转中心。 θ \theta θ 是旋转角度(逆时针为正&…

旋转变换原理

旋转是仿射变换的一种,通过变换矩阵实现图像绕指定中心旋转,保持直线和平行性不变。其数学表示为:
在这里插入图片描述
其中:

  • ( c x , c y ) (c_x, c_y) (cx,cy) 是旋转中心。
  • θ \theta θ 是旋转角度(逆时针为正)。

旋转矩阵的平移项用于补偿旋转中心的偏移。推导过程如下:

  1. 将旋转中心移到原点
    在这里插入图片描述

  2. 旋转
    [
\begin{bmatrix}
\cos\theta & -\sin\theta & 0 \
\sin\theta & \cos\theta & 0 \
0 & 0 & 1
\end{bmatrix}
]

  3. 移回原位置
    [
\begin{bmatrix}
1 & 0 & c_x \
0 & 1 & c_y \
0 & 0 & 1
\end{bmatrix}
]

  4. 合并后的矩阵(取前两行):
    [
M =
\begin{bmatrix}
\cos\theta & -\sin\theta & (1-\cos\theta)c_x + \sin\theta c_y \
\sin\theta & \cos\theta & -\sin\theta c_x + (1-\cos\theta)c_y
\end{bmatrix}
]

import numpy as np
import cv2
import matplotlib.pyplot as pltdef get_rotation_matrix(angle, center=None, scale=1.0):"""生成正确的2x3旋转仿射矩阵参数:angle: 旋转角度(度数,逆时针为正)center: (cx, cy)旋转中心坐标scale: 缩放比例返回:2x3仿射变换矩阵"""angle_rad = np.deg2rad(angle)cos = np.cos(angle_rad) * scalesin = np.sin(angle_rad) * scaleif center is None:raise ValueError("必须指定旋转中心")cx, cy = center# 计算平移分量tx = cx * (1 - cos) + cy * sinty = cy * (1 - cos) - cx * sinreturn np.array([[cos, -sin, tx],[sin,  cos, ty]])def warp_affine(image, M, dsize):"""手动实现仿射变换(支持多通道图像)参数:image: 输入图像(H,W,C)M: 2x3仿射变换矩阵dsize: 输出图像大小(width, height)返回:变换后的图像"""h, w = dsize[1], dsize[0]output = np.zeros((h, w, image.shape[2]), dtype=image.dtype)# 构造逆变换矩阵M_inv = np.vstack([M, [0, 0, 1]])M_inv = np.linalg.inv(M_inv)[:2]# 生成目标图像网格坐标y, x = np.indices((h, w))coords = np.stack([x, y, np.ones_like(x)], axis=-1)  # (H,W,3)# 计算原图坐标src_coords = np.dot(coords, M_inv.T)  # (H,W,2)# 双线性插值x_src = src_coords[:, :, 0]y_src = src_coords[:, :, 1]# 计算四个邻近点坐标x0 = np.floor(x_src).astype(int)y0 = np.floor(y_src).astype(int)x1 = x0 + 1y1 = y0 + 1# 处理边界x0 = np.clip(x0, 0, image.shape[1]-1)y0 = np.clip(y0, 0, image.shape[0]-1)x1 = np.clip(x1, 0, image.shape[1]-1)y1 = np.clip(y1, 0, image.shape[0]-1)# 计算权重wa = (x1 - x_src) * (y1 - y_src)wb = (x_src - x0) * (y1 - y_src)wc = (x1 - x_src) * (y_src - y0)wd = (x_src - x0) * (y_src - y0)# 对每个通道进行插值for c in range(image.shape[2]):output[:, :, c] = (wa * image[y0, x0, c] + wb * image[y0, x1, c] + wc * image[y1, x0, c] + wd * image[y1, x1, c])return output.astype(np.uint8)# 测试代码
if __name__ == "__main__":# 读取图像img = cv2.imread('example.jpg')img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)# 设置旋转参数angle = 45  # 旋转45度h, w = img.shape[:2]center = (w//2, h//2)  # 图像中心# 生成旋转矩阵M = get_rotation_matrix(angle, center)# 手动实现变换rotated_manual = warp_affine(img, M, (w, h))# 使用OpenCV实现对比rotated_cv = cv2.warpAffine(img, M, (w, h))# 显示结果plt.figure(figsize=(12, 6))plt.subplot(131), plt.imshow(img), plt.title('Original')plt.subplot(132), plt.imshow(rotated_manual), plt.title('Manual Rotation')plt.subplot(133), plt.imshow(rotated_cv), plt.title('OpenCV Rotation')plt.show()

文章转载自:

http://F2hR9sjX.whnps.cn
http://1tgtWn7d.whnps.cn
http://WuEN9AcZ.whnps.cn
http://QdoVKOGc.whnps.cn
http://lXhhIgP1.whnps.cn
http://L6CX8PRI.whnps.cn
http://ptzA40ru.whnps.cn
http://7jP9MJIV.whnps.cn
http://oYfDqFsU.whnps.cn
http://659NwdUf.whnps.cn
http://uzY2alq1.whnps.cn
http://iKjRUzcK.whnps.cn
http://uObU07RV.whnps.cn
http://TC7wmPk4.whnps.cn
http://hsKvf0Bk.whnps.cn
http://ex3IPkaf.whnps.cn
http://bqU9PtIc.whnps.cn
http://vJ5Vkha7.whnps.cn
http://CTvwRcZv.whnps.cn
http://FM0A50K3.whnps.cn
http://52W3mneT.whnps.cn
http://W23piaGL.whnps.cn
http://zf7ypZnc.whnps.cn
http://GbNtQ5Df.whnps.cn
http://9LT4kck6.whnps.cn
http://XxyTmbO4.whnps.cn
http://8Yv7rjIn.whnps.cn
http://HlXUvPRi.whnps.cn
http://GyCujEbx.whnps.cn
http://FlXEfAWt.whnps.cn
http://www.dtcms.com/wzjs/694239.html

相关文章:

  • 成都用设计公司网站微信公众号编辑教程
  • 企业网站价格做网站比较好的公司有哪些
  • 剑三做月饼活动网站门户网站都有哪些
  • 哪家做网站好 成都在邯郸开互联网公司
  • 科技管理信息网站的建设方案wordpress插件中文
  • 自己做网站可以挣钱吗中国建设银行官网首页网站
  • 常州品牌网站建设网站设计与建设代码
  • 移动端和pc网站历史文化类网站源码
  • 给 小企业 建设网站万维网网站续费
  • 个人可以做自媒体网站吗网站建设制作一个网站的费用
  • 普通企业网站费用杭州seo托管公司推荐
  • 专业做外贸网站的公司东莞网络科技有限公司
  • 公司网站程序顺的品牌网站设计价位
  • 嘉兴h5建站网站建设步骤和流程
  • 厦门建设执业资格注册管理中心网站设计网站公司力荐亿企邦
  • 网站开发 图标程序员外包网
  • 怎么网上接网站开发单自己做网站设计欣赏
  • ecetc商务网站建设工程师常州网站开发公司推荐
  • 做企业网站收费价格中国建设工程网站
  • 网站构成要素爱站网站长工具
  • 请人做外贸网站应注意什么wordpress带汉字图片不显示
  • 撤销网站备案中山市建设局网站窗口电话号码
  • 舟山建设网站公司免费网站建设哪家好
  • 西部数码做跳转网站全国医院网站建设
  • 老网站删除做新站会影响收录吗网络推广公司哪里好
  • 免费自适应网站模板河北唐山 网站建设
  • 营销网站建设一薇上海做网站的小公司
  • 哪个网站可以做行程wordpress 打不开页面
  • 台州企业网站模板建站网站搭建dns有用吗
  • 企业网站的制作周期seo诊断报告示例