justadudewhohacks / justadudewhohacks/opencv4nodejs

Convert frame to Mat

Open
#728 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
5.1k
Forks
826
PR merge metrics
No merged PRs in 30d

Description

Required Info |  
-- | --
Camera Model | D435i
Firmware Version | 5.12.3.0
Operating System & Version | Win 10
Platform | PC
SDK Version | 2.34.0
Language | nodejs
Segment | Robot

**Issue Description**

Cannot get image in OpenCV format (cv.Mat). I'm following example on opencv-wrapper. When I'm running the code below I'm getting a black screen.

```
const rs2 = require('node-librealsense');
const cv = require('opencv4nodejs');

const colorizer = new rs2.Colorizer(); // This will make depth image pretty
const pipeline = new rs2.Pipeline(); // Main work pipeline of RealSense camera
pipeline.start(); // Start camera

const frameset = pipeline.waitForFrames();
const color = frameset.colorFrame; // Get RGB image

const matFromArray = new cv.Mat(color.height, color.width, cv.CV_8UC3 , color.getData());

cv.imshow('pic', matFromArray);

cv.waitKey(0);
rs2.cleanup();
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.