[orx-runway] Add BASNet, PersonSegmentation, U-2-Net presets
This commit is contained in:
committed by
Edwin Jakobs
parent
4a24cb5fea
commit
555ec41530
26
orx-runway/src/demo/kotlin/DemoBASNet.kt
Normal file
26
orx-runway/src/demo/kotlin/DemoBASNet.kt
Normal file
@@ -0,0 +1,26 @@
|
||||
import org.openrndr.application
|
||||
import org.openrndr.draw.*
|
||||
import org.openrndr.extra.runway.*
|
||||
|
||||
/**
|
||||
* This example requires a `runway/BASNet` model to be active in Runway.
|
||||
*/
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 331
|
||||
height = 400
|
||||
}
|
||||
|
||||
program {
|
||||
val image = loadImage("demo-data/images/life-cover.jpg")
|
||||
|
||||
val result: BASNETResult =
|
||||
runwayQuery("http://localhost:8000/query", BASNETRequest(image.toData()))
|
||||
|
||||
val segmentImage = ColorBuffer.fromData(result.image)
|
||||
|
||||
extend {
|
||||
drawer.image(segmentImage, 0.0, 0.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
26
orx-runway/src/demo/kotlin/DemoPersonSegmentation.kt
Normal file
26
orx-runway/src/demo/kotlin/DemoPersonSegmentation.kt
Normal file
@@ -0,0 +1,26 @@
|
||||
import org.openrndr.application
|
||||
import org.openrndr.draw.*
|
||||
import org.openrndr.extra.runway.*
|
||||
|
||||
/**
|
||||
* This example requires a `runway/Person-Segmentation` model to be active in Runway.
|
||||
*/
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 331
|
||||
height = 400
|
||||
}
|
||||
|
||||
program {
|
||||
val image = loadImage("demo-data/images/life-cover.jpg")
|
||||
|
||||
val result: PersonSegmentationResult =
|
||||
runwayQuery("http://localhost:8000/query", PersonSegmentationRequest(image.toData(), 0.2))
|
||||
|
||||
val segmentImage = ColorBuffer.fromData(result.image)
|
||||
|
||||
extend {
|
||||
drawer.image(segmentImage, 0.0, 0.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
26
orx-runway/src/demo/kotlin/DemoU2Net.kt
Normal file
26
orx-runway/src/demo/kotlin/DemoU2Net.kt
Normal file
@@ -0,0 +1,26 @@
|
||||
import org.openrndr.application
|
||||
import org.openrndr.draw.*
|
||||
import org.openrndr.extra.runway.*
|
||||
|
||||
/**
|
||||
* This example requires a `runway/U-2-Net` model to be active in Runway.
|
||||
*/
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 305
|
||||
height = 400
|
||||
}
|
||||
|
||||
program {
|
||||
val image = loadImage("demo-data/images/vw-beetle.jpg")
|
||||
|
||||
val result: U2NetResult =
|
||||
runwayQuery("http://localhost:8000/query", U2NetRequest(image.toData()))
|
||||
|
||||
val segmentImage = ColorBuffer.fromData(result.image)
|
||||
|
||||
extend {
|
||||
drawer.image(segmentImage, 0.0, 0.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user