I use namedWindow with openCV and get an error:
(Image1): Gtk-WARNING **: cannot open display:"
The code is:
Mat image1 = imread("image1.jpg");
cv::namedWindow("image1");
cv::imshow("image1",image1);
waitKey(0);
Someone says he solves it by: "export DISPLAY=:0".
But I don't really understand what does this solution mean.Since I am a beginner in opencv and c++. Could someone explain it in detail. e.g. How to add the code? Where to implement?
You seem to be lacking the context of your X server.
The easiest way to make this work is to login graphically, then open a terminal, then start your application. This means, not opening a session for another user, e.g. root.
If you want to run the program as another user or from remote, you need other solutions. Please specify what you are doing. It is a common problem (it is about authorization) with common solutions depending on your use-case! It is not a OpenCV-related problem.
Related
I'm trying to get back into programming with OCaml after a long time of not using it, and since I don't have Linux on my current computer, I've been trying to do it through WSL (Windows Subsystem for Linux).
After doing everything as I would have in Linux, whenever I try to compile a piece of code using the Graphics module, I get the following outcomes:
If I try to use the open_graph command, I get the following error:
Exception: Graphics.Graphic_failure "Cannot open display ".
I get that exact error if the argument of open_graph is an empty string, or starts with a space. If the string argument is not empty and doesn't start with a space (which, from what I've read, shouldn't be used anyway), the error message includes said argument as follows:
Exception: Graphics.Graphic_failure "Cannot open display [argument of open_graph]".
If the code only uses base OCaml commands and Graphics commands that doesn't require an open graph (like rgb), everything compiles normally.
I found this thread where users raised the question of the DISPLAY variable possibly being "wrong". The original poster of said thread has a different issue, but I felt it is relevant, as I was thinking that perhaps using WSL could have made my DISPLAY variable "off", or could require me to use a different value for DISPLAY than I would use on a complete Linux OS - but, to be perfectly honest, I have no idea what that would be.
I tried my best to understand everything I read and to explain my issue clearly, but I only have moderate experience with Linux and programming in general, so I'm sorry if I misunderstood something or if my explanations weren't the clearest. In that case, please let me know, and I will try my best to rectify it.
Cheers!
Example of complete code and exact error message:
#use "topfind";; #require "graphics";; Graphics.open_graph "";;
Error message returned:
Exception: Graphics.Graphic_failure "Cannot open display ".
According to https://github.com/ocaml/graphics/issues/21 you need to install a X11 server in your WSL environment.
newbie here. I am following along this SFML flappy bird tutorial. I am currently stuck at this portion of stage creation where a "Splash State" (or logo loading screen) is made. The code of which is exactly the same as what is shown here.
I am using xcode 10.1.
The project builds. But when I tried running it, it crashes and I am greeted with the following:
Failed to load image "Resouces/res/Splash Background.png". Reason: Unable to open file
libc++abi.dylib: terminating with uncaught exception of type std::out_of_range: map::at: key not found
(lldb)"
If I understand it correctly, it's saying it cannot perform the action of loading the image at the aforementioned path because it is not able to open "libc++abi.dylib". And now the program is being terminated. (please help me understand this problem better by either confirming or correcting me here).
When I tried looking for "libc++abi.dylib", it is missing. Instead, I can only find "libc++abi.td".
This thread says to add that under Link Binary With Libraries. That did not produce any result.
The tutorial shows that the code runs and a "Splash State" or logo screen is expected to appear. Instead my program crashes and I am greeted with the aforementioned error.
I was wondering if anyone else ran into similar issues?
It's solved. It is made by a typo on my end... sorry.
I'll try my best to explain it here for those of you who may have the same issues:
The game asset is governed by a map, which is a private member variable of a "AssetManager" class. The typo is at the file path. Because of this, the map never inserted the key since the file path isn't valid.
When the map is later accessed, it would be out of range since nothing ever got inserted (since the asset did not load).
Basically, the error of not being to open "libc++abi.dylib" is caused by the map being out of range.
I have been using ARToolKit to calibrate my camera, everything went fine until I tried to save the result, it came up with this error:
Error (13): unable to open camera parameters file "camera_para.dat" for writing.
Result too large
Parameter write error!!
I used the ARToolKit's calib_camera example code.
Thank you in advance!
I've actually figured this out...it was just because my ARToolKit was installed in Program Files folder, which is read-only. To save the results successfully, all you need to do is to run as administrator at the beginning.
Question Intro
I'm running an opencv project in Visual Studios 2010 and have implemented cuda support (refer to my previous question for precise info on my set-up). All cuda-functionalities are working fine - to the best of my knowledge - and are indeed improving speed on the image processing.
However, I now also wanted to attemp to speed up the video-writing function in this project by replacing the current cv::VideoWriter with the gpu::VideoWriter_GPU function. The reason for this is that the cv::VideoWriter seems to somehow cause processes running outside of the scope in which the VideoWriter is called to be slowed down, resulting in images available at the DirectShow driver being dropped by the VideoCapture-function, hence messing up an algorithm I've implemented.
Problem
To attempt to solve this issue, I've now replaced the VideoWriter-calls with VideoWriter_GPU-functionality (and corresponding syntax), but when I run my project (Compile & Run in Debug-mode), I get the following error-message (directly originating atthe calling of gpu::VideoWriter_GPU):
OpenCv Error: The function/feature is not implemented (The called functionality
is disabled for current build or platform) in unknown function, file
c:slave\builds\wininstallermegapack\opencv\modules\gpu\src\precomp.hpp, line 131.
and the program then ends with
code -529697949 (0xe06d7363)
I've purposely currently not included any of my code because the error-message originates so clearly from the call to the gpu::VideoWriter_GPU, which is making me think it's not a coding or syntax problem. (Please comment if you feel my code is necessary for answering this question.
My steps so far
I miss the natural gift of understanding what precisely this message means or how to interpret it. Does my opencv v2.4.4 simply not support what I want...? Does this function simply not work on my windows 7, 64bit system...?
I've checked out as many available google-hits I could find (relating to this error message and combinations of searchterms like "opencv, gpu, VideoWriter_GPU, disabled for current build") but have not understood what the problem is or how to solve it.
Corresponding header-file and error message can also be found here.
This post and this post suggest the error message is trying to tell me that opencv simply does not provide the option of using the function or functionality I am aiming to use. Or maybe even that cuda is not at all supported.. But that's all against my experience as every single opencv gpu-function I've tried to use has seemed to work fine.
Question
Could someone please explain to me why this is not working for me, and more importantly share with me what I should do to make the VideoWriter_GPU work?
Many thanks!
Maybe this link can give you a little idea of what the problem is: VideoReader_GPU not available, but built with NVCUVID?.
It seems to be that the problem is the CUDA_DISABLER var.
Im using C++ and im trying to create a program similar to handle.exe from sysinternals.
Basically, i am getting the filename from the user, and I need to be able to display which process is locking the file.
Does anyone know where I can get this information from? I've tried using some process functions in winapi, but I cant figure out how to get this information,
Here is an example of what im trying to create:
http://www.kartmann.org/freeware/WhoSLocking/ReadMe.htm
Thanks in advance
There is an undocumented option on NtQuerySystemInformation to get the file handles for a process. There is sample code here.
Second sample (in Delphi) is here.