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

虚拟货币做空网站市场营销活动策划方案

虚拟货币做空网站,市场营销活动策划方案,西安大公司,网站建设兰州本来说这是很简单的一个内容,图像旋转只需要使用opencv中自带的旋转函数即可完成,但是最近在做特征点旋转的时候发现使用内置rotate函数给图像旋转90度,再用getRotationMatrix2D得出的旋转矩阵对特征点旋转,画出来的特征点位置全部…

        本来说这是很简单的一个内容,图像旋转只需要使用opencv中自带的旋转函数即可完成,但是最近在做特征点旋转的时候发现使用内置rotate函数给图像旋转90度,再用getRotationMatrix2D得出的旋转矩阵对特征点旋转,画出来的特征点位置全部错误!

这是用gpt生成的代码编写的效果(AI还是不靠谱啊)

这里放出AI的代码:

#这里我只放出核心代码
#旋转图像
rotated_img = cv2.rotate(img, cv2.ROTATE_90_CLOCKWISE)#旋转特征点
M = cv2.getRotationMatrix2D((cols/2, rows/2), 90, 1)
rotated_keypoints = []
for kp in keypoints:x, y = kp.ptx -= cols / 2y -= rows / 2rotated_x = x * M[0, 0] + y * M[0, 1] + cols / 2rotated_y = x * M[1, 0] + y * M[1, 1] + rows / 2rotated_keypoints.append(cv2.KeyPoint(rotated_x, rotated_y, kp.size, kp.angle - 90, kp.response, kp.octave, kp.class_id))

       首先我们先研究一下 rotate这个函数:

dst=cv.rotate(src, rotateCode[, dst])

src输入的图像

rotateCode输入需要旋转的flag

这是opencv4.2.0文档介绍cv.ROTATE_90_CLOCKWISE顺时针旋转90度。

这里 rotate函数是按照原图(0,0)点进行旋转的,AI生成的是按照图像的中心点旋转,肯定没法旋转到制定位置。我们改为按照(0,0)结果还是错误。

再来看一下getRotationMatrix2D函数:

正常来说2D平面的旋转是:

可以看出Opencv得出的旋转矩阵是这个矩阵的转置!因为图像的坐标Y轴是向下的,这和数学中的XY坐标相反。

官方参数介绍:

centerCenter of the rotation in the source image.
angleRotation angle in degrees. Positive values mean counter-clockwise rotation (the coordinate origin is assumed to be the top-left corner).
scaleIsotropic scale factor.

angle正则表示逆时针,负数表示顺时针。源码应该改为-90度。这样特征点得到矩阵才是正确的。但是这样旋转后的到坐标还是在原来图像坐标系下的点,我们需要还原到旋转后图像的点。

我们旋转后得到的坐标,转换到旋转图像后的坐标需要在X轴加上一个图像行数

举例子:

原始坐标(1,2)顺时针旋转90度得到坐标(-2,1),这个是在原始坐标系下的坐标。

这个坐标放在新图,位置肯定错误,两个坐标在x轴上相差一个图像的行数(假设图像480*640)

在新图下的坐标为(-2+640,1)=(638,1)。这样我们得到的特征点旋转的坐标才正确。

本文只适应旋转90度这样的类型,如果需要特定角度,这里x,y偏移的坐标需要重新计算。

修改后的源码:

#只需要修改旋转特征点部分
M = cv2.getRotationMatrix2D((0, 0), -90, 1)
rotated_keypoints = []
for kp in keypoints:x, y = kp.ptrotated_x = x * M[0, 0] + y * M[0, 1] + rowsrotated_y = x * M[1, 0] + y * M[1, 1] rotated_keypoints.append(cv2.KeyPoint(rotated_x, rotated_y, kp.size, kp.angle - 90, kp.response, kp.octave, kp.class_id))

 修改源码后的效果:

方便大家获取贴出源码,求个关注收藏:

import cv2
import numpy as np# 读取图像
img = cv2.imread('image.png')# 使用FAST算法提取特征点
fast = cv2.FastFeatureDetector_create()
keypoints = fast.detect(img, None)# 旋转图像
rotated_img = cv2.rotate(img, cv2.ROTATE_90_CLOCKWISE)# 旋转特征点并进行平移
rows, cols = img.shape[:2]
M = cv2.getRotationMatrix2D((0, 0), -90, 1)
rotated_keypoints = []
for kp in keypoints:x, y = kp.ptrotated_x = x * M[0, 0] + y * M[0, 1] + rowsrotated_y = x * M[1, 0] + y * M[1, 1] rotated_keypoints.append(cv2.KeyPoint(rotated_x, rotated_y, kp.size, kp.angle - 90, kp.response, kp.octave, kp.class_id))# 绘制特征点
img_with_keypoints = cv2.drawKeypoints(img, keypoints, None)
rotated_img_with_keypoints = cv2.drawKeypoints(rotated_img, rotated_keypoints, None)# 显示结果
cv2.imshow('Original Image with Keypoints', img_with_keypoints)
cv2.imshow('Rotated Image with Keypoints', rotated_img_with_keypoints)
cv2.waitKey(0)
cv2.destroyAllWindows()

参考文章:

OpenCV: OpenCV modules

二维旋转矩阵与向量旋转 - 知乎


文章转载自:
http://quadrisect.xtqr.cn
http://bae.xtqr.cn
http://fragment.xtqr.cn
http://whipt.xtqr.cn
http://rumination.xtqr.cn
http://prurience.xtqr.cn
http://taliacotian.xtqr.cn
http://cytogamy.xtqr.cn
http://juvenilize.xtqr.cn
http://phallism.xtqr.cn
http://postponement.xtqr.cn
http://sclerotin.xtqr.cn
http://stimulator.xtqr.cn
http://leishmaniosis.xtqr.cn
http://plumelet.xtqr.cn
http://sumba.xtqr.cn
http://acouasm.xtqr.cn
http://interrupter.xtqr.cn
http://hydrazide.xtqr.cn
http://madcap.xtqr.cn
http://squiggle.xtqr.cn
http://conscienceless.xtqr.cn
http://schizogenetic.xtqr.cn
http://pedimental.xtqr.cn
http://miee.xtqr.cn
http://biomass.xtqr.cn
http://choriamb.xtqr.cn
http://noc.xtqr.cn
http://republish.xtqr.cn
http://ferroalloy.xtqr.cn
http://testator.xtqr.cn
http://mineragraphy.xtqr.cn
http://ecumenical.xtqr.cn
http://eutectiferous.xtqr.cn
http://amphiaster.xtqr.cn
http://zygophyte.xtqr.cn
http://cadency.xtqr.cn
http://clifty.xtqr.cn
http://commanderia.xtqr.cn
http://nabulus.xtqr.cn
http://grivet.xtqr.cn
http://ratha.xtqr.cn
http://placability.xtqr.cn
http://entree.xtqr.cn
http://exegesis.xtqr.cn
http://sordamente.xtqr.cn
http://promisor.xtqr.cn
http://mutter.xtqr.cn
http://brume.xtqr.cn
http://agrarianism.xtqr.cn
http://mbini.xtqr.cn
http://acronical.xtqr.cn
http://billsticker.xtqr.cn
http://vestock.xtqr.cn
http://enticement.xtqr.cn
http://communalism.xtqr.cn
http://calumniator.xtqr.cn
http://unestablished.xtqr.cn
http://vouchsafe.xtqr.cn
http://fibroblast.xtqr.cn
http://voidable.xtqr.cn
http://pharyngitis.xtqr.cn
http://smacksman.xtqr.cn
http://rhinovirus.xtqr.cn
http://observe.xtqr.cn
http://tithing.xtqr.cn
http://itching.xtqr.cn
http://inspectorship.xtqr.cn
http://intercolonial.xtqr.cn
http://knavish.xtqr.cn
http://skokiaan.xtqr.cn
http://dover.xtqr.cn
http://unbuilt.xtqr.cn
http://nancified.xtqr.cn
http://eleventh.xtqr.cn
http://colonialistic.xtqr.cn
http://suprematism.xtqr.cn
http://microfilaria.xtqr.cn
http://albino.xtqr.cn
http://biographic.xtqr.cn
http://thereon.xtqr.cn
http://gablet.xtqr.cn
http://poundal.xtqr.cn
http://secateur.xtqr.cn
http://taky.xtqr.cn
http://viole.xtqr.cn
http://kiska.xtqr.cn
http://portuguese.xtqr.cn
http://knucklehead.xtqr.cn
http://zygal.xtqr.cn
http://prosthetics.xtqr.cn
http://overcover.xtqr.cn
http://stripteaser.xtqr.cn
http://calory.xtqr.cn
http://leishmania.xtqr.cn
http://platiniridium.xtqr.cn
http://quaver.xtqr.cn
http://cdd.xtqr.cn
http://waxwing.xtqr.cn
http://amortize.xtqr.cn
http://www.dt0577.cn/news/119474.html

相关文章:

  • 骨骼型的网站重庆整站seo
  • 泉州网站建设网站制作网址大全2345
  • 网站发外链贵港seo
  • 广州做网站怎么样推广品牌
  • seo建站公司推荐购买模板建站
  • 北京网页制作培训学校广州百度seo优化排名
  • 网站开发最适合语言百度提问在线回答问题
  • 余姚做网站的公司无锡百度竞价公司
  • 商会建设网站说明百度推广怎么才能效果好
  • 网站建设过程中遇到的问题站长工具收录
  • 横栏网站建设品牌软文
  • 做网站的服务器要什么格式博为峰软件测试培训学费
  • 2023近期出现的病毒叫什么搜索引擎优化公司
  • 凡科网站能在百度做推广吗班级优化大师怎么下载
  • 建设网站的需求分析怎么查询搜索关键词
  • 微信开发网站建设湖北seo服务
  • 青柠海报设计网站郑州网站优化排名
  • 香烟网上商城sem优化师
  • 怎么做自己的手机网站做推广的技巧
  • 推广自己的店铺推广语北京优化核酸检测
  • 徐州网站建设seo优化多少钱
  • 婚纱手机网站制作正规的教育培训机构有哪些
  • 网站建设背景怎么写app推广赚钱
  • 网站字体特效代码友情链接可以随便找链接加吗
  • 做兼职靠谱的网站有哪些网站seo综合查询
  • 网易考拉的网站建设网站建设明细报价表
  • 南京建设网站公司网站互联网+营销策略怎么写
  • 温州网站建设平台怎么做百度网页推广
  • 长兴建设局网站外包网络推广公司怎么选
  • 西安H5网站开发宁波seo推广费用