How to use Khadas Camera with detect_demo

I have attached a khadas camera and can view camera with guvcview.
How do I use the camera as an input for detect_demo?
i tried
./detect_demo /dev/video0 2
but it hangs
Thank you

Please check here:

detect_demo_mipi_fb /dev/video0 2 on WORKS
but the image is laterally inverted ( mirror image )
How can I resolve this?

Also is there a way to grab an image?
fswebcam does not work , palette incompatible

Thank you

@RichardG Which camera model you used ?

OS08A10 8MP HDR Camera - Khadas

@RichardG Can you show us a picture ? It was normal when we tested

I was using an old version acciddentally
Now I have download new version using git clone
here is the result , I have run ./INSTALL
ls lib
root@khadas:/aml_npu_demo_binaries/detect_demo# ./detect_demo_mipi_fb_cv3 /dev/video0 2 on
1920x1080, 32bpp
W Detect_api:[det_set_log_level:19]Set log level=1
W Detect_api:[det_set_log_level:21]output_format not support Imperfect, default to DET_LOG_TERMINAL
W Detect_api:[det_set_log_level:26]Not exist VSI_NN_LOG_LEVEL, Setenv set_vsi_log_error_level
det_set_log_config Debug
E Detect_api:[check_and_set_function:177]dlopen failed!
E Detect_api:[det_set_model:218]ModelType so open failed or Not support now!!
det_set_model fail. ret=-1
Params: command=1 sensor_preset:0 FR_OUT fmt = 0, resolution:0, fb device=/dev/fb0, v4l2 device=/dev/video0
prepare 1080p image ok
terminate called after throwing an instance of ‘cv::Exception’
what(): OpenCV(3.4.3) /home/khadas/opencv-3.4.3/modules/imgproc/src/resize.cpp:4045: error: (-215:Assertion failed) !dsize.empty() || (inv_scale_x > 0 && inv_scale_y > 0) in function ‘resize’

Aborted (core dumped)

@RichardG Can you run this command and faceback to me ?

$ sudo dmesg | grep "Gal"

and this command.

$ cd /aml_npu_demo_binaries
$ git tag

This should be caused by a version mismatch .


@IOTCHINA 这个是版本问题,npu的库和应用版本不匹配造成的.同步版本以后就没这个问题了, 不是库链接的问题.

root@khadas:~# dmesg| grep “Gal”
[ 17.712277] Galcore version
[ 17.712278] Galcore options:
[ 17.714697] Galcore ContiguousBase=0x14400000 ContiguousSize=0x400000
[ 17.718846] Galcore Info: MMU mapped core 0 SRAM[1] base=0xff000000 size=0x100000
[ 17.718853] Galcore Info: MMU mapped core 0 SRAM[1] hardware address=0xff000000 size=0x100000
root@khadas:~# cd /aml_npu_demo_binaries
root@khadas:/aml_npu_demo_binaries# git tag

@RichardG You driver version is old , you should update you system . The leaset release version is 6.4.3

How to update?


Hit:1 bionic InRelease
Hit:2 bionic-security InRelease
Hit:3 bionic-updates InRelease
Hit:4 bionic-backports InRelease
Hit:5 bionic InRelease
Reading package lists… Done
Building dependency tree
Reading state information… Done
2 packages can be upgraded. Run ‘apt list --upgradable’ to see them.
Reading package lists… Done
Building dependency tree
Reading state information… Done
Calculating upgrade… Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Installing Fenix updater: fenix-updater-package-bionic-vim3-4.9 …
Reading package lists… Done
Building dependency tree
Reading state information… Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
fenix-updater-package-bionic-vim3-4.9 : Depends: gstreamer-aml but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

What’s your current image? Please provide this information.

$ cat /etc/fenix-release

I checked on my side based on release V20191231, update successfully.

But ont thing you should to know is that we don’t maintain Ubuntu 18.04 for VIM3 any more. So if you want to use the latest npu demo you have to move to Ubuntu 20.04. Please flash Ubuntu 20.04 V0.9-20200530 and then update to latest version.


root@khadas:~# cat /etc/fenix-release



@RichardG You firmware is too old. I suggest you reburn the 0530 frimware then upgrade the system . Or you can pull the code for fenix and rebuild a new image then upgrade .