@Override public void surfaceDestroyed(SurfaceHolder arg0) { // TODO Auto-generated method stub mDetection.setOnDetectionListener(null); mCamera.setPreviewCallback(null); mCamera.stopPreview(); mCamera.release(); }
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); }
public void handleMessage(Message msg) { Mat sub = (Mat) msg.obj; Mat dst = rotateImage(sub, -90); Mat roi = buildROI(dst); mDetection.detection(roi); }