imread

python opencv3 基于ORB的特征检测和 BF暴力匹配 knn匹配 flann匹配

天涯浪子 提交于 2019-12-27 01:23:44
git:https://github.com/linyi0604/Computer-Vision bf暴力匹配: 1 # coding:utf-8 2 3 import cv2 4 5 """ 6 orb特征检测和匹配 7 两幅图片分别是 乐队的logo 和包含该logo的专辑封面 8 利用orb进行检测后进行匹配两幅图片中的logo 9 10 """ 11 # 按照灰度图像的方式读入两幅图片 12 img1 = cv2.imread("../data/logo1.png", cv2.IMREAD_GRAYSCALE) 13 img2 = cv2.imread("../data/album1.png", cv2.IMREAD_GRAYSCALE) 14 15 # 创建ORB特征检测器和描述符 16 orb = cv2.ORB_create() 17 # 对两幅图像检测特征和描述符 18 keypoint1, descriptor1 = orb.detectAndCompute(img1, None) 19 keypoint2, descriptor2 = orb.detectAndCompute(img2, None) 20 """ 21 keypoint 是一个包含若干点的列表 22 descriptor 对应每个点的描述符 是一个列表, 每一项都是检测到的特征的局部图像 23

opencv基础入门——模糊操作

非 Y 不嫁゛ 提交于 2019-12-26 15:38:23
参考: python+opencv3.3视频教学 基础入门-bilibili OpenCV图像处理—模糊原理_不安分的少年-CSDN博客 高斯模糊_百度百科 一、模糊原理 使用模糊操作的原因之一就是为了给图像预处理时候 降低噪声 , 把噪声与周围的数值平均一下就可以平滑噪声。 模糊基于数学的 卷积计算 。 卷积:通过两个函数f 和g 生成第三个函数的一种数学算子,表征函数 f f f 与 g g g 经过翻转和平移的重叠部分的面积。 g ( i , j ) = ∑ l , k f ( l + k , j + l ) h ( k , l ) g(i,j)=\sum _{l,k}f(l+k,j+l)h(k,l) g ( i , j ) = l , k ∑ ​ f ( l + k , j + l ) h ( k , l ) 其中: f ( ) f() f ( ) 表示一副图像 i , j i,j i , j 表示图像的行和列 h ( k , l ) h(k,l) h ( k , l ) 表示 卷积算子 (卷积核)(也可以叫掩膜) k , l k,l k , l 又可以叫窗口大小(掩膜的大小,比如3*3) g ( ) g() g ( ) 表示输出的像素值 不同的卷积核得到不同的卷积效果 。 通常这些卷积算子计算都是线性操作,所以又叫 线性滤波 。 二、基本模糊操作 1.均值模糊

having cv2.imread reading images from file objects or memory-stream-like data (here non-extracted tar)

风格不统一 提交于 2019-12-23 12:20:13
问题 I have a .tar file containing several hundreds of pictures ( .png ). I need to process them via opencv. I am wondering whether - for efficiency reasons - it is possible to process them without passing by the disc. In other, words I want to read the pictures from the memory stream related to the tar file. Consider for instance import tarfile import cv2 tar0 = tarfile.open('mytar.tar') im = cv2.imread( tar0.extractfile('fname.png').read() ) The last line doesn't work as imread expects a file

cv2.imread用法

不羁岁月 提交于 2019-12-16 20:11:34
#如果dir对应的是灰度图 m1 = cv2.imread(dir,cv2.IMREAD_GRAYSCALE) m2 = cv2.imread(dir) #如果不设置灰度图读入的话,m2则默认RGB读入,复制三个完全相同的通道得到最终的图片 #m1可以得到正常的灰度图 #如果dir对应的是彩色图,直接imread即可 生成BGR通道的彩色图像 print('yes') 来源: CSDN 作者: 文鸿wow 链接: https://blog.csdn.net/qq_34430032/article/details/103567986

pip install imread fails at Microsoft Visual step

[亡魂溺海] 提交于 2019-12-13 00:15:17
问题 I am trying to install imread to do some image analysis. I am running 2.7.9. When I type pip install imread into powershell, the program runs until it hits some pieces from Microsoft Visual C++. I have attached an image showing where the snag is. Please help. http://imgur.com/ZcMMk28 回答1: My advice is: save yourself a lot of trouble and just install a windows binary. Take a look at the Unofficial Windows Binaries for Python Extension Packages website. Looks like imread is available there. You

Undefined reference to cv::imread

时光毁灭记忆、已成空白 提交于 2019-12-11 20:33:36
问题 I know this has been asked several times but still I am struggling with linker error undefined reference for simple opencv code. This is my code: #include <opencv2/highgui.hpp> using namespace cv; int main(int argc, char** argv) { Mat inputImage = imread(argv[1]); imshow("Input Image", inputImage); waitKey(0); } I am using eclipse IDE, cygwin g++ compiler and opencv 3.0. I have correctly given include path, library search path as "C:\opencv\build\x64\vc11\lib" & "C:\opencv\build\x64\vc11

OpenCV: load image with alpha channel but 8bit depth

核能气质少年 提交于 2019-12-10 19:11:27
问题 I am getting a bit confused with the flags that cv::imread takes. My goal is to load images that have an alpha channel with this alpha channel (i.e. as CV_8UC4 ). At the same time I want to load them always with a depth of 8bit. First of all I tried using the following: cv::imread(/*path*/, cv::IMREAD_COLOR); This strips the alpha channel and returns an 8bit image. For transparent TIFs everything looks kind of right, just the transparent parts are black. For transparent PNGs, hovever, it

C++ OpenCV imread not working in Android

社会主义新天地 提交于 2019-12-10 15:25:30
问题 I am trying to read an image in my C++ code LOGD("Loading image '%s' ...\n", (*inFile).c_str());; Mat img = imread(*inFile, CV_LOAD_IMAGE_GRAYSCALE); CV_Assert(img.data != 0); and get the following output: 09-25 17:08:24.798: D/IRISREC(12120): Loading image '/data/data/com.example.irisrec/files/input/osoba1.jpg' ... 09-25 17:08:24.798: E/cv::error()(12120): OpenCV Error: Assertion failed (img.data != 0) in int wahet_main(int, char**), file jni/wahet.cpp, line 4208 The file exists. But strange

How to add unique image formats to Matlab's imread, and Matlab's drag and drop?

谁都会走 提交于 2019-12-08 17:30:20
问题 We have a number of internal image formats which I process in Matlab. I have read/write functions for all of them. For specificity, consider the TGA image format, for which there is a file exchange image reader. Matlab has reasonable drag and drop support for image formats supported by imread. That is, you can drag an image from explorer, drop it on the "Workspace" pane, and Matlab will read in the image, and copy it into your workspace. I'd like to be able to add drag and drop support, and

Unable to split opencv image to RGB

半腔热情 提交于 2019-12-08 07:24:29
问题 I'm trying to split an image into B,G,R but after splitting, each B G & R have grayscale images. import cv2 import numpy as np image = cv2.imread('/path/image.jpg') #I have tried using CV_LOAD_IMAGE_COLOR flag as well as 1 #however,image is read as color image. It is not a grayscale image b,g,r = cv2.split(image) #[b,g,r]=np.dsplit(image,image.shape[-1]) #b,g,r = cv2.split(image) #b = image[:,:,0] #g = image[:,:,1] #r = image[:,:,2] #none of the above worked cv2.imshow("green",g) cv2.waitKey