資源簡介
樹莓派通過官方攝像頭進(jìn)行運(yùn)動(dòng)檢測,當(dāng)檢測到有動(dòng)作發(fā)生,將該幀圖像通過tcp協(xié)議實(shí)時(shí)傳輸?shù)絧c端
代碼片段和文件信息
#include?
#include?
#include?
#include?
#include?
#include?
#include????//gpio控制蜂鳴器
#include?????????????//時(shí)間函數(shù)頭
#include?“opencv.hpp“
#include?
#include?
#include?
#include??
#include?
using?namespace?cv;
using?namespace?std;
void?error(const?char?*msg)
{
????perror(msg);
????exit(0);
}
int?main()
{?
????int?sockfd?portno?n;
????struct?sockaddr_in?serv_addr;
????struct?hostent?*server;
????portno?=?atoi(“8888“);
????sockfd?=?socket(AF_INET?SOCK_STREAM?0);
????if?(sockfd?0)
????????error(“ERROR?opening?socket“);
????server?=?gethostbyname(“192.16
評(píng)論
共有 條評(píng)論