1 | initial version |
Solved! Since BackgroundSubtraction2 inherits from Algorithm, we can get access to parameters. So here is how it worked for me;
BSMOG2 = new BackgroundSubtractorMOG2(2, 16, true);
double x = BSMOG2.getDouble("fTau");
System.out.println("BSMOG2.getInt(fTau) = " + x);
double yy = BSMOG2.getDouble("nShadowDetection");
System.out.println("BSMOG2.getInt(nShadowDetection) = " + yy);
and the output is;
BSMOG2.getInt(fTau) = 0.5
BSMOG2.getInt(nShadowDetection) = 127.0
to set the values, all it takes is;
BSMOG2.setDouble("fTau", 0.7);
2 | Added Algorithm operations |
Solved! Since BackgroundSubtraction2 inherits from Algorithm, we can get access to parameters. parameters via Algorithms parameter setters and getters. In this case, both of the ones I want access to are double, so the Algorithm methods are;
double getDouble(java.lang.String name)
void setDouble(java.lang.String name, double value)
So here is how it worked for me;
BSMOG2 = new BackgroundSubtractorMOG2(2, 16, true);
double x = BSMOG2.getDouble("fTau");
System.out.println("BSMOG2.getInt(fTau) = " + x);
double yy = BSMOG2.getDouble("nShadowDetection");
System.out.println("BSMOG2.getInt(nShadowDetection) = " + yy);
and the output is;
BSMOG2.getInt(fTau) = 0.5
BSMOG2.getInt(nShadowDetection) = 127.0
to set the values, all it takes is;
BSMOG2.setDouble("fTau", 0.7);
3 | grammar |
Solved! Since BackgroundSubtraction2 inherits from Algorithm, we can get access to parameters via Algorithms Algorithm's parameter setters and getters. In this case, both of the ones I want access to are double, so the Algorithm methods are;
double getDouble(java.lang.String name)
void setDouble(java.lang.String name, double value)
So here is how it worked for me;
BSMOG2 = new BackgroundSubtractorMOG2(2, 16, true);
double x = BSMOG2.getDouble("fTau");
System.out.println("BSMOG2.getInt(fTau) = " + x);
double yy = BSMOG2.getDouble("nShadowDetection");
System.out.println("BSMOG2.getInt(nShadowDetection) = " + yy);
and the output is;
BSMOG2.getInt(fTau) BSMOG2.getDouble(fTau) = 0.5
BSMOG2.getInt(nShadowDetection) BSMOG2.getDouble(nShadowDetection) = 127.0
to set the values, all it takes is;
BSMOG2.setDouble("fTau", 0.7);
4 | grammar |
Solved! Since BackgroundSubtraction2 inherits from Algorithm, we can get access to parameters via Algorithm's parameter setters and getters. In this case, both of the ones I want access to are double, so the Algorithm methods are;
double getDouble(java.lang.String name)
void setDouble(java.lang.String name, double value)
So here is how it worked for me;
BSMOG2 = new BackgroundSubtractorMOG2(2, 16, true);
double x = BSMOG2.getDouble("fTau");
System.out.println("BSMOG2.getInt(fTau) System.out.println("BSMOG2.getDouble(fTau) = " + x);
double yy = BSMOG2.getDouble("nShadowDetection");
System.out.println("BSMOG2.getInt(nShadowDetection) System.out.println("BSMOG2.getDouble(nShadowDetection) = " + yy);
and the output is;
BSMOG2.getDouble(fTau) = 0.5
BSMOG2.getDouble(nShadowDetection) = 127.0
to set the values, all it takes is;
BSMOG2.setDouble("fTau", 0.7);
5 | formatting |
Solved! Since BackgroundSubtraction2 inherits from Algorithm, we can get access to parameters via Algorithm's parameter setters and getters. In this case, both of the ones I want access to are double, so the Algorithm methods are;
double getDouble(java.lang.String name)
void setDouble(java.lang.String name, double value)
So here is how it worked for me;
BSMOG2 = new BackgroundSubtractorMOG2(2, 16, true);
double x = BSMOG2.getDouble("fTau");
System.out.println("BSMOG2.getDouble(fTau) = " + x);
double yy = BSMOG2.getDouble("nShadowDetection");
System.out.println("BSMOG2.getDouble(nShadowDetection) = " + yy);
and the output is;
BSMOG2.getDouble(fTau) *BSMOG2.getDouble(fTau) = 0.5
BSMOG2.getDouble(nShadowDetection) = 127.0127.0*
to set the values, all it takes is;
BSMOG2.setDouble("fTau", 0.7);
6 | ERRATA - help! |
EDIT: NOT Solved!
Since BackgroundSubtraction2 inherits from Algorithm, we can get access to parameters via Algorithm's parameter setters and getters. In this case, both of the ones I want access to are double, so the Algorithm methods are;
double getDouble(java.lang.String name)
void setDouble(java.lang.String name, double value)
So here is how it worked for me;
BSMOG2 = new BackgroundSubtractorMOG2(2, 16, true);
double x = BSMOG2.getDouble("fTau");
System.out.println("BSMOG2.getDouble(fTau) = " + x);
double yy = BSMOG2.getDouble("nShadowDetection");
System.out.println("BSMOG2.getDouble(nShadowDetection) = " + yy);
and the output is;
*BSMOG2.getDouble(fTau) = 0.5
BSMOG2.getDouble(nShadowDetection) = 127.0*
to set the values, all it takes is;
BSMOG2.setDouble("fTau", 0.7);
EDIT: This executes without warning or complaint, but never really sets fTau, the value continues to be 0.5
And setDouble for nShadowDetection crashes with the following very odd statement;
OpenCV Error: Bad argument (Argument error: the setter method was called for the parameter 'nShadowDetection' of the algorithm 'BackgroundSubtractor.MOG2', the parameter has unsigned char type, so it should be set by integer, unsigned integer, uint64, unsigned char, boolean, float or double value, but the setter was called with double value) in set, file /home/will/opencv-2.4.8/modules/core/src/algorithm.cpp, line 654
On top of that, I tried other operations to see what they resulted in;
Paramtype for fTau is 7 Paramtype for nShadowDetection is 11
I can't figure out what these mean - does anyone know?
I also tried String paramhelpfTau = BSMOG2.paramHelp("fTau");
But that was null.
<sigh> Now I can't undo my checkmark for solving the problem.
Do I need to ask this question again?