现在我正在训练我自己的分类器.所以我正在使用traincascade.But当我给这个命令'opencv_traincascade -data facedet -vec vecfile.vec -bg negative.txt -npos 2650 -nneg 581 -nstages 20 -w 20 -h 20'它显示这样的错误.
PARAMETERS:
cascadeDirName: facedet
vecFileName: vecfile.vec
bgFileName: negative.txt
numPos: 2000
numNeg: 1000
numStages: 20
precalcValBufSize[Mb] : 256
precalcIdxBufSize[Mb] : 256
stageType: BOOST
featureType: HAAR
sampleWidth: 20
sampleHeight: 20
boostType: GAB
minHitRate: 0.995
maxFalseAlarmRate: 0.5
weightTrimRate: 0.95
maxDepth: 1
maxWeakCount: 100
mode: BASIC
===== TRAINING 0-stage =====
<BEGIN
POS count : consumed 2000 : 2000
NEG count : acceptanceRatio 1000 : 1
Precalculation time: 3 …Run Code Online (Sandbox Code Playgroud) 我想将 xml 文件转换为 json...但下面的代码显示空指针异常..我不知道出了什么问题。
public class Xmljson {
private URL url = null;
private InputStream inputStream = null;
public void getXMLfromJson() {
try{
url = Xmljson.class.getClassLoader().getResource("datafile.xml");
inputStream = url.openStream();
String xml = IOUtils.toString(inputStream);
JSON objJson = new XMLSerializer().read(xml);
System.out.println("JSON data : " + objJson);
}catch(Exception e){
e.printStackTrace();
}finally{
try {
if (inputStream != null) {
inputStream.close();
}
url = null;
} catch (IOException ex) {}
}
}
public static void main(String[] args) {
new Xmljson().getXMLfromJson();
}
}
Run Code Online (Sandbox Code Playgroud)
此处显示异常
url = …Run Code Online (Sandbox Code Playgroud)