opencv-electron: Couple breaking issues using opencv4nodejs with electron.
Hi. I’m using electron-vue, and despite a lot of troubleshooting (even attaching to the electron main process), I am getting devtool disconnects that are both random and consequent.
Here is a list of functions that I’ve found to cause breakage. I haven’t gotten any further programming, but I hope this can be enough to make opencv4nodejs more stable as I love this wrapper!
mounted() {
// issues are the same no matter if you use camera or video
// this.wCap = new cv.VideoCapture(1)
this.wCap = new cv.VideoCapture(path.resolve('../backend/media/video.mp4'))
this.wCap.readAsync(frame => {
console.log(frame) // null
})
// console.log(this.wCap.read()) // crashes devtools in electron, is VideoCapture not ready?
// setInterval(() => {
// console.log(this.wCap.read()) // works ok, returns:
// // "{"step":3840,"elemSize":3,"sizes":[720,1280],"empty":false,"depth":0,"dims":2,"channels":3,"type":16,"cols":1280,"rows":720}"
// }, 500)
// setInterval(() => {
// console.log(this.wCap.read()) // too fast? returns a lot of the following
// // "{"step":0,"elemSize":0,"sizes":[],"empty":true,"depth":0,"dims":0,"channels":1,"type":0,"cols":0,"rows":0}"
// }, 10)
setInterval(() => {
let frame = this.wCap.read()
// below causes crashes randomly and disconnects devtools, no matter the interval (tested 500 and 2000)
// zero error output, not sure where to see the errors
let base64 = cv.imencode('.png', frame).toString('base64')
}, 500)
},
Versions VS Code version: 1.21 Electron version: 1.8.7 Chromium: v59 Node: 8.2.1 opencv4nodejs: 3.5.0 opencv: prebuilt windows, 3.4.1
I have tried rebuilding opencv4nodejs to electron.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 21 (9 by maintainers)
@justadudewhohacks it’s really amazing that you’re supporting electron so well for a library like this one. I will await the fix and start building my application in the mean time.
PS. I am scheduled to write a blog post of my endeavors with this library within a month or so, I hope that counts for something.