OpenCV

pyinstaller打包python+opencv 无法在别人电脑上正常运行 问题所在:opencv_ffmpeg341_64.dll

爷,独闯天下 提交于 2021-02-13 07:56:56
用python+opencv写了个程序,在自己电脑上一切正常,但在别人电脑上就是运行不了 报错: Exception in Tkinter callback Traceback (most recent call last): File "tkinter\__init__.py", line 1699, in __call__ File "ShowTheWay.py", line 53, in main NameError: name 'img' is not defined Traceback (most recent call last): File "ShowTheWay.py", line 25, in on_mouse NameError: name 'img' is not defined 然后我又回去查代码,也没有写错啊,后来加了几个检查点,才发现是视频读取这里就已经出了问题 def re_size(): global img img = None re_set() if shipin.isOpened(): ret, frame = shipin.read() h, w, _ = frame.shape img = cv2.resize(frame, (int(w / s), int(h / s)), interpolation= cv2.INTER_AREA)

Anaconda+Vscode+opencv3环境打造

一曲冷凌霜 提交于 2021-02-12 13:13:30
1、Anaconda安装 Anaconda的新版本中集成了Vscode,下载后,安装Anaconda。完成后可以直接在Anaconda Nagvigator界面中安装Vscode。安装好之后,就可以使用vscode来进行python的学习。 2、Vscode建立python工程 建立工程文件夹,使用vscode打开,编译源码文件.py。在调试前,需要点击setting 配置当前文件夹为python目录,会生成json配置文件。然后按F5就可以调试。 3、opencv安装 在Anaconda Navigator的界面中,选中环境,搜索opencv3就可以直接安装 来源: oschina 链接: https://my.oschina.net/u/4321825/blog/3935332

计算机视觉基于图像的三维重建入门介绍

扶醉桌前 提交于 2021-02-12 11:53:44
计算机视觉 从技术角度目前分为两大类:一类是基于传统几何的计算机视觉,另一类是基于深度学习的计算机视觉。在介绍三维重建之前先来讲一下基于传统几何的计算机视觉相关的学习路线。 入门书籍 有《视觉SLAM十四讲从理论到实践》《 计算机视觉-算法与应用》 《 计算机视觉中的多视几何》 入门视频 教程有 浙江大学谭平教授的计算机视觉课程 https://www.bilibili.com/video/BV124411W775 高翔博士的视觉SLAM十四讲从理论到实践 https://www.bilibili.com/video/BV1Z5411t7oB 入门计算机视觉看这几本书,以及这两个课程就足够了,高博的课程比较难懂,可以先看谭老师的课程,再看高博的课程。高博的课程至少要看两遍,才能懂。要达到 深刻理解 的程度,需要结合后期的项目实践,再看第3遍或者以上。 在学习的过程中,需要自己运行一下《视觉SLAM十四讲》中的 代码程序 ,第一遍只需要知道重要步骤的意思即可,没有必要细扣每一行代码的意思,第二遍需要知道每一行代码的意思,并且要尝试回答《视觉SLAM十四讲》课后习题,有些不会的上网查一下就行,了解了解就行,后面有了实际的项目实践,再来做这些题,回理解比较深刻。 进阶以视觉项目为导向,动手 代码实践 ,理解程序的意思,在这个过程中,需要带着问题学习,多问为什么,上网查阅他人对代码的解读

基于计算机视觉的棋盘图像识别

人盡茶涼 提交于 2021-02-12 11:53:23
点击上方 “ 小白学视觉 ”,选择加" 星标 "或“ 置顶 ” 重磅干货,第一时间送达 本期我们将一起学习如何使用计算机视觉技术识别棋子及其在棋盘上的位置 我们利用计算机视觉技术和卷积神经网络(CNN)为这个项目创建分类算法,并确定棋子在棋盘上的位置。最终的应用程序会保存整个图像并可视化的表现出来,同时输出棋盘的2D图像以查看结果。 (左)实时摄像机进给的帧和棋盘的(右)二维图像 01. 数据 我们对该项目的数据集有很高的要求,因为它最终会影响我们的实验结果。我们在网上能找到的国际象棋数据集是使用不同的国际象棋集、不同的摄影机拍摄得到的,这导致我们创建了自己的数据集。我使用国际象棋和摄像机(GoPro Hero6 Black以“第一人称视角”角度)生成了自定义数据集,这使我的模型更加精确。该数据集包含2406张图像,分为13类(请参阅下文)。 总结:这花费了我们很多时间,但是这使得训练图像尽可能地接近在应用程序中使用时所看到的图像。 自定义数据集的细分 为了构建该数据集,我首先创建了 capture_data.py ,当单击 S 键时,该视频从视频流中获取一帧并将其保存。这个程序使我能够无缝地更改棋盘上的棋子并一遍又一遍地捕获棋盘的图像,直到我建立了大量不同的棋盘配置为止。接下来,我创建了 create_data.py ,以使用下一部分中讨论的检测技术将其裁剪为单独小块。最后

Set target java version when build OpenCV with brew

删除回忆录丶 提交于 2021-02-11 17:27:27
问题 I'm using brew to build OpenCV with java support following this tutorial. After built successful I got the error class file has wrong version 57.0, should be 52.0 when using. I'm using OpenJDK 8, how can I target the build to this version. Thank you. 回答1: Found the answer, put the extra -DOPENCV_JAVA_TARGET_VERSION=1.8 args to cmake in brew formula. 来源: https://stackoverflow.com/questions/62115757/set-target-java-version-when-build-opencv-with-brew

Convert a kivy texture to opencv image

浪尽此生 提交于 2021-02-11 17:18:06
问题 I am trying to convert my kivy texture to an image format so that i can process it using opencv (cv2). I tried reading the texture using read() and using cv2.imread() but neither worked. I also looked into converting the ubyte texture into a string but got nowhere. kivy camera texture -> format that i can process using cv2 something like MyVariable = someid.texture #do something to format of MyVariable so that it is an 'image' Newvar = MyVariable.read() #cv2 processing... EDIT: Ok so i got

Convert a kivy texture to opencv image

不羁的心 提交于 2021-02-11 17:17:59
问题 I am trying to convert my kivy texture to an image format so that i can process it using opencv (cv2). I tried reading the texture using read() and using cv2.imread() but neither worked. I also looked into converting the ubyte texture into a string but got nowhere. kivy camera texture -> format that i can process using cv2 something like MyVariable = someid.texture #do something to format of MyVariable so that it is an 'image' Newvar = MyVariable.read() #cv2 processing... EDIT: Ok so i got

Reducing misses on template matching (using transparent template)

时光怂恿深爱的人放手 提交于 2021-02-11 17:14:10
问题 I'm trying to determine the position of puzzle piece on a puzzle image. I have an image of a puzzle piece (transparent png) an image of a puzzleboard whith a white outline around the correct position Firstly i extract the contour on image 1. and use it to draw my final template. Then i match the final template to the puzzleboard and save some result images. Here are some examples of the results i'm getting https://imgur.com/a/ZYyw7tU On some of the images, there's clearly a lot of mismatches

Reducing misses on template matching (using transparent template)

扶醉桌前 提交于 2021-02-11 17:14:00
问题 I'm trying to determine the position of puzzle piece on a puzzle image. I have an image of a puzzle piece (transparent png) an image of a puzzleboard whith a white outline around the correct position Firstly i extract the contour on image 1. and use it to draw my final template. Then i match the final template to the puzzleboard and save some result images. Here are some examples of the results i'm getting https://imgur.com/a/ZYyw7tU On some of the images, there's clearly a lot of mismatches

opencv didn't output images correctly

匆匆过客 提交于 2021-02-11 17:11:29
问题 I have debugging my code and here is what I found: img = cv2.resize(img, (224, 224)) cv2.imshow("img",img) cv2.waitKey(0) cv2.destroyAllWindows() img = (img / 127.5) - 1 cv2.imshow("img",(127.5*(img+1)).astype(int)) cv2.waitKey(0) cv2.destroyAllWindows() these operations don't output the same picture even tough they are same, does somebody konow why? 回答1: Try checking the dtype each time you display: print(img.dtype) 来源: https://stackoverflow.com/questions/63371878/opencv-didnt-output-images