Upgrade to OPENRNDR 0.4 snapshot
This commit is contained in:
34
orx-jvm/orx-realsense2/src/demo/kotlin/DemoRS201.kt
Normal file
34
orx-jvm/orx-realsense2/src/demo/kotlin/DemoRS201.kt
Normal file
@@ -0,0 +1,34 @@
|
||||
import org.openrndr.application
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.draw.ColorFormat
|
||||
import org.openrndr.draw.ColorType
|
||||
import org.openrndr.draw.colorBuffer
|
||||
import org.openrndr.draw.tint
|
||||
import org.openrndr.extra.realsense2.RS2Sensor
|
||||
|
||||
suspend fun main() {
|
||||
application {
|
||||
program {
|
||||
val sensors = RS2Sensor.listSensors()
|
||||
val depthFrame = colorBuffer(640, 480, format = ColorFormat.R, type = ColorType.UINT16)
|
||||
for (sensor in sensors) {
|
||||
println(sensor)
|
||||
}
|
||||
val sensor = RS2Sensor.openFirstOrDummy()
|
||||
println(sensor)
|
||||
for (stream in sensor.streams) {
|
||||
println(stream.intrinsics)
|
||||
}
|
||||
|
||||
|
||||
sensor.depthFrameReceived.listen {
|
||||
it.copyTo(depthFrame)
|
||||
}
|
||||
extend {
|
||||
sensor.waitForFrames()
|
||||
drawer.drawStyle.colorMatrix = tint(ColorRGBa.WHITE.shade(20.0))
|
||||
drawer.image(depthFrame)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
45
orx-jvm/orx-realsense2/src/demo/kotlin/DemoRS202.kt
Normal file
45
orx-jvm/orx-realsense2/src/demo/kotlin/DemoRS202.kt
Normal file
@@ -0,0 +1,45 @@
|
||||
import org.openrndr.application
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.draw.ColorFormat
|
||||
import org.openrndr.draw.ColorType
|
||||
import org.openrndr.draw.colorBuffer
|
||||
import org.openrndr.draw.tint
|
||||
import org.openrndr.extra.realsense2.RS2Sensor
|
||||
|
||||
/**
|
||||
* show how to use multiple RealSense sensors
|
||||
*
|
||||
* Tested with two sensors, only uses depth stream now
|
||||
*/
|
||||
suspend fun main() {
|
||||
application {
|
||||
configure {
|
||||
width = 1280
|
||||
height = 720
|
||||
}
|
||||
program {
|
||||
val sensorDescriptions = RS2Sensor.listSensors()
|
||||
|
||||
val sensors = sensorDescriptions.map {
|
||||
it.open()
|
||||
}
|
||||
|
||||
val depthFrames = sensors.map {
|
||||
colorBuffer(640, 480, format = ColorFormat.R, type = ColorType.UINT16)
|
||||
}
|
||||
sensors.forEachIndexed { index, it ->
|
||||
it.depthFrameReceived.listen {
|
||||
it.copyTo(depthFrames[index])
|
||||
}
|
||||
}
|
||||
extend {
|
||||
drawer.drawStyle.colorMatrix = tint(ColorRGBa.WHITE.shade(20.0))
|
||||
for ((index, sensor) in sensors.withIndex()) {
|
||||
sensor.waitForFrames()
|
||||
drawer.image(depthFrames[index])
|
||||
drawer.translate(640.0, 0.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import org.openrndr.application
|
||||
|
||||
suspend fun main() {
|
||||
application {
|
||||
program {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user