Capturing single image

  • For capturing a single image using the libraries mentioned:

    1 Using OpenCV-Mobile:
    When using OpenCV-Mobile to capture an image, you should skip the initial frames captured because the YUV format may not be correctly set up initially. After initializing the camera, you can discard a few initial frames before capturing the image to ensure that the camera setup is stabilized.
    opencv-get-frame.jpg
    2 Using V4L2:
    V4L2 (Video for Linux 2) can be used to capture images directly in NV12 format (YUV420SP).
    You can refer to the link viewtopic.php?t=106
    v4l2_answer.jpg
    3 Using RKMPI:
    For capturing and encoding an image using RKMPI, you can refer to the sample codes provided in <luckfox-pico sdk>/media/samples/simple_test/. Translate and refine the code according to your requirements.
  • Perfect, thank you very much! I will give these a try.
  • Coming back to this after a while. I did manage to get the "v4l2_test" utility to work and I could convert the YUV file using a tool on my desktop computer.

    However, I have been trying to follow the instructions here for installing the v4l2 tools https://wiki.luckfox.com/Luckfox-Pico/C ... ls-toolkit.

    I have run through the Buildroot menuconfig process a couple of times, but the v4l2-ctrl command & ffplay never seem to be installed. Is there some extra step to getting these working?

    Thanks!
  • torchris4 wrote: 2024-03-09 3:43 Coming back to this after a while. I did manage to get the "v4l2_test" utility to work and I could convert the YUV file using a tool on my desktop computer.

    However, I have been trying to follow the instructions here for installing the v4l2 tools https://wiki.luckfox.com/Luckfox-Pico/C ... ls-toolkit.

    I have run through the Buildroot menuconfig process a couple of times, but the v4l2-ctrl command & ffplay never seem to be installed. Is there some extra step to getting these working?

    Thanks!
    Hello, this is a task that is prone to errors, so you need to ensure that no steps are missing in your execution. Here are the steps you need to follow:

    1Delete the old rootfs.img by executing the command in the SDK root directory.

    Code: Select all

    ./build.sh clean rootfs
    
    2Enter the directory <Luckfox-pico-sdk>/sysdrv/source/buildroot/buildroot-2023.02.6.

    Code: Select all

    cd sysdrv/source/buildroot/buildroot-2023.02.6
    make luckfox_pico_defconfig
    
    3Execute the command to add tools such as v4l2-ctl.

    Code: Select all

    make menuconfig
    
    4Save the settings and compile.

    Code: Select all

    make savedefconfig
    make -j
    
    5Return to the SDK root directory and execute the command to generate and package the rootfs.img.

    Code: Select all

    ./build.sh rootfs
    ./build.sh firmware
    
    Note: ffplay is designed for PC use, primarily for viewing images in YUV format.In buildroot, there is no need to add ffplay.
  • Thanks! I will try this. I think I was probably missing the "clean" step. I will post the results.
  • Trying this out, it seems to get stuck on this "library intl found: NO" error:

    Code: Select all

    Run-time dependency libffi found: YES 3.4.4
    Run-time dependency zlib found: YES 1.2.13
    Checking for function "ngettext" : NO 
    Library intl found: NO
    
    output/build/libglib2-2.72.3/meson.build:2102:4: ERROR: Automatic wrap-based subproject downloading is disabled
    
    A full log can be found at /root/sdk/luckfox-pico/sysdrv/source/buildroot/buildroot-2023.02.6/output/build/libglib2-2.72.3/build/meson-logs/meson-log.txt
    make: *** [package/pkg-generic.mk:283: /root/sdk/luckfox-pico/sysdrv/source/buildroot/buildroot-2023.02.6/output/build/libglib2-2.72.3/.stamp_configured] Error 1
    Not sure what that library is. Even after I deselected all the V4L2 packages it still gives me that.
  • And from the log file for the compile:

    Code: Select all

    Checking for function "ngettext" : NO
    Running compile:
    Working directory:  /root/sdk/luckfox-pico/sysdrv/source/buildroot/buildroot-2023.02.6/output/build/libglib2-2.72.3/build/meson->
    Command line:  /root/sdk/luckfox-pico/sysdrv/source/buildroot/buildroot-2023.02.6/output/host/bin/arm-rockchip830-linux-uclibcgn>
    
    Code:
     int main(void) { return 0; }
    
    Compiler stdout:
    
    Compiler stderr:
     /root/sdk/luckfox-pico/tools/linux/toolchain/arm-rockchip830-linux-uclibcgnueabihf/bin/../lib/gcc/arm-rockchip830-linux-uclibcg>
    collect2: error: ld returned 1 exit status
    
    Library intl found: NO
    
    output/build/libglib2-2.72.3/meson.build:2102:4: ERROR: Automatic wrap-based subproject downloading is disabled
  • torchris4 wrote: 2024-03-10 23:00 And from the log file for the compile:

    Code: Select all

    Checking for function "ngettext" : NO
    Running compile:
    Working directory:  /root/sdk/luckfox-pico/sysdrv/source/buildroot/buildroot-2023.02.6/output/build/libglib2-2.72.3/build/meson->
    Command line:  /root/sdk/luckfox-pico/sysdrv/source/buildroot/buildroot-2023.02.6/output/host/bin/arm-rockchip830-linux-uclibcgn>
    
    Code:
     int main(void) { return 0; }
    
    Compiler stdout:
    
    Compiler stderr:
     /root/sdk/luckfox-pico/tools/linux/toolchain/arm-rockchip830-linux-uclibcgnueabihf/bin/../lib/gcc/arm-rockchip830-linux-uclibcg>
    collect2: error: ld returned 1 exit status
    
    Library intl found: NO
    
    output/build/libglib2-2.72.3/meson.build:2102:4: ERROR: Automatic wrap-based subproject downloading is disabled
    Unfortunately, I haven't encountered this problem before, so I'm not sure what issues you've encountered during the buildroot setup.
    You can try the following steps to restore everything to its original state:

    1.elete <SDK Path>/sysdrv/source/buildroot/buildroot-2023.02.6/output.
    2.Retrieve the luckfox_pico_defconfig from GitHub and overwrite it in <SDK Path>/sysdrv/source/buildroot/buildroot-2023.02.6/configs/luckfox_pico_defconfig (the original luckfox_pico_defconfig may have been modified when executing savedefconfig).
    3.Re-execute the rootfs to add libv4l.

    I hope this helps.
  • Thanks!

    What I did was go back up to the sdk root and do a "make clean" which deleted everything. Then I did the ./make -lunch & ./make to rebuild everything.

    Then I went back through the menuconfig process and everything compiled. I will test the new image tomorrow.

    I also have no idea why it got stuck on the "ngettext" issue. I can't see what would be using it.

    V4l2 is finally installed!!
    Last edited by torchris4 on 2024-03-11 2:23, edited 1 time in total.