-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
RealSenseFrameGrabber.java
915 lines (772 loc) · 28.6 KB
/
RealSenseFrameGrabber.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
/*
* Copyright (C) 2014 Jeremy Laviole, Samuel Audet
*
* Licensed either under the Apache License, Version 2.0, or (at your option)
* under the terms of the GNU General Public License as published by
* the Free Software Foundation (subject to the "Classpath" exception),
* either version 2, or any later version (collectively, the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.gnu.org/licenses/
* http://www.gnu.org/software/classpath/license.html
*
* or as provided in the LICENSE.txt file that accompanied this code.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.bytedeco.javacv;
import java.io.File;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.ShortBuffer;
import org.bytedeco.javacpp.BytePointer;
import org.bytedeco.javacpp.Loader;
import org.bytedeco.javacpp.Pointer;
import org.bytedeco.javacpp.RealSense;
import org.bytedeco.javacpp.RealSense.context;
import org.bytedeco.javacpp.RealSense.device;
import static org.bytedeco.javacpp.opencv_core.*;
import static org.bytedeco.javacpp.opencv_imgproc.*;
/**
*
* @author Jeremy Laviole
*/
public class RealSenseFrameGrabber extends FrameGrabber {
public static String[] getDeviceDescriptions() throws FrameGrabber.Exception {
tryLoad();
String[] desc = new String[1];
desc[0] = "No description yet.";
return desc;
}
public static int DEFAULT_DEPTH_WIDTH = 640;
public static int DEFAULT_DEPTH_HEIGHT = 480;
public static int DEFAULT_COLOR_WIDTH = 1280;
public static int DEFAULT_COLOR_HEIGHT = 720;
public static int DEFAULT_COLOR_FRAMERATE = 30;
private ByteOrder byteOrder = ByteOrder.BIG_ENDIAN;
private int depthImageWidth = DEFAULT_DEPTH_WIDTH;
private int depthImageHeight = DEFAULT_DEPTH_HEIGHT;
private int depthFrameRate = 30;
private int IRImageWidth = DEFAULT_DEPTH_WIDTH;
private int IRImageHeight = DEFAULT_DEPTH_HEIGHT;
private int IRFrameRate = 30;
public ByteOrder getByteOrder() {
return byteOrder;
}
public void setByteOrder(ByteOrder byteOrder) {
this.byteOrder = byteOrder;
}
public static RealSenseFrameGrabber createDefault(int deviceNumber) throws FrameGrabber.Exception {
return new RealSenseFrameGrabber(deviceNumber);
}
public static RealSenseFrameGrabber createDefault(File deviceFile) throws Exception {
throw new Exception(RealSenseFrameGrabber.class + " does not support File devices.");
}
public static RealSenseFrameGrabber createDefault(String devicePath) throws Exception {
throw new Exception(RealSenseFrameGrabber.class + " does not support path.");
}
private static FrameGrabber.Exception loadingException = null;
public static void tryLoad() throws FrameGrabber.Exception {
if (loadingException != null) {
loadingException.printStackTrace();
throw loadingException;
} else {
try {
if (context != null) {
return;
}
Loader.load(org.bytedeco.javacpp.RealSense.class);
// Context is shared accross cameras.
context = new context();
System.out.println("RealSense devices found: " + context.get_device_count());
} catch (Throwable t) {
throw loadingException = new FrameGrabber.Exception("Failed to load " + RealSenseFrameGrabber.class, t);
}
}
}
private static context context;
private final device device;
private boolean depth = false; // default to "video"
private boolean colorEnabled = false;
private boolean depthEnabled = false;
private boolean IREnabled = false;
private FrameConverter converter = new OpenCVFrameConverter.ToIplImage();
public RealSenseFrameGrabber(int deviceNumber) {
if (context == null || context.get_device_count() <= deviceNumber) {
System.out.println("FATAL error: Realsense camera: " + deviceNumber + " not connected/found");
System.exit(-1);
}
device = context.get_device(deviceNumber);
}
public static void main(String[] args) {
context context = new context();
System.out.println("Devices found: " + context.get_device_count());
device device = context.get_device(0);
System.out.println("Using device 0, an " + device.get_name());
System.out.println(" Serial number: " + device.get_serial());
}
public void enableColorStream() {
if (!colorEnabled) {
if (imageWidth == 0) {
imageWidth = DEFAULT_COLOR_WIDTH;
}
if (imageHeight == 0) {
imageHeight = DEFAULT_COLOR_HEIGHT;
}
if (frameRate == 0) {
frameRate = DEFAULT_COLOR_FRAMERATE;
}
device.enable_stream(RealSense.color, imageWidth, imageHeight, RealSense.rgb8, (int) frameRate);
colorEnabled = true;
}
}
public void disableColorStream() {
if (colorEnabled) {
device.disable_stream(RealSense.color);
colorEnabled = false;
}
}
public void enableDepthStream() {
if (!depthEnabled) {
device.enable_stream(RealSense.depth, depthImageWidth, depthImageHeight, RealSense.z16, depthFrameRate);
depthEnabled = true;
}
}
public void disableDepthStream() {
if (depthEnabled) {
device.disable_stream(RealSense.depth);
depthEnabled = false;
}
}
public void enableIRStream() {
if (!IREnabled) {
device.enable_stream(RealSense.infrared, IRImageWidth, IRImageHeight, RealSense.y8, IRFrameRate);
IREnabled = true;
}
}
public void disableIRStream() {
if (IREnabled) {
device.disable_stream(RealSense.infrared);
IREnabled = false;
}
}
public void release() throws FrameGrabber.Exception {
}
@Override
protected void finalize() throws Throwable {
super.finalize();
release();
}
/**
* Warning can lead to unsafe situations.
*
* @return
*/
public device getRealSenseDevice() {
return this.device;
}
public float getDepthScale() {
return device.get_depth_scale();
}
@Override
public double getFrameRate() { // TODO: check this.
return super.getFrameRate();
}
private boolean startedOnce = false;
private boolean behaveAsColorFrameGrabber = false;
@Override
public void start() throws FrameGrabber.Exception {
// if no stream is select, just get the color.
if (!colorEnabled && !IREnabled && !depthEnabled) {
if (!startedOnce) {
enableColorStream();
behaveAsColorFrameGrabber = true;
this.setImageMode(ImageMode.GRAY);
}
}
startedOnce = true;
device.start();
}
/**
*
* @throws Exception
*/
@Override
public void stop() throws FrameGrabber.Exception {
device.stop();
colorEnabled = false;
IREnabled = false;
depthEnabled = false;
frameNumber = 0;
}
private Pointer rawDepthImageData = new Pointer((Pointer) null),
rawVideoImageData = new Pointer((Pointer) null),
rawIRImageData = new Pointer((Pointer) null);
private IplImage rawDepthImage = null, rawVideoImage = null, rawIRImage = null, returnImage = null;
public IplImage grabDepth() {
if (!depthEnabled) {
System.out.println("Depth stream not enabled, impossible to get the image.");
return null;
}
rawDepthImageData = device.get_frame_data(RealSense.depth);
// ShortBuffer bb = data.position(0).limit(640 * 480 * 2).asByteBuffer().asShortBuffer();
int iplDepth = IPL_DEPTH_16S, channels = 1;
int deviceWidth = device.get_stream_width(RealSense.depth);
int deviceHeight = device.get_stream_height(RealSense.depth);
// AUTOMATIC
// int deviceWidth = 0;
// int deviceHeight = 0;
if (rawDepthImage == null || rawDepthImage.width() != deviceWidth || rawDepthImage.height() != deviceHeight) {
rawDepthImage = IplImage.createHeader(deviceWidth, deviceHeight, iplDepth, channels);
}
cvSetData(rawDepthImage, rawDepthImageData, deviceWidth * channels * iplDepth / 8);
if (iplDepth > 8 && !ByteOrder.nativeOrder().equals(byteOrder)) {
// ack, the camera's endianness doesn't correspond to our machine ...
// swap bytes of 16-bit images
ByteBuffer bb = rawDepthImage.getByteBuffer();
ShortBuffer in = bb.order(ByteOrder.BIG_ENDIAN).asShortBuffer();
ShortBuffer out = bb.order(ByteOrder.LITTLE_ENDIAN).asShortBuffer();
out.put(in);
}
return rawDepthImage;
}
public IplImage grabVideo() {
if (!colorEnabled) {
System.out.println("Color stream not enabled, impossible to get the image.");
return null;
}
int iplDepth = IPL_DEPTH_8U, channels = 3;
rawVideoImageData = device.get_frame_data(RealSense.color);
int deviceWidth = device.get_stream_width(RealSense.color);
int deviceHeight = device.get_stream_height(RealSense.color);
if (rawVideoImage == null || rawVideoImage.width() != deviceWidth || rawVideoImage.height() != deviceHeight) {
rawVideoImage = IplImage.createHeader(deviceWidth, deviceHeight, iplDepth, channels);
}
cvSetData(rawVideoImage, rawVideoImageData, deviceWidth * channels * iplDepth / 8);
// if (iplDepth > 8 && !ByteOrder.nativeOrder().equals(byteOrder)) {
// // ack, the camera's endianness doesn't correspond to our machine ...
// // swap bytes of 16-bit images
// ByteBuffer bb = rawVideoImage.getByteBuffer();
// ShortBuffer in = bb.order(ByteOrder.BIG_ENDIAN).asShortBuffer();
// ShortBuffer out = bb.order(ByteOrder.LITTLE_ENDIAN).asShortBuffer();
// out.put(in);
// }
// if (channels == 3) {
// cvCvtColor(rawVideoImage, rawVideoImage, CV_BGR2RGB);
// }
return rawVideoImage;
}
public IplImage grabIR() {
if (!IREnabled) {
System.out.println("IR stream not enabled, impossible to get the image.");
return null;
}
int iplDepth = IPL_DEPTH_8U, channels = 1;
rawIRImageData = device.get_frame_data(RealSense.infrared);
int deviceWidth = device.get_stream_width(RealSense.infrared);
int deviceHeight = device.get_stream_height(RealSense.infrared);
if (rawIRImage == null || rawIRImage.width() != deviceWidth || rawIRImage.height() != deviceHeight) {
rawIRImage = IplImage.createHeader(deviceWidth, deviceHeight, iplDepth, channels);
}
cvSetData(rawIRImage, rawIRImageData, deviceWidth * channels * iplDepth / 8);
// if (iplDepth > 8 && !ByteOrder.nativeOrder().equals(byteOrder)) {
// // ack, the camera's endianness doesn't correspond to our machine ...
// // swap bytes of 16-bit images
// ByteBuffer bb = rawIRImage.getByteBuffer();
// ShortBuffer in = bb.order(ByteOrder.BIG_ENDIAN).asShortBuffer();
// ShortBuffer out = bb.order(ByteOrder.LITTLE_ENDIAN).asShortBuffer();
// out.put(in);
// }
return rawIRImage;
}
/**
*
* @return null grabs all images, get them with grabColor, grabDepth, and
* grabIR instead.
* @throws org.bytedeco.javacv.FrameGrabber.Exception
*/
public Frame grab() throws Exception {
device.wait_for_frames();
// frameNumber++;
// For Framegrabber
if (colorEnabled && behaveAsColorFrameGrabber) {
IplImage image = grabVideo();
if (returnImage == null) {
int deviceWidth = device.get_stream_width(RealSense.color);
int deviceHeight = device.get_stream_height(RealSense.color);
// returnImage = IplImage.create(deviceWidth, deviceHeight, IPL_DEPTH_8U, 3);
returnImage = IplImage.create(deviceWidth, deviceHeight, IPL_DEPTH_8U, 1);
}
cvCvtColor(image, returnImage, CV_BGR2GRAY);
return converter.convert(returnImage);
}
return null;
}
@Override
public void trigger() throws Exception {
device.wait_for_frames();
}
public int getDepthImageWidth() {
return depthImageWidth;
}
public void setDepthImageWidth(int depthImageWidth) {
this.depthImageWidth = depthImageWidth;
}
public int getDepthImageHeight() {
return depthImageHeight;
}
public void setDepthImageHeight(int depthImageHeight) {
this.depthImageHeight = depthImageHeight;
}
public int getIRImageWidth() {
return IRImageWidth;
}
public void setIRImageWidth(int IRImageWidth) {
this.IRImageWidth = IRImageWidth;
}
public int getIRImageHeight() {
return IRImageHeight;
}
public void setIRImageHeight(int IRImageHeight) {
this.IRImageHeight = IRImageHeight;
}
public int getDepthFrameRate() {
return depthFrameRate;
}
public void setDepthFrameRate(int frameRate) {
this.depthFrameRate = frameRate;
}
public int getIRFrameRate() {
return IRFrameRate;
}
public void setIRFrameRate(int IRFrameRate) {
this.IRFrameRate = IRFrameRate;
}
@Override
public double getGamma() {
// I guess a default gamma of 2.2 is reasonable...
if (gamma == 0.0) {
return 2.2;
} else {
return gamma;
}
}
// Gamma from the device is not good.
// @Override
// public double getGamma(){
// double gamma = device.get_option(RealSense.RS_OPTION_COLOR_GAMMA);
// System.out.println("Getting cameraGamma " + gamma);
// return gamma;
// }
// --- Presets ---
public void setPreset(int preset) {
/* Provide access to several recommend sets of option presets for ivcam */
RealSense.apply_ivcam_preset(device, preset);
}
public void setShortRange() {
setPreset(RealSense.RS_IVCAM_PRESET_SHORT_RANGE);
}
public void setLongRange() {
setPreset(RealSense.RS_IVCAM_PRESET_LONG_RANGE);
}
public void setMidRange() {
setPreset(RealSense.RS_IVCAM_PRESET_MID_RANGE);
}
public void setDefaultPreset() {
setPreset(RealSense.RS_IVCAM_PRESET_DEFAULT);
}
public void setObjectScanningPreset() {
setPreset(RealSense.RS_IVCAM_PRESET_OBJECT_SCANNING);
}
public void setCursorPreset() {
setPreset(RealSense.RS_IVCAM_PRESET_GR_CURSOR);
}
public void setGestureRecognitionPreset() {
setPreset(RealSense.RS_IVCAM_PRESET_GESTURE_RECOGNITION);
}
public void setBackgroundSegmentationPreset() {
setPreset(RealSense.RS_IVCAM_PRESET_BACKGROUND_SEGMENTATION);
}
public void setIROnlyPreset() {
setPreset(RealSense.RS_IVCAM_PRESET_IR_ONLY);
}
// ---- Options ----
public void setOption(int option, int value) {
device.set_option(option, value);
}
/**
* Enable / disable color backlight compensation
*/
public void set(int value) {
setOption(RealSense.RS_OPTION_COLOR_BACKLIGHT_COMPENSATION, value);
}
/**
* Color image brightness
*/
public void setColorBrightness(int value) {
setOption(RealSense.RS_OPTION_COLOR_BRIGHTNESS, value);
}
/**
* COLOR image contrast
*/
public void setColorContrast(int value) {
setOption(RealSense.RS_OPTION_COLOR_CONTRAST, value);
}
/**
* Controls exposure time of color camera. Setting any value will disable
* auto exposure
*/
public void setColorExposure(int value) {
setOption(RealSense.RS_OPTION_COLOR_EXPOSURE, value);
}
/**
* Color image gain
*/
public void setColorGain(int value) {
setOption(RealSense.RS_OPTION_COLOR_GAIN, value);
}
/**
* Color image gamma setting
*/
public void setColorGamma(int value) {
setOption(RealSense.RS_OPTION_COLOR_GAMMA, value);
}
/**
* Color image hue
*/
public void setColorHue(int value) {
setOption(RealSense.RS_OPTION_COLOR_HUE, value);
}
/**
* Color image saturation setting
*/
public void setColorSaturation(int value) {
setOption(RealSense.RS_OPTION_COLOR_SATURATION, value);
}
/**
* Color image sharpness setting
*/
public void setColorSharpness(int value) {
setOption(RealSense.RS_OPTION_COLOR_SHARPNESS, value);
}
/**
* Controls white balance of color image. Setting any value will disable
* auto white balance
*/
public void setColorWhiteBalance(int value) {
setOption(RealSense.RS_OPTION_COLOR_WHITE_BALANCE, value);
}
/**
* Enable / disable color image auto-exposure
*/
public void setColorEnableAutoExposure(int value) {
setOption(RealSense.RS_OPTION_COLOR_ENABLE_AUTO_EXPOSURE, value);
}
/**
* Enable / disable color image auto-white-balance
*/
public void setColorEnableAutoWhiteBalance(int value) {
setOption(RealSense.RS_OPTION_COLOR_ENABLE_AUTO_WHITE_BALANCE, value);
}
/**
* Power of the F200 / SR300 projector, with 0 meaning projector off
*/
public void setLaserPower(int value) {
setOption(RealSense.RS_OPTION_F200_LASER_POWER, value);
}
/**
* Set the number of patterns projected per frame. The higher the accuracy
* value the more patterns projected. Increasing the number of patterns help
* to achieve better accuracy. Note that this control is affecting the Depth
* FPS
*/
public void setAccuracy(int value) {
setOption(RealSense.RS_OPTION_F200_ACCURACY, value);
}
/**
* Motion vs. Range trade-off, with lower values allowing for better motion
* sensitivity and higher values allowing for better depth range
*/
public void setMotionRange(int value) {
setOption(RealSense.RS_OPTION_F200_MOTION_RANGE, value);
}
/**
* Set the filter to apply to each depth frame. Each one of the filter is
* optimized per the application requirements
*/
public void setFilterOption(int value) {
setOption(RealSense.RS_OPTION_F200_FILTER_OPTION, value);
}
/**
* The confidence level threshold used by the Depth algorithm pipe to set
* whether a pixel will get a valid range or will be marked with invalid
* range
*/
public void setConfidenceThreshold(int value) {
setOption(RealSense.RS_OPTION_F200_CONFIDENCE_THRESHOLD, value);
}
/**
* (F200-only) Allows to reduce FPS without restarting streaming. Valid
* values are {2, 5, 15, 30, 60}
*/
public void setDynamicFPS(int value) {
setOption(RealSense.RS_OPTION_F200_DYNAMIC_FPS, value);
}
/**
* Enables / disables R200 auto-exposure. This will affect both IR and depth
* image.
*/
public void setLR_AutoExposureEnabled(int value) {
setOption(RealSense.RS_OPTION_R200_LR_AUTO_EXPOSURE_ENABLED, value);
}
/**
* IR image gain
*/
public void setLR_Gain(int value) {
setOption(RealSense.RS_OPTION_R200_LR_GAIN, value);
}
/**
* This control allows manual adjustment of the exposure time value for the
* L/R imagers
*/
public void setLR_Exposure(int value) {
setOption(RealSense.RS_OPTION_R200_LR_EXPOSURE, value);
}
/**
* Enables / disables R200 emitter
*/
public void setEmitterEnabled(int value) {
setOption(RealSense.RS_OPTION_R200_EMITTER_ENABLED, value);
}
/**
* Micrometers per increment in integer depth values, 1000 is default (mm
* scale). Set before streaming
*/
public void setDepthUnits(int value) {
setOption(RealSense.RS_OPTION_R200_DEPTH_UNITS, value);
}
/**
* Minimum depth in current depth units that will be output. Any values less
* than �Min Depth� will be mapped to 0 during the conversion between
* disparity and depth. Set before streaming
*/
public void setDepthClampMin(int value) {
setOption(RealSense.RS_OPTION_R200_DEPTH_CLAMP_MIN, value);
}
/**
* Maximum depth in current depth units that will be output. Any values
* greater than �Max Depth� will be mapped to 0 during the conversion
* between disparity and depth. Set before streaming
*/
public void setDepthClampMax(int value) {
setOption(RealSense.RS_OPTION_R200_DEPTH_CLAMP_MAX, value);
}
/**
* The disparity scale factor used when in disparity output mode. Can only
* be set before streaming
*/
public void setDisparityMultiplier(int value) {
setOption(RealSense.RS_OPTION_R200_DISPARITY_MULTIPLIER, value);
}
/**
* {0 - 512}. Can only be set before streaming starts
*/
public void setDisparityShift(int value) {
setOption(RealSense.RS_OPTION_R200_DISPARITY_SHIFT, value);
}
/**
* (Requires LR-Auto-Exposure ON) Mean intensity set point
*/
public void setAutoExposureMeanIntensitySetPoint(int value) {
setOption(RealSense.RS_OPTION_R200_AUTO_EXPOSURE_MEAN_INTENSITY_SET_POINT, value);
}
/**
* (Requires LR-Auto-Exposure ON) Bright ratio set point
*/
public void setAutoExposureBrightRatioSetPoint(int value) {
setOption(RealSense.RS_OPTION_R200_AUTO_EXPOSURE_BRIGHT_RATIO_SET_POINT, value);
}
/**
* (Requires LR-Auto-Exposure ON) Kp Gain
*/
public void setAutoExposureKpGain(int value) {
setOption(RealSense.RS_OPTION_R200_AUTO_EXPOSURE_KP_GAIN, value);
}
/**
* (Requires LR-Auto-Exposure ON) Kp Exposure
*/
public void setAutoExposureKpExposure(int value) {
setOption(RealSense.RS_OPTION_R200_AUTO_EXPOSURE_KP_EXPOSURE, value);
}
/**
* (Requires LR-Auto-Exposure ON) Kp Dark Threshold
*/
public void setAutoExposureKpDarkThreshold(int value) {
setOption(RealSense.RS_OPTION_R200_AUTO_EXPOSURE_KP_DARK_THRESHOLD, value);
}
/**
* (Requires LR-Auto-Exposure ON) Auto-Exposure region-of-interest top edge
* (in pixels)
*/
public void setAutoExposureTopEdge(int value) {
setOption(RealSense.RS_OPTION_R200_AUTO_EXPOSURE_TOP_EDGE, value);
}
/**
* (Requires LR-Auto-Exposure ON) Auto-Exposure region-of-interest bottom
* edge (in pixels)
*/
public void setAutoExposureBottomEdge(int value) {
setOption(RealSense.RS_OPTION_R200_AUTO_EXPOSURE_BOTTOM_EDGE, value);
}
/**
* (Requires LR-Auto-Exposure ON) Auto-Exposure region-of-interest left edge
* (in pixels)
*/
public void setAutoExposureLeftEdge(int value) {
setOption(RealSense.RS_OPTION_R200_AUTO_EXPOSURE_LEFT_EDGE, value);
}
/**
* (Requires LR-Auto-Exposure ON) Auto-Exposure region-of-interest right
* edge (in pixels)
*/
public void setAutoExposureRightEdge(int value) {
setOption(RealSense.RS_OPTION_R200_AUTO_EXPOSURE_RIGHT_EDGE, value);
}
/**
* Value to subtract when estimating the median of the correlation surface
*/
public void setDepthControlEstimateMedianDecrement(int value) {
setOption(RealSense.RS_OPTION_R200_DEPTH_CONTROL_ESTIMATE_MEDIAN_DECREMENT, value);
}
/**
* Value to add when estimating the median of the correlation surface
*/
public void setDepthControlEstimateMedianIncrement(int value) {
setOption(RealSense.RS_OPTION_R200_DEPTH_CONTROL_ESTIMATE_MEDIAN_INCREMENT, value);
}
/**
* A threshold by how much the winning score must beat the median
*/
public void setDepthControlMedianThreshold(int value) {
setOption(RealSense.RS_OPTION_R200_DEPTH_CONTROL_MEDIAN_THRESHOLD, value);
}
/**
* The minimum correlation score that is considered acceptable
*/
public void setDepthControlMinimumThreshold(int value) {
setOption(RealSense.RS_OPTION_R200_DEPTH_CONTROL_SCORE_MINIMUM_THRESHOLD, value);
}
/**
* The maximum correlation score that is considered acceptable
*/
public void setDepthControlScoreMaximumThreshold(int value) {
setOption(RealSense.RS_OPTION_R200_DEPTH_CONTROL_SCORE_MAXIMUM_THRESHOLD, value);
}
/**
* A parameter for determining whether the texture in the region is
* sufficient to justify a depth result
*/
public void setDepthControlTextureCountThreshold(int value) {
setOption(RealSense.RS_OPTION_R200_DEPTH_CONTROL_TEXTURE_COUNT_THRESHOLD, value);
}
/**
* A parameter for determining whether the texture in the region is
* sufficient to justify a depth result
*/
public void setDepthControlTextureDifference(int value) {
setOption(RealSense.RS_OPTION_R200_DEPTH_CONTROL_TEXTURE_DIFFERENCE_THRESHOLD, value);
}
/**
* A threshold on how much the minimum correlation score must differ from
* the next best score
*/
public void setDepthControlSecondPeakThreshold(int value) {
setOption(RealSense.RS_OPTION_R200_DEPTH_CONTROL_SECOND_PEAK_THRESHOLD, value);
}
/**
* Neighbor threshold value for depth calculation
*/
public void setDepthControlNeighborThreshold(int value) {
setOption(RealSense.RS_OPTION_R200_DEPTH_CONTROL_NEIGHBOR_THRESHOLD, value);
}
/**
* Left-Right threshold value for depth calculation
*/
public void setDepthControlLRThreshold(int value) {
setOption(RealSense.RS_OPTION_R200_DEPTH_CONTROL_LR_THRESHOLD, value);
}
/**
* Fisheye image exposure time in msec
*/
public void setFisheyeExposure(int value) {
setOption(RealSense.RS_OPTION_FISHEYE_EXPOSURE, value);
}
/**
* Fisheye image gain
*/
public void setFisheyeGain(int value) {
setOption(RealSense.RS_OPTION_FISHEYE_GAIN, value);
}
/**
* Enables / disables fisheye strobe. When enabled this will align
* timestamps to common clock-domain with the motion events
*/
public void setFisheyeStobe(int value) {
setOption(RealSense.RS_OPTION_FISHEYE_STROBE, value);
}
/**
* Enables / disables fisheye external trigger mode. When enabled fisheye
* image will be aquired in-sync with the depth image
*/
public void setFisheyeExternalTrigger(int value) {
setOption(RealSense.RS_OPTION_FISHEYE_EXTERNAL_TRIGGER, value);
}
/**
* Enable / disable fisheye auto-exposure
*/
public void setFisheyeEnableAutoExposure(int value) {
setOption(RealSense.RS_OPTION_FISHEYE_ENABLE_AUTO_EXPOSURE, value);
}
/**
* 0 - static auto-exposure, 1 - anti-flicker auto-exposure, 2 - hybrid
*/
public void setFisheyeAutoExposureMode(int value) {
setOption(RealSense.RS_OPTION_FISHEYE_AUTO_EXPOSURE_MODE, value);
}
/**
* Fisheye auto-exposure anti-flicker rate, can be 50 or 60 Hz
*/
public void setFisheyeAutoExposureAntiflickerRate(int value) {
setOption(RealSense.RS_OPTION_FISHEYE_AUTO_EXPOSURE_ANTIFLICKER_RATE, value);
}
/**
* In Fisheye auto-exposure sample frame every given number of pixels
*/
public void setFisheyeAutoExposurePixelSampleRate(int value) {
setOption(RealSense.RS_OPTION_FISHEYE_AUTO_EXPOSURE_PIXEL_SAMPLE_RATE, value);
}
/**
* In Fisheye auto-exposure sample every given number of frames
*/
public void setFisheyeAutoExposureSkipFrames(int value) {
setOption(RealSense.RS_OPTION_FISHEYE_AUTO_EXPOSURE_SKIP_FRAMES, value);
}
/**
* Number of frames the user is allowed to keep per stream. Trying to
* hold-on to more frames will cause frame-drops.
*/
public void setFramesQueueSize(int value) {
setOption(RealSense.RS_OPTION_FRAMES_QUEUE_SIZE, value);
}
/**
* Enable / disable fetching log data from the device
*/
public void setHardwareLoggerEnabled(int value) {
setOption(RealSense.RS_OPTION_HARDWARE_LOGGER_ENABLED, value);
}
}