edge-impulse-linux 1.20.1 → 1.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cli/linux/linux.js +1 -0
- package/build/cli/linux/linux.js.map +1 -1
- package/build/cli/linux/runner.js +14 -4
- package/build/cli/linux/runner.js.map +1 -1
- package/build/library/classifier/image-classifier.d.ts +2 -0
- package/build/library/classifier/image-classifier.js +84 -54
- package/build/library/classifier/image-classifier.js.map +1 -1
- package/build/library/data-forwarder.d.ts +1 -1
- package/build/library/data-forwarder.js +17 -33
- package/build/library/data-forwarder.js.map +1 -1
- package/build/library/sensors/gstreamer.d.ts +6 -3
- package/build/library/sensors/gstreamer.js +156 -30
- package/build/library/sensors/gstreamer.js.map +1 -1
- package/build/library/sensors/icamera.d.ts +30 -1
- package/build/library/sensors/imagesnap.d.ts +2 -2
- package/build/library/sensors/imagesnap.js +8 -2
- package/build/library/sensors/imagesnap.js.map +1 -1
- package/build/library/sensors/prophesee.d.ts +2 -2
- package/build/library/sensors/prophesee.js +6 -1
- package/build/library/sensors/prophesee.js.map +1 -1
- package/build/library/sensors/sensors-helper.d.ts +2 -0
- package/build/library/sensors/sensors-helper.js +2 -2
- package/build/library/sensors/sensors-helper.js.map +1 -1
- package/build/sdk/studio/sdk/model/models.js +10 -17
- package/build/sdk/studio/sdk/model/models.js.map +1 -1
- package/package.json +1 -1
- package/test/gstreamer.test.ts +456 -5
- package/test/qualcomm-rb3-gen-2-ubuntu-no-external-camera-inspect-qtiqmmfsrc.txt +438 -0
- package/test/qualcomm-rb3-gen-2-ubuntu-no-external-camera-inspect.txt +958 -0
- package/test/qualcomm-rb3-gen-2-ubuntu-no-external-camera-monitor.txt +159 -0
package/test/gstreamer.test.ts
CHANGED
|
@@ -2381,7 +2381,64 @@ Freeing pipeline ...
|
|
|
2381
2381
|
'pylonsrc ! video/x-raw,width=1440,height=1080 ! videoconvert ! ' +
|
|
2382
2382
|
'tee name=t ' +
|
|
2383
2383
|
't. ! queue ! jpegenc ! multifilesink location=original%05d.jpg post-messages=true sync=false ' +
|
|
2384
|
-
't. ! queue ! videocrop left=180 right=180 top=0 bottom=0 ! videoscale method=lanczos ! video/x-raw,width=320,height=320 !
|
|
2384
|
+
't. ! queue ! videocrop left=180 right=180 top=0 bottom=0 ! videoscale method=lanczos ! video/x-raw,format=RGB,width=320,height=320 ! ' +
|
|
2385
|
+
'tee name=u ' +
|
|
2386
|
+
'u. ! queue ! jpegenc ! multifilesink location=resized%05d.jpg post-messages=true sync=false ' +
|
|
2387
|
+
'u. ! queue ! multifilesink location=resized%05d.rgb post-messages=true sync=false'
|
|
2388
|
+
);
|
|
2389
|
+
});
|
|
2390
|
+
|
|
2391
|
+
it("w/ inference dims #1 + profiling info", async () => {
|
|
2392
|
+
const spawnHelper: SpawnHelperType = async (command: string,
|
|
2393
|
+
args: string[],
|
|
2394
|
+
opts: {
|
|
2395
|
+
ignoreErrors: boolean,
|
|
2396
|
+
cwd ? : string
|
|
2397
|
+
} = {
|
|
2398
|
+
ignoreErrors: false
|
|
2399
|
+
}) => {
|
|
2400
|
+
|
|
2401
|
+
if (command === 'which') {
|
|
2402
|
+
return '';
|
|
2403
|
+
}
|
|
2404
|
+
else {
|
|
2405
|
+
throw new Error('spawnHelper failed on ' + command + ' ' + args.join(' '));
|
|
2406
|
+
}
|
|
2407
|
+
};
|
|
2408
|
+
|
|
2409
|
+
const gstreamer = new GStreamer(false, {
|
|
2410
|
+
spawnHelperOverride: spawnHelper,
|
|
2411
|
+
dontRunCleanupLoop: true,
|
|
2412
|
+
profiling: true,
|
|
2413
|
+
});
|
|
2414
|
+
await gstreamer.init();
|
|
2415
|
+
const launchResp = await gstreamer.getGstreamerLaunchCommand({
|
|
2416
|
+
id: 'pylonsrc',
|
|
2417
|
+
name: 'Basler camera',
|
|
2418
|
+
caps: [{
|
|
2419
|
+
framerate: 60,
|
|
2420
|
+
height: 1080,
|
|
2421
|
+
width: 1440,
|
|
2422
|
+
type: "pylonsrc",
|
|
2423
|
+
}],
|
|
2424
|
+
videoSource: 'pylonsrc',
|
|
2425
|
+
}, { width: 1440, height: 1080 }, {
|
|
2426
|
+
width: 320,
|
|
2427
|
+
height: 320,
|
|
2428
|
+
resizeMode: 'fit-shortest',
|
|
2429
|
+
});
|
|
2430
|
+
|
|
2431
|
+
// console.log('launchResp', launchResp);
|
|
2432
|
+
|
|
2433
|
+
assert.equal(launchResp.command, 'gst-launch-1.0');
|
|
2434
|
+
assert.equal(launchResp.pipeline,
|
|
2435
|
+
'-m pylonsrc ! video/x-raw,width=1440,height=1080 ! identity name=frame_ready silent=false ! videoconvert ! ' +
|
|
2436
|
+
'tee name=t ' +
|
|
2437
|
+
't. ! queue ! jpegenc ! multifilesink location=original%05d.jpg post-messages=true sync=false ' +
|
|
2438
|
+
't. ! queue ! videocrop left=180 right=180 top=0 bottom=0 ! videoscale method=lanczos ! video/x-raw,format=RGB,width=320,height=320 ! identity name=resize_done silent=false ! ' +
|
|
2439
|
+
'tee name=u ' +
|
|
2440
|
+
'u. ! queue ! jpegenc ! identity name=jpegenc_done silent=false ! multifilesink location=resized%05d.jpg post-messages=true sync=false ' +
|
|
2441
|
+
'u. ! queue ! multifilesink location=resized%05d.rgb post-messages=true sync=false'
|
|
2385
2442
|
);
|
|
2386
2443
|
});
|
|
2387
2444
|
|
|
@@ -2431,7 +2488,10 @@ Freeing pipeline ...
|
|
|
2431
2488
|
'pylonsrc ! video/x-raw,width=1440,height=1080 ! videoconvert ! ' +
|
|
2432
2489
|
'tee name=t ' +
|
|
2433
2490
|
't. ! queue ! jpegenc ! multifilesink location=original%05d.jpg post-messages=true sync=false ' +
|
|
2434
|
-
't. ! queue ! videoscale method=lanczos ! video/x-raw,width=320,height=320 !
|
|
2491
|
+
't. ! queue ! videoscale method=lanczos ! video/x-raw,format=RGB,width=320,height=320 ! ' +
|
|
2492
|
+
'tee name=u ' +
|
|
2493
|
+
'u. ! queue ! jpegenc ! multifilesink location=resized%05d.jpg post-messages=true sync=false ' +
|
|
2494
|
+
'u. ! queue ! multifilesink location=resized%05d.rgb post-messages=true sync=false'
|
|
2435
2495
|
);
|
|
2436
2496
|
});
|
|
2437
2497
|
|
|
@@ -2527,7 +2587,262 @@ Freeing pipeline ...
|
|
|
2527
2587
|
'pylonsrc ! video/x-raw,width=1440,height=1080 ! videoconvert ! ' +
|
|
2528
2588
|
'tee name=t ' +
|
|
2529
2589
|
't. ! queue ! jpegenc ! multifilesink location=original%05d.jpg post-messages=true sync=false ' +
|
|
2530
|
-
't. ! queue ! videoscale method=lanczos ! video/x-raw,width=320,height=320 !
|
|
2590
|
+
't. ! queue ! videoscale method=lanczos ! video/x-raw,format=RGB,width=320,height=320 ! ' +
|
|
2591
|
+
'tee name=u ' +
|
|
2592
|
+
'u. ! queue ! jpegenc ! multifilesink location=resized%05d.jpg post-messages=true sync=false ' +
|
|
2593
|
+
'u. ! queue ! multifilesink location=resized%05d.rgb post-messages=true sync=false'
|
|
2594
|
+
);
|
|
2595
|
+
});
|
|
2596
|
+
|
|
2597
|
+
it("w/ inference dims #5 (image/jpeg)", async () => {
|
|
2598
|
+
const spawnHelper: SpawnHelperType = async (command: string,
|
|
2599
|
+
args: string[],
|
|
2600
|
+
opts: {
|
|
2601
|
+
ignoreErrors: boolean,
|
|
2602
|
+
cwd ? : string
|
|
2603
|
+
} = {
|
|
2604
|
+
ignoreErrors: false
|
|
2605
|
+
}) => {
|
|
2606
|
+
|
|
2607
|
+
if (command === 'which') {
|
|
2608
|
+
return '';
|
|
2609
|
+
}
|
|
2610
|
+
else {
|
|
2611
|
+
throw new Error('spawnHelper failed on ' + command + ' ' + args.join(' '));
|
|
2612
|
+
}
|
|
2613
|
+
};
|
|
2614
|
+
|
|
2615
|
+
const gstreamer = new GStreamer(false, {
|
|
2616
|
+
spawnHelperOverride: spawnHelper,
|
|
2617
|
+
dontRunCleanupLoop: true,
|
|
2618
|
+
});
|
|
2619
|
+
await gstreamer.init();
|
|
2620
|
+
const launchResp = await gstreamer.getGstreamerLaunchCommand({
|
|
2621
|
+
id: '/dev/video0',
|
|
2622
|
+
name: 'Basler camera',
|
|
2623
|
+
caps: [{
|
|
2624
|
+
framerate: 60,
|
|
2625
|
+
height: 1080,
|
|
2626
|
+
width: 1920,
|
|
2627
|
+
type: "image/jpeg",
|
|
2628
|
+
}],
|
|
2629
|
+
videoSource: 'uvch264src',
|
|
2630
|
+
}, { width: 1920, height: 1080 }, {
|
|
2631
|
+
width: 320,
|
|
2632
|
+
height: 320,
|
|
2633
|
+
resizeMode: 'fit-shortest',
|
|
2634
|
+
});
|
|
2635
|
+
|
|
2636
|
+
// console.log('launchResp', launchResp);
|
|
2637
|
+
|
|
2638
|
+
assert.equal(launchResp.command, 'gst-launch-1.0');
|
|
2639
|
+
assert.equal(launchResp.pipeline,
|
|
2640
|
+
'uvch264src device=/dev/video0 ! image/jpeg,width=1920,height=1080 ! ' +
|
|
2641
|
+
'tee name=t ' +
|
|
2642
|
+
't. ! queue ! multifilesink location=original%05d.jpg post-messages=true sync=false ' +
|
|
2643
|
+
't. ! queue ! jpegdec ! videoconvert ! videocrop left=420 right=420 top=0 bottom=0 ! videoscale method=lanczos ! video/x-raw,format=RGB,width=320,height=320 ! ' +
|
|
2644
|
+
'tee name=u ' +
|
|
2645
|
+
'u. ! queue ! jpegenc ! multifilesink location=resized%05d.jpg post-messages=true sync=false ' +
|
|
2646
|
+
'u. ! queue ! multifilesink location=resized%05d.rgb post-messages=true sync=false'
|
|
2647
|
+
);
|
|
2648
|
+
});
|
|
2649
|
+
|
|
2650
|
+
it("w/ inference dims #6 (image/jpeg, fit-long)", async () => {
|
|
2651
|
+
const spawnHelper: SpawnHelperType = async (command: string,
|
|
2652
|
+
args: string[],
|
|
2653
|
+
opts: {
|
|
2654
|
+
ignoreErrors: boolean,
|
|
2655
|
+
cwd ? : string
|
|
2656
|
+
} = {
|
|
2657
|
+
ignoreErrors: false
|
|
2658
|
+
}) => {
|
|
2659
|
+
|
|
2660
|
+
if (command === 'which') {
|
|
2661
|
+
return '';
|
|
2662
|
+
}
|
|
2663
|
+
else {
|
|
2664
|
+
throw new Error('spawnHelper failed on ' + command + ' ' + args.join(' '));
|
|
2665
|
+
}
|
|
2666
|
+
};
|
|
2667
|
+
|
|
2668
|
+
const gstreamer = new GStreamer(false, {
|
|
2669
|
+
spawnHelperOverride: spawnHelper,
|
|
2670
|
+
dontRunCleanupLoop: true,
|
|
2671
|
+
});
|
|
2672
|
+
await gstreamer.init();
|
|
2673
|
+
const launchResp = await gstreamer.getGstreamerLaunchCommand({
|
|
2674
|
+
id: '/dev/video0',
|
|
2675
|
+
name: 'Basler camera',
|
|
2676
|
+
caps: [{
|
|
2677
|
+
framerate: 60,
|
|
2678
|
+
height: 1080,
|
|
2679
|
+
width: 1920,
|
|
2680
|
+
type: "image/jpeg",
|
|
2681
|
+
}],
|
|
2682
|
+
videoSource: 'uvch264src',
|
|
2683
|
+
}, { width: 1920, height: 1080 }, {
|
|
2684
|
+
width: 320,
|
|
2685
|
+
height: 320,
|
|
2686
|
+
resizeMode: 'fit-longest',
|
|
2687
|
+
});
|
|
2688
|
+
|
|
2689
|
+
// console.log('launchResp', launchResp);
|
|
2690
|
+
|
|
2691
|
+
assert.equal(launchResp.command, 'gst-launch-1.0');
|
|
2692
|
+
assert.equal(launchResp.pipeline,
|
|
2693
|
+
'uvch264src device=/dev/video0 ! image/jpeg,width=1920,height=1080 ! multifilesink location=resized%05d.jpg post-messages=true sync=false'
|
|
2694
|
+
);
|
|
2695
|
+
});
|
|
2696
|
+
|
|
2697
|
+
it("w/ inference dims #7 (image/jpeg, fit-long, profiling)", async () => {
|
|
2698
|
+
const spawnHelper: SpawnHelperType = async (command: string,
|
|
2699
|
+
args: string[],
|
|
2700
|
+
opts: {
|
|
2701
|
+
ignoreErrors: boolean,
|
|
2702
|
+
cwd ? : string
|
|
2703
|
+
} = {
|
|
2704
|
+
ignoreErrors: false
|
|
2705
|
+
}) => {
|
|
2706
|
+
|
|
2707
|
+
if (command === 'which') {
|
|
2708
|
+
return '';
|
|
2709
|
+
}
|
|
2710
|
+
else {
|
|
2711
|
+
throw new Error('spawnHelper failed on ' + command + ' ' + args.join(' '));
|
|
2712
|
+
}
|
|
2713
|
+
};
|
|
2714
|
+
|
|
2715
|
+
const gstreamer = new GStreamer(false, {
|
|
2716
|
+
spawnHelperOverride: spawnHelper,
|
|
2717
|
+
dontRunCleanupLoop: true,
|
|
2718
|
+
profiling: true,
|
|
2719
|
+
});
|
|
2720
|
+
await gstreamer.init();
|
|
2721
|
+
const launchResp = await gstreamer.getGstreamerLaunchCommand({
|
|
2722
|
+
id: '/dev/video0',
|
|
2723
|
+
name: 'Basler camera',
|
|
2724
|
+
caps: [{
|
|
2725
|
+
framerate: 60,
|
|
2726
|
+
height: 1080,
|
|
2727
|
+
width: 1920,
|
|
2728
|
+
type: "image/jpeg",
|
|
2729
|
+
}],
|
|
2730
|
+
videoSource: 'uvch264src',
|
|
2731
|
+
}, { width: 1920, height: 1080 }, {
|
|
2732
|
+
width: 320,
|
|
2733
|
+
height: 320,
|
|
2734
|
+
resizeMode: 'fit-longest',
|
|
2735
|
+
});
|
|
2736
|
+
|
|
2737
|
+
// console.log('launchResp', launchResp);
|
|
2738
|
+
|
|
2739
|
+
assert.equal(launchResp.command, 'gst-launch-1.0');
|
|
2740
|
+
assert.equal(launchResp.pipeline,
|
|
2741
|
+
'-m uvch264src device=/dev/video0 ! image/jpeg,width=1920,height=1080 ! identity name=frame_ready silent=false ! multifilesink location=resized%05d.jpg post-messages=true sync=false'
|
|
2742
|
+
);
|
|
2743
|
+
});
|
|
2744
|
+
|
|
2745
|
+
it("w/ inference dims #8 (pylonsrc, squash, no rgb buffers)", async () => {
|
|
2746
|
+
const spawnHelper: SpawnHelperType = async (command: string,
|
|
2747
|
+
args: string[],
|
|
2748
|
+
opts: {
|
|
2749
|
+
ignoreErrors: boolean,
|
|
2750
|
+
cwd ? : string
|
|
2751
|
+
} = {
|
|
2752
|
+
ignoreErrors: false
|
|
2753
|
+
}) => {
|
|
2754
|
+
|
|
2755
|
+
if (command === 'which') {
|
|
2756
|
+
return '';
|
|
2757
|
+
}
|
|
2758
|
+
else {
|
|
2759
|
+
throw new Error('spawnHelper failed on ' + command + ' ' + args.join(' '));
|
|
2760
|
+
}
|
|
2761
|
+
};
|
|
2762
|
+
|
|
2763
|
+
const gstreamer = new GStreamer(false, {
|
|
2764
|
+
spawnHelperOverride: spawnHelper,
|
|
2765
|
+
dontRunCleanupLoop: true,
|
|
2766
|
+
dontOutputRgbBuffers: true,
|
|
2767
|
+
});
|
|
2768
|
+
await gstreamer.init();
|
|
2769
|
+
const launchResp = await gstreamer.getGstreamerLaunchCommand({
|
|
2770
|
+
id: 'pylonsrc',
|
|
2771
|
+
name: 'Basler camera',
|
|
2772
|
+
caps: [{
|
|
2773
|
+
framerate: 60,
|
|
2774
|
+
height: 1080,
|
|
2775
|
+
width: 1440,
|
|
2776
|
+
type: "pylonsrc",
|
|
2777
|
+
}],
|
|
2778
|
+
videoSource: 'pylonsrc',
|
|
2779
|
+
}, { width: 1440, height: 1080 }, {
|
|
2780
|
+
width: 320,
|
|
2781
|
+
height: 320,
|
|
2782
|
+
resizeMode: 'squash',
|
|
2783
|
+
});
|
|
2784
|
+
|
|
2785
|
+
// console.log('launchResp', launchResp);
|
|
2786
|
+
|
|
2787
|
+
assert.equal(launchResp.command, 'gst-launch-1.0');
|
|
2788
|
+
assert.equal(launchResp.pipeline,
|
|
2789
|
+
'pylonsrc ! video/x-raw,width=1440,height=1080 ! videoconvert ! ' +
|
|
2790
|
+
'tee name=t ' +
|
|
2791
|
+
't. ! queue ! jpegenc ! multifilesink location=original%05d.jpg post-messages=true sync=false ' +
|
|
2792
|
+
't. ! queue ! videoscale method=lanczos ! video/x-raw,width=320,height=320 ! ' +
|
|
2793
|
+
'jpegenc ! multifilesink location=resized%05d.jpg post-messages=true sync=false'
|
|
2794
|
+
);
|
|
2795
|
+
});
|
|
2796
|
+
|
|
2797
|
+
it("w/ inference dims #9 (image/jpeg, dont output rgb buffers)", async () => {
|
|
2798
|
+
const spawnHelper: SpawnHelperType = async (command: string,
|
|
2799
|
+
args: string[],
|
|
2800
|
+
opts: {
|
|
2801
|
+
ignoreErrors: boolean,
|
|
2802
|
+
cwd ? : string
|
|
2803
|
+
} = {
|
|
2804
|
+
ignoreErrors: false
|
|
2805
|
+
}) => {
|
|
2806
|
+
|
|
2807
|
+
if (command === 'which') {
|
|
2808
|
+
return '';
|
|
2809
|
+
}
|
|
2810
|
+
else {
|
|
2811
|
+
throw new Error('spawnHelper failed on ' + command + ' ' + args.join(' '));
|
|
2812
|
+
}
|
|
2813
|
+
};
|
|
2814
|
+
|
|
2815
|
+
const gstreamer = new GStreamer(false, {
|
|
2816
|
+
spawnHelperOverride: spawnHelper,
|
|
2817
|
+
dontRunCleanupLoop: true,
|
|
2818
|
+
dontOutputRgbBuffers: true,
|
|
2819
|
+
});
|
|
2820
|
+
await gstreamer.init();
|
|
2821
|
+
const launchResp = await gstreamer.getGstreamerLaunchCommand({
|
|
2822
|
+
id: '/dev/video0',
|
|
2823
|
+
name: 'Basler camera',
|
|
2824
|
+
caps: [{
|
|
2825
|
+
framerate: 60,
|
|
2826
|
+
height: 1080,
|
|
2827
|
+
width: 1920,
|
|
2828
|
+
type: "image/jpeg",
|
|
2829
|
+
}],
|
|
2830
|
+
videoSource: 'uvch264src',
|
|
2831
|
+
}, { width: 1920, height: 1080 }, {
|
|
2832
|
+
width: 320,
|
|
2833
|
+
height: 320,
|
|
2834
|
+
resizeMode: 'fit-shortest',
|
|
2835
|
+
});
|
|
2836
|
+
|
|
2837
|
+
// console.log('launchResp', launchResp);
|
|
2838
|
+
|
|
2839
|
+
assert.equal(launchResp.command, 'gst-launch-1.0');
|
|
2840
|
+
assert.equal(launchResp.pipeline,
|
|
2841
|
+
'uvch264src device=/dev/video0 ! image/jpeg,width=1920,height=1080 ! ' +
|
|
2842
|
+
'tee name=t ' +
|
|
2843
|
+
't. ! queue ! multifilesink location=original%05d.jpg post-messages=true sync=false ' +
|
|
2844
|
+
't. ! queue ! jpegdec ! videoconvert ! videocrop left=420 right=420 top=0 bottom=0 ! videoscale method=lanczos ! video/x-raw,width=320,height=320 ! ' +
|
|
2845
|
+
'jpegenc ! multifilesink location=resized%05d.jpg post-messages=true sync=false'
|
|
2531
2846
|
);
|
|
2532
2847
|
});
|
|
2533
2848
|
|
|
@@ -2662,6 +2977,144 @@ Freeing pipeline ...
|
|
|
2662
2977
|
assert.equal(launchResp.pipeline,
|
|
2663
2978
|
'libcamerasrc camera-name="/base/soc/i2c0mux/i2c@1/imx708@1a" ! video/x-raw,width=1920,height=1080 ! videoconvert ! jpegenc ! multifilesink location=resized%05d.jpg post-messages=true sync=false');
|
|
2664
2979
|
});
|
|
2980
|
+
|
|
2981
|
+
it('rb3 gen2 vision kit (built-in camera #1), no inference dims', async () => {
|
|
2982
|
+
const gstMonitorOutput = await fs.readFile('./test/qualcomm-rb3-gen-2-ubuntu-no-external-camera-monitor.txt', { encoding: 'utf-8' });
|
|
2983
|
+
const gstInspectOutput = await fs.readFile('./test/qualcomm-rb3-gen-2-ubuntu-no-external-camera-inspect.txt', { encoding: 'utf-8' });
|
|
2984
|
+
const gstInspectOutputQti = await fs.readFile('./test/qualcomm-rb3-gen-2-ubuntu-no-external-camera-inspect-qtiqmmfsrc.txt', { encoding: 'utf-8' });
|
|
2985
|
+
|
|
2986
|
+
const devices = await testGetDevices({
|
|
2987
|
+
gstDeviceMonitor: () => gstMonitorOutput,
|
|
2988
|
+
gstInspect: (args: string[]) => {
|
|
2989
|
+
if (args.length === 0) {
|
|
2990
|
+
return gstInspectOutput;
|
|
2991
|
+
}
|
|
2992
|
+
else if (args[0] === 'qtiqmmfsrc') {
|
|
2993
|
+
return gstInspectOutputQti;
|
|
2994
|
+
}
|
|
2995
|
+
else {
|
|
2996
|
+
throw new Error('Cannot handle gstInspect command: ' + JSON.stringify(args));
|
|
2997
|
+
}
|
|
2998
|
+
},
|
|
2999
|
+
modeOverride: 'qualcomm-rb3gen2',
|
|
3000
|
+
});
|
|
3001
|
+
|
|
3002
|
+
assert.equal(devices.length, 2, `Expected 2 devices (${JSON.stringify(devices)})`);
|
|
3003
|
+
|
|
3004
|
+
const device = devices.find(d => d.name === 'Camera 0 (High-resolution, fisheye, IMX577) (0)');
|
|
3005
|
+
assert(device, `Expected device with name "Camera 0 (High-resolution, fisheye, IMX577) (0)" (${JSON.stringify(devices)})`);
|
|
3006
|
+
|
|
3007
|
+
const spawnHelper: SpawnHelperType = async (command: string, args: string[]) => {
|
|
3008
|
+
if (command === 'which') {
|
|
3009
|
+
return '';
|
|
3010
|
+
}
|
|
3011
|
+
else if (command === 'gst-inspect-1.0') {
|
|
3012
|
+
if (args.length === 0) {
|
|
3013
|
+
return gstInspectOutput;
|
|
3014
|
+
}
|
|
3015
|
+
else if (args[0] === 'qtiqmmfsrc') {
|
|
3016
|
+
return gstInspectOutputQti;
|
|
3017
|
+
}
|
|
3018
|
+
else {
|
|
3019
|
+
throw new Error('Cannot handle gstInspect command: ' + JSON.stringify(args));
|
|
3020
|
+
}
|
|
3021
|
+
}
|
|
3022
|
+
else {
|
|
3023
|
+
throw new Error('spawnHelper failed on ' + command + ' ' + args.join(' '));
|
|
3024
|
+
}
|
|
3025
|
+
};
|
|
3026
|
+
|
|
3027
|
+
const gstreamer = new GStreamer(false, {
|
|
3028
|
+
spawnHelperOverride: spawnHelper,
|
|
3029
|
+
dontRunCleanupLoop: true,
|
|
3030
|
+
modeOverride: 'qualcomm-rb3gen2',
|
|
3031
|
+
});
|
|
3032
|
+
await gstreamer.init();
|
|
3033
|
+
const launchResp = await gstreamer.getGstreamerLaunchCommand(
|
|
3034
|
+
device,
|
|
3035
|
+
{ width: 1920, height: 1080 },
|
|
3036
|
+
undefined);
|
|
3037
|
+
|
|
3038
|
+
// console.log('launchResp', launchResp);
|
|
3039
|
+
|
|
3040
|
+
assert.equal(launchResp.command, 'gst-launch-1.0');
|
|
3041
|
+
|
|
3042
|
+
// NV12 here is important!
|
|
3043
|
+
assert.equal(launchResp.pipeline,
|
|
3044
|
+
'qtiqmmfsrc name=camsrc camera=0 ! video/x-raw,width=1920,height=1080,format=NV12 ! videoconvert ! jpegenc ! multifilesink location=resized%05d.jpg post-messages=true sync=false');
|
|
3045
|
+
});
|
|
3046
|
+
|
|
3047
|
+
it('rb3 gen2 vision kit (built-in camera #1), w/ inference dims (squash)', async () => {
|
|
3048
|
+
const gstMonitorOutput = await fs.readFile('./test/qualcomm-rb3-gen-2-ubuntu-no-external-camera-monitor.txt', { encoding: 'utf-8' });
|
|
3049
|
+
const gstInspectOutput = await fs.readFile('./test/qualcomm-rb3-gen-2-ubuntu-no-external-camera-inspect.txt', { encoding: 'utf-8' });
|
|
3050
|
+
const gstInspectOutputQti = await fs.readFile('./test/qualcomm-rb3-gen-2-ubuntu-no-external-camera-inspect-qtiqmmfsrc.txt', { encoding: 'utf-8' });
|
|
3051
|
+
|
|
3052
|
+
const devices = await testGetDevices({
|
|
3053
|
+
gstDeviceMonitor: () => gstMonitorOutput,
|
|
3054
|
+
gstInspect: (args: string[]) => {
|
|
3055
|
+
if (args.length === 0) {
|
|
3056
|
+
return gstInspectOutput;
|
|
3057
|
+
}
|
|
3058
|
+
else if (args[0] === 'qtiqmmfsrc') {
|
|
3059
|
+
return gstInspectOutputQti;
|
|
3060
|
+
}
|
|
3061
|
+
else {
|
|
3062
|
+
throw new Error('Cannot handle gstInspect command: ' + JSON.stringify(args));
|
|
3063
|
+
}
|
|
3064
|
+
},
|
|
3065
|
+
modeOverride: 'qualcomm-rb3gen2',
|
|
3066
|
+
});
|
|
3067
|
+
|
|
3068
|
+
assert.equal(devices.length, 2, `Expected 2 devices (${JSON.stringify(devices)})`);
|
|
3069
|
+
|
|
3070
|
+
const device = devices.find(d => d.name === 'Camera 0 (High-resolution, fisheye, IMX577) (0)');
|
|
3071
|
+
assert(device, `Expected device with name "Camera 0 (High-resolution, fisheye, IMX577) (0)" (${JSON.stringify(devices)})`);
|
|
3072
|
+
|
|
3073
|
+
const spawnHelper: SpawnHelperType = async (command: string, args: string[]) => {
|
|
3074
|
+
if (command === 'which') {
|
|
3075
|
+
return '';
|
|
3076
|
+
}
|
|
3077
|
+
else if (command === 'gst-inspect-1.0') {
|
|
3078
|
+
if (args.length === 0) {
|
|
3079
|
+
return gstInspectOutput;
|
|
3080
|
+
}
|
|
3081
|
+
else if (args[0] === 'qtiqmmfsrc') {
|
|
3082
|
+
return gstInspectOutputQti;
|
|
3083
|
+
}
|
|
3084
|
+
else {
|
|
3085
|
+
throw new Error('Cannot handle gstInspect command: ' + JSON.stringify(args));
|
|
3086
|
+
}
|
|
3087
|
+
}
|
|
3088
|
+
else {
|
|
3089
|
+
throw new Error('spawnHelper failed on ' + command + ' ' + args.join(' '));
|
|
3090
|
+
}
|
|
3091
|
+
};
|
|
3092
|
+
|
|
3093
|
+
const gstreamer = new GStreamer(false, {
|
|
3094
|
+
spawnHelperOverride: spawnHelper,
|
|
3095
|
+
dontRunCleanupLoop: true,
|
|
3096
|
+
modeOverride: 'qualcomm-rb3gen2',
|
|
3097
|
+
});
|
|
3098
|
+
await gstreamer.init();
|
|
3099
|
+
const launchResp = await gstreamer.getGstreamerLaunchCommand(device, { width: 1920, height: 1080 }, {
|
|
3100
|
+
width: 320, height: 320, resizeMode: 'squash'
|
|
3101
|
+
});
|
|
3102
|
+
|
|
3103
|
+
// console.log('launchResp', launchResp);
|
|
3104
|
+
|
|
3105
|
+
assert.equal(launchResp.command, 'gst-launch-1.0');
|
|
3106
|
+
|
|
3107
|
+
// NV12 here is important!
|
|
3108
|
+
assert.equal(launchResp.pipeline,
|
|
3109
|
+
'qtiqmmfsrc name=camsrc camera=0 ! video/x-raw,width=1920,height=1080,format=NV12 ! videoconvert ! ' +
|
|
3110
|
+
'tee name=t ' +
|
|
3111
|
+
't. ! queue ! jpegenc ! multifilesink location=original%05d.jpg post-messages=true sync=false ' +
|
|
3112
|
+
't. ! queue ! videoscale method=lanczos ! video/x-raw,format=RGB,width=320,height=320 ! ' +
|
|
3113
|
+
'tee name=u ' +
|
|
3114
|
+
'u. ! queue ! jpegenc ! multifilesink location=resized%05d.jpg post-messages=true sync=false ' +
|
|
3115
|
+
'u. ! queue ! multifilesink location=resized%05d.rgb post-messages=true sync=false'
|
|
3116
|
+
);
|
|
3117
|
+
});
|
|
2665
3118
|
});
|
|
2666
3119
|
});
|
|
2667
3120
|
|
|
@@ -2681,8 +3134,6 @@ async function testGetDevices(output: {
|
|
|
2681
3134
|
ignoreErrors: false
|
|
2682
3135
|
}) => {
|
|
2683
3136
|
|
|
2684
|
-
// console.log('testGetDevices', 'command', command, 'args', args);
|
|
2685
|
-
|
|
2686
3137
|
if (command === 'which') {
|
|
2687
3138
|
return typeof output.which === 'function' ?
|
|
2688
3139
|
output.which(args) :
|