⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 axiscamera.h

📁 good luck to everyone!
💻 H
字号:
/********************************************************************************
*  Project   		: FIRST Motor Controller
*  File Name  		: AxisCamera.h          
*  Contributors   	: ELF
*  Creation Date 	: August 12, 2008
*  Revision History	: Source code & revision history maintained at sourceforge.WPI.edu    
*  File Description	: Globally defined values for the FRC Camera API
* 
*  API: Because nivision.h uses C++ style comments, any file including this
*  must be a .cpp instead of .c.
* 
*/
/*----------------------------------------------------------------------------*/
/*        Copyright (c) FIRST 2008.  All Rights Reserved.                     */
/*  Open Source Software - may be modified and shared by FRC teams. The code  */
/*  must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
/*----------------------------------------------------------------------------*/

#ifndef __AXISCAMERA_H__
#define __AXISCAMERA_H__

#include "nivision.h"

/** packet size */
#define DEFAULT_PACKET_SIZE 512
/** port for communicating with camera */
#define CAMERA_PORT 80
/** port for sending video to laptop */
#define VIDEO_TO_PC_PORT 1180
/** how old an image is before it's discarded */
#define CAMERA_IMAGE_STALE_TIME_SEC 2.0  
/** time to wait for a new image in blocking call */
#define MAX_BLOCKING_TIME_SEC 0.5

/*  Enumerated Types */
/** @brief Counters for camera metrics */
enum FrcvCameraMetric {CAM_STARTS, CAM_STOPS, 
	CAM_NUM_IMAGE, CAM_BUFFERS_WRITTEN, CAM_BLOCKING_COUNT,
	
	CAM_SOCKET_OPEN, CAM_SOCKET_INIT_ATTEMPTS, CAM_BLOCKING_TIMEOUT,
	CAM_GETIMAGE_SUCCESS, CAM_GETIMAGE_FAILURE, 
	
	CAM_STALE_IMAGE, CAM_GETIMAGE_BEFORE_INIT, CAM_GETIMAGE_BEFORE_AVAILABLE,
	CAM_READ_JPEG_FAILURE, CAM_PID_SIGNAL_ERR, 
	
	CAM_BAD_IMAGE_SIZE, CAM_HEADER_ERROR};

#define CAM_NUM_METRICS 17

/**
@brief Possible image sizes that you can set on the camera.
*/
enum ImageSize { k640x480, k320x240, k160x120 };

/**
@brief Possible rotation values that you can set on the camera.
*/
enum ImageRotation { ROT_0 = 0, ROT_180 = 180 };

/*  Image Acquisition functions */

/* obtains an image from the camera server */
int GetImage(Image* cameraImage, double *timestamp);
int GetImageBlocking(Image* cameraImage, double *timestamp, double lastImageTimestamp);
/* obtains raw image string to send to PC */
int GetImageData(char** imageData, int* numBytes, double* currentImageTimestamp);
int GetImageDataBlocking(char** imageData, int* numBytes, double* timestamp, double lastImageTimestamp);

/* start the camera server */
void StartImageAcquisition();
void StopImageAcquisition();
void StartImageSignal(int taskId);

/* status & metrics */
int frcCameraInitialized();
int GetCameraMetric(FrcvCameraMetric metric);

/* camera configuration */
int ConfigureCamera(char *configString);
int GetCameraSetting(char *configString, char *cameraResponse);
int GetImageSetting(char *configString, char *cameraResponse);

/* camera task control */
int StartCameraTask();
int StartCameraTask(int frames, int compression, ImageSize resolution, ImageRotation rotation);
int StopCameraTask();

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -