Skip to content

Instantly share code, notes, and snippets.

@oto313
Last active April 22, 2021 11:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oto313/0576344e8bdad89f9bd68821c6b80ba5 to your computer and use it in GitHub Desktop.
Save oto313/0576344e8bdad89f9bd68821c6b80ba5 to your computer and use it in GitHub Desktop.
{
"aeLockMode": false,
"aeRegion": {
"height": 0,
"priority": 0,
"width": 0,
"x": 0,
"y": 0
},
"afRegion": {
"height": 0,
"priority": 0,
"width": 0,
"x": 0,
"y": 0
},
"antiBandingMode": 0,
"autoFocusMode": 3,
"awbLockMode": false,
"awbMode": 1,
"brightness": 0,
"chromaDenoise": 0,
"cmdMask": 256,
"contrast": 0,
"effectMode": 0,
"expCompensation": 0,
"expManual": {
"exposureTimeUs": 0,
"frameDurationUs": 0,
"sensitivityIso": 0
},
"lensPosition": 0,
"lumaDenoise": 0,
"noiseReductionStrength": 0,
"saturation": 0,
"sceneMode": 0,
"sharpness": 0
}
new (&pipeline) dai::Pipeline(std::make_shared<dai::PipelineImpl>());
color_camera = pipeline.create<dai::node::ColorCamera>();
encoder = pipeline.create<dai::node::VideoEncoder>();
video_out = pipeline.create<dai::node::XLinkOut>();
control = pipeline.create<dai::node::XLinkIn>();
control->setStreamName("ctrl");
video_out->setStreamName("h264");
color_camera->setInterleaved(true);
color_camera->setImageOrientation(dai::CameraImageOrientation::ROTATE_180_DEG);
color_camera->setBoardSocket(dai::CameraBoardSocket::RGB);
if(width > 1920 || height > 1080){
color_camera->setResolution(dai::ColorCameraProperties::SensorResolution::THE_4_K);
}else{
color_camera->setResolution(dai::ColorCameraProperties::SensorResolution::THE_1080_P);
}
color_camera->setVideoSize(width, height);
color_camera->setFps(fps);
color_camera->initialControl.setAutoWhiteBalanceMode(dai::CameraControl::AutoWhiteBalanceMode::SHADE);
encoder->setDefaultProfilePreset(width, height, fps, dai::VideoEncoderProperties::Profile::H264_MAIN);
color_camera->video.link(encoder->input);
control->out.link(color_camera->inputControl);
encoder->bitstream.link(video_out->input);
device = std::make_unique<dai::Device>(pipeline);
// device->setLogOutputLevel(dai::LogLevel::TRACE);
// device->setLogLevel(dai::LogLevel::TRACE);
queue_out = device->getOutputQueue("h264");
control_queue_in = device->getInputQueue("ctrl");
try{
device->startPipeline();
}catch (std::exception& e) {
cout << "An exception occurred. Exception Nr. " << e.what() << '\n';
return false;
}
return true;
[
1,
1,
16527326580805871264,
[
{
"connections": [
{
"node1Id": 0,
"node1Output": "video",
"node2Id": 1,
"node2Input": "in"
},
{
"node1Id": 3,
"node1Output": "out",
"node2Id": 0,
"node2Input": "inputControl"
},
{
"node1Id": 1,
"node1Output": "bitstream",
"node2Id": 2,
"node2Input": "in"
}
],
"globalProperties": {
"leonCssFrequencyHz": 700000000.0,
"leonMssFrequencyHz": 700000000.0,
"pipelineName": null,
"pipelineVersion": null
},
"nodes": [
[
0,
{
"id": 0,
"ioInfo": {
"inputConfig": {
"blocking": false,
"name": "inputConfig",
"queueSize": 8,
"type": 3
},
"inputControl": {
"blocking": true,
"name": "inputControl",
"queueSize": 8,
"type": 3
},
"preview": {
"blocking": false,
"name": "preview",
"queueSize": 8,
"type": 0
},
"still": {
"blocking": false,
"name": "still",
"queueSize": 8,
"type": 0
},
"video": {
"blocking": false,
"name": "video",
"queueSize": 8,
"type": 0
}
},
"name": "ColorCamera",
"properties": {
"boardSocket": 0,
"colorOrder": 0,
"fp16": false,
"fps": 30.0,
"imageOrientation": 3,
"initialControl": {
"aeLockMode": false,
"aeRegion": {
"height": 0,
"priority": 0,
"width": 0,
"x": 0,
"y": 0
},
"afRegion": {
"height": 0,
"priority": 0,
"width": 0,
"x": 0,
"y": 0
},
"antiBandingMode": 0,
"autoFocusMode": 3,
"awbLockMode": false,
"awbMode": 0,
"brightness": 0,
"chromaDenoise": 0,
"cmdMask": 0,
"contrast": 0,
"effectMode": 0,
"expCompensation": 0,
"expManual": {
"exposureTimeUs": 0,
"frameDurationUs": 0,
"sensitivityIso": 0
},
"lensPosition": 0,
"lumaDenoise": 0,
"noiseReductionStrength": 0,
"saturation": 0,
"sceneMode": 0,
"sharpness": 0
},
"inputConfigSync": false,
"interleaved": true,
"previewHeight": 300,
"previewKeepAspectRatio": true,
"previewWidth": 300,
"resolution": 0,
"sensorCropX": -1.0,
"sensorCropY": -1.0,
"stillHeight": -1,
"stillWidth": -1,
"videoHeight": 1080,
"videoWidth": 1920
}
}
],
[
1,
{
"id": 1,
"ioInfo": {
"bitstream": {
"blocking": false,
"name": "bitstream",
"queueSize": 8,
"type": 0
},
"in": {
"blocking": true,
"name": "in",
"queueSize": 4,
"type": 3
}
},
"name": "VideoEncoder",
"properties": {
"bitrate": 8500000,
"frameRate": 30.0,
"height": 1080,
"keyframeFrequency": 30,
"maxBitrate": 8500000,
"numBFrames": 0,
"numFramesPool": 4,
"profile": 2,
"quality": 80,
"rateCtrlMode": 0,
"width": 1920
}
}
],
[
2,
{
"id": 2,
"ioInfo": {
"in": {
"blocking": true,
"name": "in",
"queueSize": 8,
"type": 3
}
},
"name": "XLinkOut",
"properties": {
"maxFpsLimit": -1.0,
"metadataOnly": false,
"streamName": "h264"
}
}
],
[
3,
{
"id": 3,
"ioInfo": {
"out": {
"blocking": false,
"name": "out",
"queueSize": 8,
"type": 0
}
},
"name": "XLinkIn",
"properties": {
"maxDataSize": 5242880,
"numFrames": 8,
"streamName": "control"
}
}
]
]
}
]
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment