1 Star 0 Fork 4.9K

fish / docs

forked from OpenHarmony / docs 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
use-case-5.md 4.69 KB
一键复制 编辑 原始数据 按行查看 历史
NEEN 提交于 2021-03-12 17:59 . !197 Docs Update version 1.0.1

Use Case

This use case takes camera_sample (contained in the source code) as an example for photographing, recording, and previewing on the development board.

  • You can obtain source code of the sample from applications/sample/camera/media/camera_sample.cpp.

  • Before running the sample camera, you need to compile, burn, and run the image. For details, see Getting Started with Hi3516.

    NOTE: After the development board is started, the home screen is loaded and displayed above the media layer by default. To prevent covering camera_sample, you should remove the home screen during compilation or packaging. How to Remove: In build/lite/components/applications.json, comment out or delete the //applications/sample/camera/launcher:launcher_hap line from the target field of camera_sample_app.

  • The compilation result of the sample code is stored in out/hi3516dv300/ipcamera_hi3516dv300_liteos/dev_tools/bin. To ensure that the code can be executed on the development board, you can copy the file to a TF card through a card reader, or modify the compilation script of camera_sample to copy the compilation result to rootfs.img.

    Modify the first output_dir in the source code path applications/sample/camera/media/BUILD.gn.

    • Before: output_dir = "$root_out_dir/dev_ools"
    • After: output_dir = "$root_out_dir/"

    Recompile the source code repository and burn the code into the development board. Then you can find the camera_sample file in the bin directory of the board.

    NOTICE: You should insert a TF card (up to 128 GB supported) for photographing and video recording before system startup. This way, the TF card will be automatically mounted to the /sdcard directory. If you insert the TF card after the system is started, you have to manually mount the TF card. To view the photos and videos in the TF card, copy them to a computer. If you just want to preview photos and videos, you do not need to insert a TF card.

  • Perform the following steps to run the sample:

  1. Run the cd command to go to the end path of the executable program and start camera_sample by running the command in the following figure.

    Figure 1 Starting camera_sample

    The control commands are displayed as shown in the preceding figure. Press S to stop the current operation (including video recording and preview), and press Q to exit the program.

  2. Press 1 to take a photo in JPG format. The photo is saved in the /sdcard directory and named Capture*.

    Figure 2 Serial port logs displayed after the photographing command is executed

    To view the saved file, exit the program and enter the file system. To start the program again, return to the previous step.

    Figure 3 Saved files

  3. Press 2 to start recording. The video file is in MP4 format and saved in the /sdcard directory with the name Record*. Press S to stop recording.

    Figure 4 Serial port logs displayed after the recording command is executed

  4. Press 3 to start preview. The preview is displayed on the screen. Press S to stop preview.

    Figure 5 Serial port logs displayed after the preview command is executed

    The following figure shows the preview.

    Figure 6 Preview effect

  5. Press Q to exit.

    Figure 7 Serial port logs displayed after the exit command is executed

1
https://gitee.com/fish_neil/docs.git
git@gitee.com:fish_neil/docs.git
fish_neil
docs
docs
master

搜索帮助