How to give argument for webcam - c++

I am using command line argument and by question is related to my last question as i want to check it through webcam but when i give command line argument regarding camera operation (0),
it give me error on it as invalid argument 0.
This my explained last question but in that question i am using image path, but now i want to open webcam functionality for testing. This is the Sample Program i am using for testing and checking result.

To use default camera, you need to not pass -i argument.
This command line works for me:
path\\to\\cascade\\facefinder -m 128 -M 1024 -a 0.0 -q 5.0 -c 1.1 -t 0.1
All but first arguments are optional.

Related

Trouble with visualizer.pl

I'm trying to use visualizer.pl to visualize the dynamics of multi-state system
my function file:
f1 := x2
f2 := x1+x2*x3
f3 := x3^2+x1+x2+1
I used the following command as mentioned in "readme.txt" 
perl visualizer.pl -p 1.txt 3 3
since prime := 3 and num_nodes :=3
but I got this error
educ#educ-VirtualBox:~/Desktop/visualizer$ perl visualizer.pl -p 1.txt 3 3
Errors found in the input file. See below for description:
ERROR: Incorrect start of function declaration in function 1.
Errors with input file..ending program at visualizer.pl line 162, > line 1.
State Space Visualizer
Version 1.0 beta
-------------------------------------
The State Space Visualizer is a tool for the visualization of the dynamics of multi-state, discrete models of biological networks.
More information about package:
https://web.archive.org/web/20110815084457/http://dvd.vbi.vt.edu/tutorial.html
https://web.archive.org/web/20120320172453if_/http://dvd.vbi.vt.edu/visualizer.zip
Use = to separate your functions, and remove spaces around the =. Your input file should thus be:
f1=x2
f2=x1+x2*x3
f3=x3^2+x1+x2+1
I know that it's not consistent with the readme, but it's consistent with the content of visualizer.pl, and it works.
If, once that's done, the script visualizer.pl fails with:
sh: 1: kghostview: not found
You can fix it by installing ghostview (sudo apt install gv on Debian), and replacing the line system("kghostview out.ps &"); by system("gv out.ps &"); at the end of visualizer.pl.

intel-pin: How to pass command line arguments to binary

I have a simple c code. I am running the binary of that with my pin tool:
pin -t tool.so -- test/test.o a
Here, test/test.o is a binary, and a is some random command line argument to the pin tool (say tool.so), and not the binary (so, there is a distinction between passing command line argument to the pin tool and to the binary).
I would like to know how can I pass command line input (say arg1) to the binary which I am running with the pin tool.
(like we would pass with - ./test/test.o arg1)
Note: I think knowing my pin tool and the c code is irrelevant here.
What you describe here will pass command line arguments to the program you're running. Command line arguments to the tool are all the arguments that come after the -t argument and before the -- (double dash) which indicates the binary and its arguments

How to use calibration.cpp of opencv in sample (ubuntu opencv 2.4.12)

I don't know how to use calibration.cpp in opencv2.4.12 sample in ubuntu.
I tried to write command line
./calibrayion -w 6 -h 4 -pt chessboard -o camera.yml -op -oe stereo_calibl.xml
Result:
Could not initialize video (0) capture
stereo_calib.xml content
"left01.jpg"
"right01.jpg"
"left02.jpg"
"right02.jpg"
"left03.jpg"
"right03.jpg"
"left04.jpg"
"right04.jpg"
...
"left11.jpg"
"right11.jpg"
"left12.jpg"
"right12.jpg"
It seems your xml file is formatted incorrectly, and the program tried to open a camera capture. Consider https://github.com/Itseez/opencv/blob/master/samples/cpp/calibration.cpp for information about expected format, it also provides instructions on how to generate valid xml.

First project in Opencv to show image, error..

When I run opencv to show an image, I got an error like the image.
String index out of range: -8
The code is from Opencv website:
http://docs.opencv.org/doc/tutorials/introduction/display_image/display_image.html
Like it is mentioned in the tutorial, you need to call your program by command line with an argument which is the path to your image :
./DisplayImage HappyFish.jpg //From the tutorial
The arguments you pass to an application are stored in argv and counted by argc. The first parameter is always the path of your own application.
If this don't helps you, you'll need to show us some codes and logs (what is the exact error message, etc.)

C++ - system command

I have a C++ program which is mainly used for video processing. Inside the program, I am launching the system command in order to obtain pass the processed videos to some other binaries to postprocess them.
I have a while loop towards infinite and I am launching the system command inside the loop every time. The thing is that at a certain point I am receiving the -1 return code from the system command. What could be the reason for that?
Inside the system command I am just calling a binary file with the adequate parameters from the main project.
The system command which I want to execute is actually a shell file.
In this file I am extracting the main feature from the video and passing them through a SVM model from a 3D party library in order to obtain the the desired classification.
./LiveGestureKernel ./Video ./SvmVideo
./mat4libsvm31 -l SvmVideoLabels < SvmVideo > temp_test_file
./svm-predict temp_test_file svm_model temp_output_file
cat < temp_output_file
rm -f temp_*
After a certain number of iterations through the while loop, it just won't execute the script file and I cannot figure out the reason for this. Thanks!
If you get -1 from the call to system(), you should first examine the contents of errno - that will most likely tell you what your specific problem is.
The one thing to watch out for is that the return value from system is an implementation-defined one in the case where you pass it a non-NULL command, so it's possible that -1 may be coming from your actual executable.
Your best bet in that case is to print out (or otherwise log) the command being executed on failure (and possibly all the time), so that you can check what happens with the same arguments when you execute it directly from a command line or shell.