Java: important BackgroundSubtractionMOG2 parameters cannot be set (Bug #3573)
Description
After instantiating a BackgroundSubtractionMOG2, via parent class Algorithm we are able to getDouble() the parameters fTau and nShadowDetection, but setting does nothing for the fTau and creates the following error for nShadowDetection;
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
For example, the following code;
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, I did;
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 (paramType) to see what they resulted in;
Paramtype for fTau is 7
Paramtype for nShadowDetection is 11
I can't figure out what these mean.
I also tried String paramhelpfTau = BSMOG2.paramHelp("fTau");
But that was null.
The BackgroundSubtractionMOG2 is virtually unusable if one cannot change the parameters.
History
Updated by Will Stewart about 11 years ago
This was my first bug report - did I do this right, or is there some other reason why it has been passed over for now?
Updated by Dinar Ahmatnurov about 11 years ago
Alexander, please have a look
- Category set to java bindings
- Status changed from New to Open
- Assignee set to Alexander Smorkalov
Updated by Maksim Shabunin over 9 years ago
Issue has been transferred to GitHub: https://github.com/Itseez/opencv/issues/4707