failed can't find input bag file in rs_bag2image code - realsense

I am trying to run "rs_bag2image" code (https://github.com/UnaNancyOwen/rs_bag2image) for extracting frames from a bag file. I am new in c++ and got the error "failed can't find input bag file" when I am running the code. It seems the issue occurs in the following piece of code. Can you please help me to resolve this issue?
// Retrieve Bag File Path (Required)
if( !parser.has( "bag") ){
throw std::runtime_error( "failed can't find input bag
file");
}
else{
bag_file = parser.get<cv::String>( "bag" ).c_str();
if( !filesystem::is_regular_file( bag_file ) ||
bag_file.extension() != ".bag" ){
throw std::runtime_error( "failed can't find input bag
file" );
}
}

You didn't provide path to the bag in the commandline. It says so in the github project's readme. Run the code as
$ ./rs_bag2image -b="./file.bag" -s=true -d=true
If you're running the project inside IDE, find out how to add commandline arguments in the Project's configuration.

Related

Executing a Jpype file

I am trying to implement a example given in the following tutorial:
enter link description here
I have been trying to execute this program.However I am stuck on an step which is to "Then place the .class file in the (current_directory)/org/wg3i/test/ directory.".So, when I made a Java file from BlueJ I have the .class file however I am not sure how I can place that file in (current_directory)/org/wg3i/test/ directory.Also where exactly is this directory located.
Additional Question:
I am trying to implement the following code.
import org.nlogo.headless.HeadlessWorkspace;
public class Example2 {
public static void main(String[] argv) {
HeadlessWorkspace workspace =
HeadlessWorkspace.newInstance() ;
try {
workspace.open(
"models/Sample Models/Earth Science/"
+ "Fire.nlogo");
workspace.command("set density 62");
workspace.command("random-seed 0");
workspace.command("setup");
workspace.command("repeat 50 [ go ]") ;
System.out.println(
workspace.report("burned-trees"));
workspace.dispose();
}
catch(Exception ex) {
ex.printStackTrace();
}
}
}
which is given in the following linkenter link description here
However, whenever I try to execute this java code using javac I get an error saying package org.nlogo.headless.HeadlessWorkspace doesn't exist and also says HeadlessWorkspace doesn't exist for line 4th.
I know that the link I inserted says this:
In order to compile and run this, NetLogo.jar must be in your classpath. The lib directory, containing additional required libraries, must also be present.
But I am not sure what it exactly asks me to do.
Also, I am working in Linux.

SFML sf::RenderWindow::createWindow() crashes program

So I've been learning C++ and I've been trying to learn some SFML 2 via some videos. At first I had no real issues, I was using MS VS2012 and everything was fine. I start using MS VS2015 Community and it all starts going wrong and I've got no idea why!
Main problem:
Everything compiles, but it just crashes when I try to use sf::RenderWindow::createWindow()
Error Message:
I get the message "SFML_Project.exe is no longer working",
I go to debug it and it gives me the following message:
Unhandled exception thrown: read access violation.
this->_Ptr was 0xCCCCCCCC.
If there is a handler for this exception, the program may be safely continued.
and it does it on this function (some SFML code I know nothing about)
const facet *_Getfacet(size_t _Id) const
{ // look up a facet in locale object
const facet *_Facptr = _Id < _Ptr->_Facetcount
? _Ptr->_Facetvec[_Id] : 0; // null if id off end <- ON THIS LINE OF CODE IT BREAKS
if (_Facptr != 0 || !_Ptr->_Xparent)
return (_Facptr); // found facet or not transparent
else
{ // look in current locale
locale::_Locimp *_Ptr = _Getgloballocale();
return (_Id < _Ptr->_Facetcount
? _Ptr->_Facetvec[_Id] // get from current locale
: 0); // no entry in current locale
}
}
Line of info that was given at the Call Stack
sfml-system-d-2.dll!std::locale::_Getfacet(unsigned int _Id) Line 451 C++
My Code:
#include <iostream>
#include "SFML\Graphics.hpp"
int main()
{
sf::RenderWindow window;
window.create(sf::VideoMode(800, 800), "WindowName");
sf::Texture texture;
sf::Sprite sprite;
texture.loadFromFile("Player.png");
sprite.setTexture(texture);
sf::Event eventHandler;
while(window.isOpen())
{
while(window.pollEvent(eventHandler))
{
switch(eventHandler.type)
{
case sf::Event::Closed:
window.close();
break;
}
}
window.clear();
window.draw(sprite);
window.display();
}
}
SFML version: Visual C++ 14 (2015) - 32-bit
Project Properties:
Debug -> C/C++ -> General -> Additional Include Directories:
$(SolutionDir)/SFML-2.3.2/include
Debug -> Linker -> General -> Additional Library Directories:
$(SolutionDir)/SFML-2.3.2/lib
Debug -> Linker -> Input -> Additional Dependencies:
sfml-main-d.lib
sfml-window-d.lib
sfml-graphics-d.lib
sfml-system-d.lib
sfml-network-d.lib
sfml-audio-d.lib
What I've tried:
I've tried turning all the dependencies from sfml-XX-d.lib to sfml-XX.lib files, which does allow me to create a window and draw shapes to that window, but then when I try to use sf::Texture::loadFromFile("filename") the console command window turns into the matrix and starts beeping.
It might be because you link the window lib before the graphics lib.
Try to move up the window lib under the graphics lib.
sfml-graphics-d.lib
sfml-window-d.lib
sfml-system-d.lib
If it's still crashing, it may because your sfml's dlls does not match the current sfml version that you have. Happened to me once, I downloaded a new version of sfml without updating the binaries.

Typescript build error (TS5007)

I've been trying to get typescript building via the build servers on visualstudio.com, and I've done the normal thing of bringing typescript into source control. But I'm getting the following issue:
VSTSC : error TS5007: Build:
Cannot resolvereferenced file:
'COMPUTE_PATHS_ONLY'.
[C:\a\src\Main\RecruitCloud\RecruitCloud.csproj]
I'm aware of the encoding issues, but in all the examples I've seen the culprit file has been named in the error message.
I'm starting to think this could be down to the number of typescript files I'm compiling in the project.
Any ideas?
This is a configuration option for the VsTsc task, the one that runs the compiler. It is used in the PreComputeCompileTypeScript target. The intention is to make the VsTsc task go through all the motions, except to run the compiler. That didn't pan out on your machine, it actually did run the compiler. Which then threw a fit since it can't find a file named COMPUTE_PATHS_ONLY.
The VsTsc task is stored in C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\TypeScript\TypeScript.Tasks.dll. Looking at the assembly with a decompiler:
protected override int ExecuteTool(string pathToTool, string responseFileCommands, string commandLineCommands)
{
if (this.Configurations.Contains("--sourcemap"))
{
this.generateSourceMaps = true;
}
else
{
this.generateSourceMaps = false;
}
if (this.Configurations.Contains("--declaration"))
{
this.generateDeclarations = true;
}
else
{
this.generateDeclarations = false;
}
this.GenerateOutputPaths();
if (!responseFileCommands.Contains("COMPUTE_PATHS_ONLY"))
{
return base.ExecuteTool(pathToTool, responseFileCommands, commandLineCommands);
}
return 0;
}
Note the !responseFileCommands.Contains() test to bypass the base.ExecuteTool() call.
All I can guess is that the method doesn't look like this on your machine. With the most likely cause that you have an outdated version of TypeScript.Tasks.dll. On my machine with VS2013 Update 4 installed it is dated Nov 11, 2014 with a size of 27816 bytes.
Your best bet would be to simply resave all the files in Unicode encoding. You can do it from a quick powershell script (Change files' encoding recursively on Windows?)
Get-ChildItem *.txt | ForEach-Object {
$content = $_ | Get-Content
Set-Content -PassThru $_.Fullname $content -Encoding UTF8 -Force}

OpenNI 1.5::Could not run code from documentation

I am trying to run a sample code from the OpenNI 1.5 documentation.I have imported the library required XnCppWrapper.h so that I can use C++.The code has only one error on a particular variable "bshouldrun".I know that it should be declared as something but since I am new at this and the documentation does not contain anything above the main, I dont know what to declare it as..Please help!!
And thanks in advance.
#include <XnOpenNI.h>
#include <XnCppWrapper.h>
#include <stdio.h>
int main()
{
XnStatus nRetVal = XN_STATUS_OK;
xn::Context context;
// Initialize context object
nRetVal = context.Init();
// TODO: check error code
// Create a DepthGenerator node
xn::DepthGenerator depth;
nRetVal = depth.Create(context);
// TODO: check error code
// Make it start generating data
nRetVal = context.StartGeneratingAll();
// TODO: check error code
// Main loop
while (bShouldRun) //<-----------------------------**ERROR;bShouldRun Undefined**
{
// Wait for new data to be available
nRetVal = context.WaitOneUpdateAll(depth);
if (nRetVal != XN_STATUS_OK)
{
printf("Failed updating data: %s\n", xnGetStatusString(nRetVal));
continue;
}
// Take current depth map
const XnDepthPixel* pDepthMap = depth.GetDepthMap();
// TODO: process depth map
}
// Clean-up
context.Shutdown();
}
Here's what I did to run a sample from Visual Studio 2010 Express on Windows (8):
Opened the NiSimpleViewer.vcxproj VS2010 project from C:\Program Files (x86)\OpenNI\Samples\NiSimpleViewer
Edited OpenNI.rc to comment out #include "afxres.h" on line 10(might be missing this because I'm using Express version, not sure. Your machine might compile this fine/not complain about the missing header file)
Enabled Tools > Options > Debugging > Symbols > Microsoft Symbol Servers (to get past missing pdb files issue)
Optionally edit the SAMPLE_XML_PATH to "SamplesConfig.xml" rather than the default "../../../Data/SamplesConfig.xml", otherwise you need to run the sample executable from ..\Bin\Debug\NiSimpleViewer.exe by navigating to there rather than using the Ctrl+F5. A;so copy the SamplesConfig.xml file into your sample folder as you can see bellow
Here are a few images to illustrate some of the above steps:
You can also compile the NiHandTracker sample, which sounds closer to what you need.
So this explains the setup for OpenNI 1.5 which is what your question is about.
I've noticed your OpenNI 2 lib issue in the comments. It should be a matter of linking against SimpleHandTracker.lib which you can do via Project Properties (right-click project->select Properties) > Linker > Input > Additional Dependencies > Edit.
I don't have OpenNI2 setup on this machine, but assuming SimpleHandTracker.lib would be in OpenNI_INSTALL_FOLDER\Lib. Try a file search in case I might be wrong.

Run a terminal/shell in a SlickEdit window?

I'd like to run a bash shell in a 'normal' document window in Slick Edit.
At a minimum I'd be content with running a command and having all output captured into a document window. Better would be the ability to interactively work with the shell in that window.
This is a bit crude, but it is what I use for launching external programs
(including bash scripts). When I used to work in Win+Cygwin I also had a wrapper around the bash script but I forget why I needed that.
but remember that you can always tie specific actions to your project
(build, compile, etc), you can always add your own as well Project->Properties->Tools->New. All those commands can execute in the process window
#include "slick.sh"
static _str mytmp='/tmp/myvstmp.txt'
_command git_annotate(_str filename='') name_info(',' VSARG2_MACRO )
{
if (filename=='') {
filename=p_buf_name;
}
curr_line=p_line;
delete_file(mytmp); // make sure we dont get old file
if( file_match(mytmp,'1')==mytmp ) {
message('Tmp file delete failed! ('mytmp') change permissions and if still failing - restart vs');
return 1
}
shell('/usr/bin/git blame -s 'filename' | sed "s#^\(.\{8\}\) [^)]*) #\1 #" >'mytmp, 'p');
if( file_match(mytmp,'1')!=mytmp ) {
message('Annotate failed');
return 1
}
status=edit('-w 'mytmp);
if (status) {
message('Error opening output file for display.');
return 1
}
goto_line(curr_line+1);
// keep disk clean
p_buf_flags |= VSBUFFLAG_THROW_AWAY_CHANGES;
name("* annotate output *" filename, false);
delete_file(mytmp);
}