public DetectionInfo createDetectionInfo( String tvName, int tvIdx, int tvRes, String fileName, Size size) { DetectionInfo info = new DetectionInfo(); info.mSingleDetection = true; info.mName = tvName; info.mSizes.add(size); info.mIds.add(tvIdx); info.mClassifilers.add(getCascadeClassifier(tvRes, fileName)); return info; }
private void initDetection() { ArrayList<DetectionInfo> array = new ArrayList<DetectionInfo>(); // String tvName , int tvIdx , int tvRes , String fileName , Size size array.add(createDetectionInfo("东方卫视", 0, R.raw.dfwscascade, "dfwsCascade", new Size(36, 36))); array.add(createDetectionInfo("江苏卫视", 1, R.raw.jswscascade, "jswsCascade")); array.add(createDetectionInfo("浙江卫视", 3, R.raw.zjwscascade, "zjwsCascade")); array.add(createDetectionInfo("天津卫视", 4, R.raw.tjwscascade, "tjwsCascade")); array.add(createDetectionInfo("山东卫视", 5, R.raw.sdwscascade, "sdwsCascade")); array.add(createDetectionInfo("安徽卫视", 6, R.raw.ahwscascade, "ahwsCascade")); DetectionInfo info = createDetectionInfo("湖南卫视", 2, R.raw.hnwscascade, "hnwsCascade"); info.mClassifilers.add(getCascadeClassifier(R.raw.hnwscascade_sub, "hnwsCascade_sub")); info.mSingleDetection = false; array.add(info); mDetection = new ImageDetection(array); mDetection.setOnDetectionListener(this); }