Publish video frames
@ -4,6 +4,7 @@ import (
|
|||||||
"flag"
|
"flag"
|
||||||
"github.com/cyrilix/robocar-base/cli"
|
"github.com/cyrilix/robocar-base/cli"
|
||||||
"github.com/cyrilix/robocar-display/part"
|
"github.com/cyrilix/robocar-display/part"
|
||||||
|
"github.com/cyrilix/robocar-display/video"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
@ -14,6 +15,8 @@ const (
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
var mqttBroker, username, password, clientId string
|
var mqttBroker, username, password, clientId string
|
||||||
|
var framePath string
|
||||||
|
var fps int
|
||||||
var frameTopic, objectsTopic, roadTopic string
|
var frameTopic, objectsTopic, roadTopic string
|
||||||
var withObjects, withRoad bool
|
var withObjects, withRoad bool
|
||||||
|
|
||||||
@ -23,6 +26,8 @@ func main() {
|
|||||||
cli.InitMqttFlags(DefaultClientId, &mqttBroker, &username, &password, &clientId, &mqttQos, &mqttRetain)
|
cli.InitMqttFlags(DefaultClientId, &mqttBroker, &username, &password, &clientId, &mqttQos, &mqttRetain)
|
||||||
|
|
||||||
flag.StringVar(&frameTopic, "mqtt-topic-frame", os.Getenv("MQTT_TOPIC_FRAME"), "Mqtt topic that contains frame to display, use MQTT_TOPIC_FRAME if args not set")
|
flag.StringVar(&frameTopic, "mqtt-topic-frame", os.Getenv("MQTT_TOPIC_FRAME"), "Mqtt topic that contains frame to display, use MQTT_TOPIC_FRAME if args not set")
|
||||||
|
flag.StringVar(&framePath, "frame-path", "", "Directory path where to read jpeg frame to inject in frame topic")
|
||||||
|
flag.IntVar(&fps, "frame-per-second", 25, "Video frame per second of frame to publish")
|
||||||
|
|
||||||
flag.StringVar(&objectsTopic, "mqtt-topic-objects", os.Getenv("MQTT_TOPIC_OBJECTS"), "Mqtt topic that contains detected objects, use MQTT_TOPIC_OBJECTS if args not set")
|
flag.StringVar(&objectsTopic, "mqtt-topic-objects", os.Getenv("MQTT_TOPIC_OBJECTS"), "Mqtt topic that contains detected objects, use MQTT_TOPIC_OBJECTS if args not set")
|
||||||
flag.BoolVar(&withObjects, "with-objects", false, "Display detected objects")
|
flag.BoolVar(&withObjects, "with-objects", false, "Display detected objects")
|
||||||
@ -42,6 +47,17 @@ func main() {
|
|||||||
}
|
}
|
||||||
defer client.Disconnect(50)
|
defer client.Disconnect(50)
|
||||||
|
|
||||||
|
if framePath != "" {
|
||||||
|
camera, err := video.NewCameraFake(client, frameTopic, framePath, fps)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("unable to load fake camera: %v", err)
|
||||||
|
}
|
||||||
|
if err = camera.Start(); err != nil {
|
||||||
|
log.Fatalf("unable to start fake camera: %v", err)
|
||||||
|
}
|
||||||
|
defer camera.Stop()
|
||||||
|
}
|
||||||
|
|
||||||
p := part.NewPart(client, frameTopic,
|
p := part.NewPart(client, frameTopic,
|
||||||
objectsTopic, roadTopic,
|
objectsTopic, roadTopic,
|
||||||
withObjects, withRoad )
|
withObjects, withRoad )
|
||||||
|
BIN
video/testdata/video/image_array_000000001.jpg
vendored
Normal file
After Width: | Height: | Size: 5.0 KiB |
BIN
video/testdata/video/image_array_000000002.jpg
vendored
Normal file
After Width: | Height: | Size: 5.0 KiB |
BIN
video/testdata/video/image_array_000000003.jpg
vendored
Normal file
After Width: | Height: | Size: 5.0 KiB |
BIN
video/testdata/video/image_array_000000004.jpg
vendored
Normal file
After Width: | Height: | Size: 5.0 KiB |
BIN
video/testdata/video/image_array_000000005.jpg
vendored
Normal file
After Width: | Height: | Size: 5.0 KiB |
BIN
video/testdata/video/image_array_000000006.jpg
vendored
Normal file
After Width: | Height: | Size: 5.0 KiB |
BIN
video/testdata/video/image_array_000000007.jpg
vendored
Normal file
After Width: | Height: | Size: 5.0 KiB |
BIN
video/testdata/video/image_array_000000008.jpg
vendored
Normal file
After Width: | Height: | Size: 5.0 KiB |
BIN
video/testdata/video/image_array_000000009.jpg
vendored
Normal file
After Width: | Height: | Size: 4.8 KiB |
BIN
video/testdata/video/image_array_000000010.jpg
vendored
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
video/testdata/video/image_array_000000011.jpg
vendored
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
video/testdata/video/image_array_000000012.jpg
vendored
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
video/testdata/video/image_array_000000013.jpg
vendored
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
video/testdata/video/image_array_000000014.jpg
vendored
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
video/testdata/video/image_array_000000015.jpg
vendored
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
video/testdata/video/image_array_000000016.jpg
vendored
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
video/testdata/video/image_array_000000017.jpg
vendored
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
video/testdata/video/image_array_000000018.jpg
vendored
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
video/testdata/video/image_array_000000019.jpg
vendored
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
video/testdata/video/image_array_000000020.jpg
vendored
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
video/testdata/video/image_array_000000021.jpg
vendored
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
video/testdata/video/image_array_000000022.jpg
vendored
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
video/testdata/video/image_array_000000023.jpg
vendored
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
video/testdata/video/image_array_000000024.jpg
vendored
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
video/testdata/video/image_array_000000025.jpg
vendored
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
video/testdata/video/image_array_000000026.jpg
vendored
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
video/testdata/video/image_array_000000027.jpg
vendored
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
video/testdata/video/image_array_000000028.jpg
vendored
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
video/testdata/video/image_array_000000029.jpg
vendored
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
video/testdata/video/image_array_000000030.jpg
vendored
Normal file
After Width: | Height: | Size: 3.7 KiB |
BIN
video/testdata/video/image_array_000000031.jpg
vendored
Normal file
After Width: | Height: | Size: 3.7 KiB |
BIN
video/testdata/video/image_array_000000032.jpg
vendored
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
video/testdata/video/image_array_000000033.jpg
vendored
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
video/testdata/video/image_array_000000034.jpg
vendored
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
video/testdata/video/image_array_000000035.jpg
vendored
Normal file
After Width: | Height: | Size: 3.7 KiB |
BIN
video/testdata/video/image_array_000000036.jpg
vendored
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
video/testdata/video/image_array_000000037.jpg
vendored
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
video/testdata/video/image_array_000000038.jpg
vendored
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
video/testdata/video/image_array_000000039.jpg
vendored
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
video/testdata/video/image_array_000000040.jpg
vendored
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
video/testdata/video/image_array_000000041.jpg
vendored
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
video/testdata/video/image_array_000000042.jpg
vendored
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
video/testdata/video/image_array_000000043.jpg
vendored
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
video/testdata/video/image_array_000000044.jpg
vendored
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
video/testdata/video/image_array_000000045.jpg
vendored
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
video/testdata/video/image_array_000000046.jpg
vendored
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
video/testdata/video/image_array_000000047.jpg
vendored
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
video/testdata/video/image_array_000000048.jpg
vendored
Normal file
After Width: | Height: | Size: 3.7 KiB |
BIN
video/testdata/video/image_array_000000049.jpg
vendored
Normal file
After Width: | Height: | Size: 3.7 KiB |
BIN
video/testdata/video/image_array_000000050.jpg
vendored
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
video/testdata/video/image_array_000000051.jpg
vendored
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
video/testdata/video/image_array_000000052.jpg
vendored
Normal file
After Width: | Height: | Size: 3.7 KiB |
BIN
video/testdata/video/image_array_000000053.jpg
vendored
Normal file
After Width: | Height: | Size: 3.7 KiB |
BIN
video/testdata/video/image_array_000000054.jpg
vendored
Normal file
After Width: | Height: | Size: 3.7 KiB |
BIN
video/testdata/video/image_array_000000055.jpg
vendored
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
video/testdata/video/image_array_000000056.jpg
vendored
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
video/testdata/video/image_array_000000057.jpg
vendored
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
video/testdata/video/image_array_000000058.jpg
vendored
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
video/testdata/video/image_array_000000059.jpg
vendored
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
video/testdata/video/image_array_000000060.jpg
vendored
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
video/testdata/video/image_array_000000061.jpg
vendored
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
video/testdata/video/image_array_000000062.jpg
vendored
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
video/testdata/video/image_array_000000063.jpg
vendored
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
video/testdata/video/image_array_000000064.jpg
vendored
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
video/testdata/video/image_array_000000065.jpg
vendored
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
video/testdata/video/image_array_000000066.jpg
vendored
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
video/testdata/video/image_array_000000067.jpg
vendored
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
video/testdata/video/image_array_000000068.jpg
vendored
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
video/testdata/video/image_array_000000069.jpg
vendored
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
video/testdata/video/image_array_000000070.jpg
vendored
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
video/testdata/video/image_array_000000071.jpg
vendored
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
video/testdata/video/image_array_000000072.jpg
vendored
Normal file
After Width: | Height: | Size: 3.7 KiB |
BIN
video/testdata/video/image_array_000000073.jpg
vendored
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
video/testdata/video/image_array_000000074.jpg
vendored
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
video/testdata/video/image_array_000000075.jpg
vendored
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
video/testdata/video/image_array_000000076.jpg
vendored
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
video/testdata/video/image_array_000000077.jpg
vendored
Normal file
After Width: | Height: | Size: 3.7 KiB |
BIN
video/testdata/video/image_array_000000078.jpg
vendored
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
video/testdata/video/image_array_000000079.jpg
vendored
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
video/testdata/video/image_array_000000080.jpg
vendored
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
video/testdata/video/image_array_000000081.jpg
vendored
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
video/testdata/video/image_array_000000082.jpg
vendored
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
video/testdata/video/image_array_000000083.jpg
vendored
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
video/testdata/video/image_array_000000084.jpg
vendored
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
video/testdata/video/image_array_000000085.jpg
vendored
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
video/testdata/video/image_array_000000086.jpg
vendored
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
video/testdata/video/image_array_000000087.jpg
vendored
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
video/testdata/video/image_array_000000088.jpg
vendored
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
video/testdata/video/image_array_000000089.jpg
vendored
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
video/testdata/video/image_array_000000090.jpg
vendored
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
video/testdata/video/image_array_000000091.jpg
vendored
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
video/testdata/video/image_array_000000092.jpg
vendored
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
video/testdata/video/image_array_000000093.jpg
vendored
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
video/testdata/video/image_array_000000094.jpg
vendored
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
video/testdata/video/image_array_000000095.jpg
vendored
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
video/testdata/video/image_array_000000096.jpg
vendored
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
video/testdata/video/image_array_000000097.jpg
vendored
Normal file
After Width: | Height: | Size: 3.7 KiB |
BIN
video/testdata/video/image_array_000000098.jpg
vendored
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
video/testdata/video/image_array_000000099.jpg
vendored
Normal file
After Width: | Height: | Size: 3.5 KiB |