openCV中输出图片出现问题

为什么输出后会有2张图片,一张有图,一张无图。
#include
#include

#include

using namespace cv;

int main() {

Mat img = imread("pic.jpg");

namedWindow("游戏原画");
imshow("游戏原画", img);

waitKey(6000);
}

图片说明

1个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
opencv中cvPyrSegmentation出现问题了
运行学习opencv中的代码,但是出现了错误rn提示窗口rnOpencv GUI Error HandlerrnBad argument (OpenCV function failed)rnin function cvPyrSegmentation ,c:\User\vp\opencv\src\cvPyrSegmentation.cpp 1870rn谢谢了啊rn~rn麻烦大家了rnrnrnrn[code=C/C++]//rn//Example 5-1. Doing something with each element in the sequence of connected components returnedrn// by cvPyrSegmentation(rn//rn/* *************** License:**************************rn Oct. 3, 2008rn Right to use this code in any way you want without warrenty, support or any guarentee of it working.rnrn BOOK: It would be nice if you cited it:rn Learning OpenCV: Computer Vision with the OpenCV Libraryrn by Gary Bradski and Adrian Kaehlerrn Published by O'Reilly Media, October 3, 2008rn rn AVAILABLE AT: rn http://www.amazon.com/Learning-OpenCV-Computer-Vision-Library/dp/0596516134rn Or: http://oreilly.com/catalog/9780596516130/rn ISBN-10: 0596516134 or: ISBN-13: 978-0596516130 rnrn OTHER OPENCV SITES:rn * The source code is on sourceforge at:rn http://sourceforge.net/projects/opencvlibrary/rn * The OpenCV wiki page (As of Oct 1, 2008 this is down for changing over servers, but should come back):rn http://opencvlibrary.sourceforge.net/rn * An active user group is at:rn http://tech.groups.yahoo.com/group/OpenCV/rn * The minutes of weekly OpenCV development meetings are at:rn http://pr.willowgarage.com/wiki/OpenCVrn ************************************************** */rnrn#include rn#include rn#include rn#include rnrnvoid f( rn IplImage* src, rn IplImage* dst rn) rn CvMemStorage* storage = cvCreateMemStorage(0);rn CvSeq* comp = NULL;rnrn cvPyrSegmentation( src, dst, storage, &comp, 4, 200, 50 );rn int n_comp = comp->total;rnrn for( int i=0; idepth, src->nChannels);rn f( src, dst);rnrn // Show the image in the named windowrn cvShowImage( argv[1], dst );rnrn // Idle until the user hits the "Esc" key.rn while( 1 ) if( cvWaitKey( 100 ) == 27 ) break; rnrn // Clean up and don鈥檛 be piggiesrn cvDestroyWindow( "201001071230101.jpg" );rn cvReleaseImage( &src );rn cvReleaseImage( &dst );rnrnrn[/code]
OpenCV在图片中输出中文乱码解决方案
OpenCV在图片中输出中文乱码解决方案
opencv中图片的全屏显示
opencv全屏显示图片 #include<iostream> #include<opencv2/core/core.hpp> #include<opencv2/highgui/highgui.hpp> #include<opencv2/imgproc/imgproc.hpp> using namespace cv; int main() {
opencv 调试出现问题
运行 opencv 终端程序,弹出对话框, 改正:将debug 类型设为:managed only 运行通过!
centos7.0安装opencv出现问题
问题描述: [ 17%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/grfmt_jpeg2000.cpp.o In file included from /usr/include/jasper/jasper.h:77:0, from /usr/local/openc
OpenCV入门——图片的输入、显示、输出
OpenCV入门——图片的输入、显示、输出 本篇是OpenCV系列的第二篇 本篇总结的主要是以下的函数 | imread | namedWorld | imshow | imwrite | watiKey | 首先,本篇思路是由总到分,先展示整体代码,然后对于各个函数进行总结,加深印象。 #include &amp;lt;opencv2/opencv.hpp&amp;gt; //Include file fo...
C++ & Opencv 实现图片转字符输出
环境: vs2015+opencv3.0 源码: #include #include #include using namespace cv; using namespace std; int main() { int i,j; unsigned char d[4] = {'&','*','@',' '}; Mat img = imread("6.jpg", 0);
OpenCV*Qt显示输出图片_QLable
cv::Mat格式要留心,通常需要转化才能用 反思:对于要完成的某一事件的一段代码,先单独运行,搞清楚那段代码能得到什么结果,再去整合,这样更能够抓住核心问题少出bug 参考:https://blog.csdn.net/qq_27901091/article/details/75171378 //加载两幅图片 void MainWindow::on_download_clicked() { ...
【opencv】基于opencv将视频帧转成图片输出
本文做的是基于opencv将视频帧转成图片输出,由于一个视频包含的帧数过多,经常我们并不是需要它的全部帧转成图片,因此我们希望可以设置每隔多少帧再转一次图片(本文设置为30帧),若有人需求是只需要前多少帧,也可以类似的改写下代码即可。             本文代码如下: #include #include "cv.h" #include "opencv2/opencv.hpp" usi
Opencv之输出opencv对象属性
目录 一、opencv对象属性 二、代码   一、opencv对象属性 type() 输出opencv对象所属类型 dtype()输出opencv对象数据类型 shape输出opencv对象的形状 size输出opencv对象的元素个数   二、代码 import cv2 img1 = cv2.imread('./Image/reba_color.jpg',cv2.IMRE...
结构数组输出浮点数出现问题?
我定义一个结构数组,需要从键盘输入,然输出。有两个定义的是浮点和字符型的,输入后打印总是有错!哪位细心人帮忙看看!我的错误出在哪里了!rnrn#include rnrnstruct stu rnrnint num;rnchar name[15];rnfloat grade;rnrnrnmain()rnrn int i;rn struct stu stu1[3];rnrn for(i = 1; i <= 3; i++)rn rn scanf("%d,%c,%f",&stu1[i].num,&stu1[i].name,&stu1[i].grade);rn rn for(i = 1; i <= 3; i++)rn rn printf("num=%d,name=%c,grade=%f",stu1[i].num,stu1[i].name,stu1[i].grade);rn rn
结构体成员输出出现问题。
大家好,问一个问题.rn在下面程序中,在main函数中rn输出成员last的值时(红色字部分),第一次输出正常,rn同样输出但第2次就不对了?什么原因?rnrn另外 在tc++3.0下为什么给结构体成员m赋值rn输出的却是-NAM ?什么原因rn[code=C/C++]#includern#define MAXSIZE 1000rntypedef structrnrn int elem[MAXSIZE];rn int last;rn [color=#FF0000]float m;[/color]rnSeqlist;rnrnSeqlist *init(int n)rnrn Seqlist list;rn int i;rn for(i=0;ilast);rn printf("\n %d",p->last);[/color]rn [color=#99CC00]printf("\n %f",p->m);[/color] tc++3.0下输出-NAM 什么原因?rnrn[/code]
c++保留小数输出出现问题
我的输出都是0,望指导。rnrn题目:某医院想统计一下某项疾病的获得与否与年龄是否有关,需要对以前的诊断记录进行整理,按照0-18、19-35、36-60、61以上(含61)四个年龄段统计的患病人数占总患病人数的比例。rnrn输入:rn 共2行,第一行为过往病人的数目n(0rn#includernusing namespace std;rnint patient[100];rnint main()rn int number,a=0,b=0,c=0,d=0;rn double aout,bout,coutt,dout;rn cin>>number;rn for(int i=1;i<=number;i++)rn cin>>patient[i];rn rn for(int i=1;i<=number;i++)rn if(patient[i]>=0&&patient[i]<=18) a++;rn if(patient[i]>=19&&patient[i]<=35) b++;rn if(patient[i]>=36&&patient[i]<=60) c++;rn if(patient[i]<=61) d++;rn rn aout=a*100/number;rn bout=b*100/number;rn coutt=c*100/number;rn dout=d*100/number;rn printf("%2d",aout);rn cout<<"%"<
Opencv图片与本地文件夹中的图片匹配
分别在类中实现了对图片生成描述符,分别查询对应文件夹下的描述符,然后将要查询的图片的描述符 与 生成的要查询的文件夹下的描述符进行最佳匹配。方便其他文件的调用。
OpenCV中的图片叠加和变换
1.图片叠加的方法 通过掩膜进行叠加 假定一张图片位背景图片:BK 另外有一张图片是人的照片:PER。 1. 通过读取PER的灰度图来获取PER的掩膜 PER_MASK(掩膜的尺寸和PER的尺寸一样大) 2. 找到在BK需要赋值的位置 通过函数 PER.copyTo(BK_ROI,PER_MASK)。掩膜运算的方法是不对黑色的部分(值为0)进行赋值 通过透明通道进行叠加 读取PE...
opencv加载内存中图片
        opencv从磁盘加载一张图片非常简单,通过cv::imread即可,代码如下: cv::Mat src_mat = cv::imread(&quot;1.jpg&quot;); //读取图片1.jpg,imread会将图片内容解码成yuv或rgb存放到Mat对象 cv::Mat dst_mat = src_mat(cv::Rect(100, 100, 1600, 900)); //获取图片固...
OpenCV 提取图片中的曲线
简单介绍  在实际的应用中,我们常常需要对图像中的曲线进行描述、处理,这个曲线可以是轮廓,骨架或者其他。可以用deque<Point> 描述曲线,接下来简单介绍下如何从图片中搜索这些曲线并保存。   首先,输入的图片是一张二值图片 (白色为曲线),其中包含的曲线宽度为 1 像素的 (如果曲线不是 1 像素的 先提取其骨架)。遍历寻找图像中第一个白色的点,然后从这个点开始延伸寻找曲线。注意,第一个找
OPENCV 遍历文件夹中的图片方法
原理:1.先获取文件夹中图片的名称。 2.再通过图片地址和名称读取图片。 #include&amp;lt;iostream&amp;gt; usingnamespacestd; #include&amp;lt;opencv2\opencv.hpp&amp;gt; #include&amp;lt;opencv2\highgui\highgui.hpp&amp;gt; #include...
Opencv中的图片读取显示
使用Opencv实现图片读取显示 VS2010+OPencv2.4.4
opencv测试代码,读取文件中的图片
就是简单地读取图片的测试程序,读取某张图片,需自己添加路径,在线试出来
OpenCV 图片中写入中文字符
import cv2 from PIL import Image,ImageDraw,ImageFont import numpy as np frame=cv2.imread(&quot;filename&quot;) pil_img=Image.fromarray(cv2.cvtColor(frame,cv2.COLOR_BGR2RGB))#转化为pil 图片 draw=ImageDraw.Draw(pil_im...
opencv中图片添加文字
用来在图片文件中添加和删除文字的,比较好用。感谢大家支持·················
opencv读取文件夹中的图片
读取文件夹里的序列图像
opencv从文件中读取图片
今天接到一个任务,是从一个文件中将图片读取出来,文件是.out结尾的从摄像头上读取的图片,决定使用opencv来实现,刚好前端时间把浅墨的opencv入门书从头到尾又看了一遍,所有的程序也亲手重新过了一遍,但是还是感觉什么都不会,以后要多增加这方面的编程,纸上得来终觉浅,绝知此事要躬行。 下面直接看代码: #include &amp;lt;stdio.h&amp;gt; #include &amp;lt;vecto...
opencv中读不出图片!!!!
我用vs10编程,输出一张图片,总是运行提示某个位置出错,把imshow()屏蔽掉就不会出现位置发生错误。如图[img=https://img-bbs.csdn.net/upload/201607/22/1469188218_928227.png][/img],[img=https://img-bbs.csdn.net/upload/201607/22/1469188267_282871.png][/img],[img=https://img-bbs.csdn.net/upload/201607/22/1469188369_918056.png][/img],图片也加载进准确的路径了
opencv中图片反色
opencv中实现图片反色
opencv在图片中写入文字
由于一个小项目的需要,我得在把1000多个账号粘贴到特定的图片上打印出来,简直可怕。 系统 : windows7 环境 : vs2010+opencv-2.4.0 opencv+vs配置这个就不多说什么了 (1)配置系统变量 (2)添加包含目录、库目录 (3)添加附加依赖项(.lib) 有疑问可以参考: http://www.cnblogs.com/freedomshe/ar
OpenCV查找图片中的圆形
代码位置:27-FindCircles.py import cv2 as cv import numpy as np src = cv.imread('./res/board.jpg', cv.IMREAD_COLOR) img = cv.cvtColor(src, cv.COLOR_BGR2GRAY) img = cv.medianBlur(img, 5) cimg = src.copy()...
opencv图片
opencv测试所用图片 顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶
arm下cmake编译opencv出现问题了
[img=https://img-bbs.csdn.net/upload/201703/31/1490935599_62369.png][/img]rn请问是什么原因,sudo make就出错
CMake出现问题(在安装opencv时)
我按照http://blog.csdn.net/msq19895070/article/details/24477575 这篇博客进行交叉编译opencv,前边安装各种依赖库的时候都没有问题,就是在进行cmake的时候出现rn-- Performing Test HAVE_C_FFUNCTION_SECTIONSrn-- Performing Test HAVE_C_FFUNCTION_SECTIONS - Successrn-- Looking for pthread.hrn-- Looking for pthread.h - not foundrn-- Check if the system is big endianrn-- Searching 16 bit integerrn-- Looking for sys/types.hrn-- Looking for sys/types.h - not foundrn-- Looking for stdint.hrn-- Looking for stdint.h - not foundrn-- Looking for stddef.hrn-- Looking for stddef.h - not foundrn-- Check size of unsigned shortrn-- Check size of unsigned short - failedrn-- Check size of unsigned intrn-- Check size of unsigned int - failedrn-- Check size of unsigned longrn-- Check size of unsigned long - failedrnCMake Error at /usr/share/cmake-2.8/Modules/TestBigEndian.cmake:44 (MESSAGE):rn no suitable type foundrnCall Stack (most recent call first):rn CMakeLists.txt:458 (test_big_endian)rnrn-- Configuring incomplete, errors occurred!rn真是不好解决啊,求大神支招!
【OpenCV】opencv处理透明图片
    OpenCV处理透明图片,主要是考虑图片的叠加。 //主函数操作 Mat dest,srcAlpha; //-1表示读取带有alpha通道的图片 srcAlpha = imread(&quot;1.png&quot;,-1); dest= imread(&quot;2.png&quot;); //(0,0)设置对srcAlpha的叠加 mapToMat(srcAlpha, dest, 0, 0); void map...
分层 叠加图片 出现问题
图片叠加 需要用循环来叠加rn没个分页才能叠加一个 是怎么会事呢??(有很多数据 需要分页显示)rn rnrn rnrn rnrn rnrn rnrn rnrn rnrn
出现问题的提示图片
本图片是我在用dw8中打开动态数据对话框时提示错误图片
在抓取图片的时候,出现问题
在抓取图片的时候,出现了问题了异常如下:rnjava.io.FileNotFoundException: \data\image\tencent\520603.jpg (请求的操作无法在使用用户映射区域打开的文件上执行。)rn at java.io.FileOutputStream.open(Native Method)rn at java.io.FileOutputStream.(FileOutputStream.java:194)rn at java.io.FileOutputStream.(FileOutputStream.java:145)rn at com.u17.ca.util.HtmlUtils.saveCoverFromUrl(HtmlUtils.java:187)rn at com.u17.ca.service.impl.TencentComicServiceImpl.getTencentComicInfoFromHtml(TencentComicServiceImpl.java:404)rn at com.u17.ca.service.impl.TencentComicServiceImpl.insertDayComic(TencentComicServiceImpl.java:126)rn at com.u17.ca.service.impl.TencentComicServiceImpl$$FastClassByCGLIB$$128a663a.invoke()rn at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)rn at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:698)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)rn at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)rn at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:631)rn at com.u17.ca.service.impl.TencentComicServiceImpl$$EnhancerByCGLIB$$af670091.insertDayComic()rn at com.u17.ca.service.impl.TencentComicServiceImpl$$FastClassByCGLIB$$128a663a.invoke()rn at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)rn at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:698)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)rn at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)rn at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:631)rn at com.u17.ca.service.impl.TencentComicServiceImpl$$EnhancerByCGLIB$$e5a369c7.insertDayComic()rn at com.u17.ca.schedule.TencentStatistics.insertDay(TencentStatistics.java:49)rn at com.u17.ca.service.TencentStatisticsTest.everyWeekAppendTencentComicSendMailTest(TencentStatisticsTest.java:22)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)rn at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)rn at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)rn at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)rn at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)rn at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83)rn at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)rn at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)rn at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:88)rn at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)rn at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)rn at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)rn at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)rn at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)rn at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)rn at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)rn at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)rn at org.junit.runners.ParentRunner.run(ParentRunner.java:236)rn at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)rn at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)rn at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)rnjava.io.FileNotFoundException: \data\image\tencent\492216.jpg (请求的操作无法在使用用户映射区域打开的文件上执行。)
数据库读取图片出现问题
'将图片导出rn Private Sub OpenPhoto()rn sqlconnection1.Open()rn Dim custDA As New SqlDataAdapter("SELECT * FROM products", sqlconnection1)rn Dim myDataset As New DataSetrn custDA.Fill(myDataset, "products")rn Dim myBytes() As Byte = myDataset.Tables(0).Rows(0).Item("pdPhoto")rn Dim myStream As New IO.MemoryStream(myBytes)rn Me.PictureBox1.Image = Image.FromStream(myStream, True) '这里发出"使用了无效参数的错误"rn sqlconnection1.Close()rn End Subrnrn请大虾帮帮我,为什么是无效参数?rn
Opencv输出图像函数-imwrite
#include #include #include using namespace std; using namespace cv; void creatAlphaMat(Mat &mat) { for (int i = 0; i < mat.rows; i++) { for (int j = 0; j < mat.cols; j++) { Vec4b &rgba = ma
Opencv定义和输出三维点
#include #include using namespace std; using namespace cv; int main() { Point3f p3f(3, 4, 5); cout << "【三维点】" << endl << p3f << endl; return 0; }
opencv 读取图像和输出
        Mat src, dst; src = imread(&quot;E:\\ͼƬ\\Zoro3.jpg&quot;); if (!src.data) { printf(&quot;not found&quot;); return -1; } namedWindow(&quot;input&quot;,CV_WINDOW_AUTOSIZE); imshow(&quot;input&quot;, src); 
opencv 输出照片
import cv2 as cv def get_image_info(image): print(type(image)) print(image.shape) print(image.size) print(image.dtype) print(&quot;_&quot; *60) src = cv.imread(&quot;E:/opencv/1.jpg&quot;) cv.imshow(&quot;im...
相关热词 c# 标准差 计算 c#siki第五季 c#入门推荐书 c# 解码海康数据流 c# xml的遍历循环 c# 取 查看源码没有的 c#解决高并发 委托 c#日期转化为字符串 c# 显示问号 c# 字典对象池