图漾网络深度相机的环境配置

        由于网上对图漾相机的介绍比较少,所以本人把图漾网络相机的配置流程做一个介绍。

本人安装环境为:ubuntu18.04、FM851-E1 。

官方sdk下载链接:downloadcenter › 图漾科技丨3D相机

1 . 首先按照官网那个的接线方式,安装一个24V电源;

2.  sdk下载与编译

   Linux 平台为 Percipio 深度相机搭建开发环境的过程:

  下载 Camport3 SDK

选择以下任意方式,下载 Camport3 SDK:

  • 使用浏览器访问 http://github.com/percipioxyz/ 并下载 Camport3 SDK。

  • 使用 git 指令获取本地副本:打开终端,切换到需存放 SDK 的工作目录下,输入 git clone 命令克隆远程仓库。

git clone https://github.com/percipioxyz/camport3.git

安装依赖

           cmake安装

sudo apt-get install cmake

            OpenCV

sudo apt-get install libopencv-dev

编译

进入 camport3 目录,执行以下命令编译示例代码

sudo cp lib/linux/lib_x64/libtycam.so* /usr/lib/
cd sample
mkdir build
cd build
cmake ..
make

3. 本地ip和相机ip配置

      本地ip配置  

             以太网设置 -> ipv4 -> 设置ip地址和子网掩码

             例如:本人的ip地址:192.168.1.15  255.255.255.0

     相机ip配置    

             打开camport3 目录     ./camport3/sample/build/bin

             ./ForceDeviceIP -static 68:f7:56:36:90:a3 192.168.1.160 255.255.255.0 192.168.1.1

           介绍:68:f7:56:36:90:a3  自己相机的mac地址

            192.168.1.160 255.255.255.0 192.168.1.1      设置相机的ip地址

             注意:相机的ip地址要和本地的ip地址设置为一样

4. 对相机进行一个简单测试。

       下载工具Percipio Viewer(Linux)downloadcenter › 图漾科技丨3D相机

        使用方法:

sudo chmod +x percipio-viewer.2.3.8
./percipio-viewer.2.3.8

         就可以打开软件查看是否可用。

         软件介绍可以参考官方的介绍Percipio Viewer 用户指南 — PercipioDC V 2.4.0 documentation

5. sdk示例测试

   在 camport3/sample/build/bin 目录下生成若干编译生成的可执行文件。

sudo ./SimpleView_FetchFrame
sudo ./ListDevices

6. 如果以上配置有问题,解决办法

     首先 测试相机ip是否配置正确

           看ping 192.168.1.160 是否设置成功,如果ping成功,但是运行示例还是找不到设置,如以下所示。

  

 

 解决办法: ListDevices或者PercipioViewer都是用的是udp广播协议,可以检查以下本地防火墙又没有限制,关闭就可以了

systemctl stop firewalld

如果显示如下信息就代表安装成功了

  • 0
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
以下是示例代码: ``` #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <libusb.h> #define VENDOR_ID 0x04b4 #define PRODUCT_ID 0x02f8 #define EP_OUT 0x02 #define EP_IN 0x81 #define CMD_SET_EXPOSURE 0x0b #define CMD_SET_GAIN 0x0c #define CMD_SET_RESOLUTION 0x0d #define CMD_TAKE_PICTURE 0x83 #define RESOLUTION_640x480 0x0001 #define RESOLUTION_1280x720 0x0002 #define RESOLUTION_1920x1080 0x0003 libusb_device_handle *devh = NULL; int timeout_ms = 5000; int send_cmd(uint8_t cmd, const void *data, uint16_t len) { uint8_t buf[64]; memset(buf, 0, sizeof(buf)); buf[0] = cmd; buf[1] = len & 0xff; buf[2] = (len >> 8) & 0xff; if (len > 0) { memcpy(buf + 3, data, len); } int actual; int res = libusb_bulk_transfer(devh, EP_OUT, buf, sizeof(buf), &actual, timeout_ms); if (res == 0 && actual != sizeof(buf)) { res = LIBUSB_ERROR_OTHER; } return res; } int recv_cmd(uint8_t *cmd, void *data, uint16_t *len) { uint8_t buf[64]; int actual; int res = libusb_bulk_transfer(devh, EP_IN, buf, sizeof(buf), &actual, timeout_ms); if (res == 0 && actual != sizeof(buf)) { res = LIBUSB_ERROR_OTHER; } if (res == 0) { *cmd = buf[0]; *len = buf[1] | (buf[2] << 8); if (*len > 0 && *len <= sizeof(buf) - 3) { memcpy(data, buf + 3, *len); } else { *len = 0; } } return res; } int set_exposure(uint8_t exposure) { return send_cmd(CMD_SET_EXPOSURE, &exposure, sizeof(exposure)); } int set_gain(uint8_t gain) { return send_cmd(CMD_SET_GAIN, &gain, sizeof(gain)); } int set_resolution(uint16_t resolution) { return send_cmd(CMD_SET_RESOLUTION, &resolution, sizeof(resolution)); } int take_picture(const char *filename) { FILE *fp = fopen(filename, "wb"); if (!fp) { return -1; } int res = send_cmd(CMD_TAKE_PICTURE, NULL, 0); if (res == 0) { uint8_t cmd; uint16_t len; res = recv_cmd(&cmd, NULL, &len); if (res == 0 && cmd == CMD_TAKE_PICTURE && len <= 64*1024) { uint8_t buf[64*1024]; uint16_t offset = 0; while (offset < len) { uint16_t count = len - offset; if (count > sizeof(buf)) { count = sizeof(buf); } uint16_t actual; res = libusb_bulk_transfer(devh, EP_IN, buf, count, &actual, timeout_ms); if (res == 0 && actual != count) { res = LIBUSB_ERROR_OTHER; } if (res == 0) { size_t n = fwrite(buf, 1, actual, fp); if (n != actual) { res = -1; break; } offset += actual; } } } } fclose(fp); return res; } int main(int argc, char *argv[]) { libusb_init(NULL); devh = libusb_open_device_with_vid_pid(NULL, VENDOR_ID, PRODUCT_ID); if (devh) { uint8_t exposure = 50; // set the exposure to 50ms uint8_t gain = 0x08; // set the gain to 8x uint16_t resolution = RESOLUTION_640x480; // set the resolution to 640x480 set_exposure(exposure); set_gain(gain); set_resolution(resolution); take_picture("image.jpg"); libusb_close(devh); } libusb_exit(NULL); return 0; } ``` 这是一个基于libusb库的示例代码,用于调用图漾网络深度相机进行拍照并保存图像。您需要根据自己的实际情况进行修改,并保证所使用的USB设备的厂商ID和产品ID与图漾网络深度相机一致。
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值