         // Dispose of any resources that can be recreated.
     }
     
-    
-/*    func detectFaces() {
-
-/*        let myImage : UIImage = UIImage.ResizeÜIImage(UIImage(named: "sample")!, width: self.view.frame.width, height: self.view.frame.height)
-    
-        // UIImageViewの生成.
-        let myImageView : UIImageView = UIImageView()
-        myImageView.frame = CGRectMake(0, 0, myImage.size.width, myImage.size.height)
-        myImageView.image = myImage
-        self.view.addSubview(myImageView)
-*/
-        
-        // NSDictionary型のoptionを生成。顔認識の精度を追加する.
-        var options : NSDictionary = NSDictionary(object: CIDetectorAccuracyHigh, forKey: CIDetectorAccuracy)
-    
-        // CIDetectorを生成。顔認識をするのでTypeはCIDetectorTypeFace.
-        let detector : CIDetector = CIDetector(ofType: CIDetectorTypeFace, context: nil, options: options as [NSObject : AnyObject])
-    
-        // detectorで認識した顔のデータを入れておくNSArray.
-        var faces : NSArray = detector.featuresInImage(CIImage(image: outputImage)!, options: options)
-    
-        // UIKitは画面左上に原点があるが、CoreImageは画面左下に原点があるのでそれを揃えなくてはならない.
-        // CoreImageとUIKitの原点を画面左上に統一する処理.
-        var transform : CGAffineTransform = CGAffineTransformMakeScale(1, -1)
-        transform = CGAffineTransformTranslate(transform, 0, -myImageView.bounds.size.height)
-    
-        // 検出された顔のデータをCIFaceFeatureで処理.
-        var feature : CIFaceFeature = CIFaceFeature()
-        for feature in faces {
-    
-        // 座標変換.
-        let faceRect : CGRect = CGRectApplyAffineTransform(feature.bounds, transform)
-    
-        // 画像の顔の周りを線で囲うUIViewを生成.
-        var faceOutline = UIView(frame: faceRect)
-        faceOutline.layer.borderWidth = 1
-        faceOutline.layer.borderColor = UIColor.redColor().CGColor
-        myImageView.addSubview(faceOutline)
-            
-        }
-    }
-*/
-    
-    
 }
        // カメラの使用準備.
        self.initCamera()
        
        //顔認識
//        self.detectFaces()
    }
    
    override func viewDidDisappear(animated: Bool) {

        renderContext.drawImage(outputImage, inRect: videoDisplayViewRect, fromRect: drawFrame)
        videoDisplayView.display()
        
        // NSDictionary型のoptionを生成。顔認識の精度を追加する.
        var options : NSDictionary = NSDictionary(object: CIDetectorAccuracyHigh, forKey: CIDetectorAccuracy)
        
        // CIDetectorを生成。顔認識をするのでTypeはCIDetectorTypeFace.
        let detector : CIDetector = CIDetector(ofType: CIDetectorTypeFace, context: nil, options: options as [NSObject : AnyObject])
        
        // detectorで認識した顔のデータを入れておくNSArray.
        var faces : NSArray = detector.featuresInImage(outputImage, options: options as [NSObject : AnyObject])
        
        // UIKitは画面左上に原点があるが、CoreImageは画面左下に原点があるのでそれを揃えなくてはならない.
        // CoreImageとUIKitの原点を画面左上に統一する処理.
        var transform : CGAffineTransform = CGAffineTransformMakeScale(1, -1)
        transform = CGAffineTransformTranslate(transform, 0, -videoDisplayView.bounds.size.height)
        
        // 検出された顔のデータをCIFaceFeatureで処理.
        var feature : CIFaceFeature = CIFaceFeature()
        for feature in faces {
            
            // 座標変換.
            let faceRect : CGRect = CGRectApplyAffineTransform(feature.bounds, transform)
            
            // 画像の顔の周りを線で囲うUIViewを生成.
            var faceOutline = UIView(frame: faceRect)
            faceOutline.layer.borderWidth = 1
            faceOutline.layer.borderColor = UIColor.redColor().CGColor
            videoDisplayView.addSubview(faceOutline)
            
        }
        
    }
    
    override func didReceiveMemoryWarning() {
