Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Malloc error issue #10

Open
mahdidham opened this issue Mar 29, 2018 · 2 comments
Open

Malloc error issue #10

mahdidham opened this issue Mar 29, 2018 · 2 comments

Comments

@mahdidham
Copy link

I got an error after try to instance OCVVideoCamera, malloc error, pointer being freed was not allocated in OCVVideoCamera.mm 's process image and dealloc method on OCVMatDataAllocator.mm
I use to instance method in ViewController class. Heres the code.

class ViewController: UIViewController, OCVVideoCameraDelegate {    
    @IBOutlet var cameraView: UIImageView!
    @IBOutlet weak var enabler: UIButton!
    //var cameraWrapper: CameraWrapper!
    var cameraUnit: OCVVideoCamera!
    
    var isEnable = false
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        cameraView = UIImageView()
        cameraView.contentMode = .scaleAspectFill
        setCamera()
        
        
        //cameraWrapper = CameraWrapper(controller: self, andImageView: cameraView)
        //cameraWrapper.cameraViewDidLoad()
    }
    
    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
    }
    
    override func viewWillDisappear(_ animated: Bool) {
        super.viewWillDisappear(animated)
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    func startCamera() {
        cameraUnit.start()
        cameraUnit.lockFocus()
    }
    
    func stopCamera() {
        cameraUnit.stop()
    }
    
    func processImage(_ image: OCVMat) {
        //
    }
    
    @IBAction func activateCamera() {
        self.isEnable = !self.isEnable
        if(self.isEnable) {
            startCamera()
            self.enabler.setTitle("Disable", for: .normal)
        } else if(!self.isEnable) {
            stopCamera() 
            self.enabler.setTitle("Enable", for: .normal)
        }
    }
    
    func setCamera() {
        cameraUnit = OCVVideoCamera(parentView: cameraView)
        cameraUnit.delegate = self
        cameraUnit.defaultAVCaptureDevicePosition = .front
        cameraUnit.defaultAVCaptureSessionPreset = AVCaptureSessionPreset352x288
        cameraUnit.defaultAVCaptureVideoOrientation = .portrait
        cameraUnit.defaultFPS = 30
        cameraUnit.grayscaleMode = false
        cameraUnit.rotateVideo = true        
    }
}
@anonym24
Copy link

just write natively using c++ and objective-c++ (.mm) class
this project is dead

@Legoless
Copy link
Owner

@anonym24 The project is not dead, just didn't find much time to work on it last few months. Will look into the issue asap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants