Error during launch ITK/VTK project on ubuntu - c++

I am trying to launch a ITK/VTQ project with Qt. The project runs on Windows 10, but not on Ubuntu.
I have the following error during launching the project:
X Error: BadColor (invalid Colormap parameter) 12
Major opcode: 1 (X_CreateWindow)
Resource id: 0x4a00001
How I can correct this error message ?

Have you tried running other OpenGL applications/games? There could be a problem with 3D graphics drivers on your Ubuntu. Also, without source code fragment for window creation, I doubt anyone can help you much further.

Related

"Abort Trap: 6" when attempting OpenCV video capture on macOS Mojave

I've tried on both Python on C++, and every time I call cap.open(0), I get an Abort Trap: 6 error. I haven't been able to find any solutions to this via Google, and have tried reinstalling OpenCV several times now. Any suggestions?
iTerm might be messing things up for you. It worked for me when I used the normal terminal.
Most likely your mac blocks the webcam access.
Check
System Pref -> Security & Privacy -> Privacy -> Camera.
If the app that you try to use is not listed there, opencv produce "Abort trap: 6"
In VSCode:
Do cmd+shift+p
Enter "shell command: Install code in PATH"
Close VS Code
Use sudo code to open VS Code
It will give a warning not to run as a root user
Ignore the warning and run the file, and you will not get the "Abort trap: 6" error anymore.
install code in vsstudio code and then open terminal and type code, it will open visual studio code and it will have all the permisions.

QVTKWidget SetRenderWindow() with PCLVisualizer Exception

I'm new in PCL. I want to build a project with PCL and VTK int Qt 5.9.6 MSVC 2017 64bit Environment.
My code is like this:
// include file
boost::shared_ptr<pcl::visualization::PCLVisualizer> viewer;
...
// source code file
viewer.reset(new pcl:visualization::PCLVisualizer("viewer", false));
ui->qvtkWidget->SetRenderWindow(viewer->getRenderWindow());
viewer->setupInteractor(ui->qvtkWidget->GetInteractor(), ui->qvtkWidget- >GetRenderWindow());
It can be compiled but when I started debugging it goes wrong with alert:
The inferior stopped because it triggered an exception.
Stopped in thread 0 by: Exception at 0x7ffcb50b1f28, code: 0xc0000005: read access violation at 0x25, flags=0x0 (first chance).
and stopped at lineui->qvtkWidget->SetRenderWindow(viewer->getRenderWindow());
After tracking and debugging, I found the problem is that viewer->getRenderWindow()->GetInteractor() get the 0x25 value, I don't know how that could happen because a lot of online examples use code like this. And the same program runs healthy on ubuntu 18.04.
Thanks for any tips.
In the end, I found out that this is a problem caused by the version of VTK. The original version is 8.1.1, and it can be run normally by switching to 8.0.1. But I don't know why it can still be debugged normally in Linux 8.1.1.

OpenCV with DirectX sample error

I am trying to run an OpenCV with DirectX example: d3dsample.cpp from [here]. But it crashes on
initializeContextFromD3D11Device
The error is "Access violation executing ..." (look like it is not possible to initialize the context from D3D to OpenCL. I have no idea to solve with this problem.
I found some possible duplicate at OpenCV question board [here], but they are no any progress through last year.
If some one success to build this sample code, please give a suggestion.
PS: I am using OpenCV 3.1 on Visual Studio 2013 (vc120), Nvidia GTX980 graphics card.
Update:
I am trying to debug with both d3d10_interop and d3d11_interop.
The d3d10_interop gave me a exeption:
C:\OpenCV\3.1\sources\modules\core\src\directx.cpp:449: error:
(-222) OpenCL: Can't create context for DirectX interop in function
cv::directx::ocl::initializeContextFromD3D10Device\n" ...} ...}

"Object is owned by other context" error

I am testing some OpenGL code.Using OpenGL 4.3.Nvidia GTX960M GPU.Windows10 64bit.Driver version:364.72
Trying to debug with NVidia NSight (version:4.7).The app is running fine untill I open NSight graphics debuggig.(Running GL debug output,zero errors).But when NSight is being launched I am getting this error:
Source:OpenGL,type: Error, id: 1282, severity: High Message:
GL_INVALID_OPERATION error generated. Object is owned by another
context and may not be bound here.
Then NSight debug windows is freezing and the app crashes on the close.
Before that, I had also CUDA code there with some OpenGL resources mapped to CUDA context.So I assumed that maybe some CUDA resource still holds OpenGL texture or buffer.I deleted everything,wrote from scratch only GL part.Not a line of CUDA.The error still persists.
The rendering is just simple quad with texture mapping.Can it be a bug in NSight?

GLUT: Fatal Error: out of memory

I have an opengl implementation that runs fine on my desktop.
But even though i have it set up the exact same way on my laptop i get an "out of memory" error when i try to run it.
it is strange because on my desktop the application only takes up 200mb ram and i have 2gb available on the laptop
any ideas what might cause this?
btw im running the application through Visual Studio 2012 Ultimate and using the glut setup suggested in the first answer of this post: How to fix this Error: #include <gl/glut.h> "Cannot open source file gl/glut.h"
Check the encoding of your file
(http://lists.apple.com/archives/mac-opengl/2006/Jun/msg00070.html)
Ensure you're using the same runtime environment
(have you installed the same glut.dll on your laptop?)
Finally, I have a question:
What do you mean "running the application through Visual Studio"? Do you hit Ctrl+F5?
I found the solution, it is rather dumb.
I had set up "main" as "Entry Point" in "Project Preferences -> Linker -> Advanced" because it was necessary on my desktop.
I removed this so i had a blank "Entry Point" and my code runs fine ^^
posting in case someone needs this info