资源简介
motion-3.2.11.1.tar.gz 源码 用于视频监控的运动检测 远程监控等
代码片段和文件信息
/* alg.c
*
* Detect changes in a video stream.
* Copyright 2001 by Jeroen Vreeken (pe1rxq@amsat.org)
* This software is distributed under the GNU public license version 2
* See also the file ‘COPYING‘.
*
*/
#include “motion.h“
#include “alg.h“
#ifdef __MMX__
#define HAVE_MMX
#include “mmx.h“
#endif
#define MAX2(x y) ((x) > (y) ? (x) : (y))
#define MAX3(x y z) ((x) > (y) ? ((x) > (z) ? (x) : (z)) : ((y) > (z) ? (y) : (z)))
/* locate the center and size of the movement. */
void alg_locate_center_size(struct images *imgs int width int height struct coord *cent)
{
unsigned char *out = imgs->out;
int *labels = imgs->labels;
int x y centc = 0 xdist = 0 ydist = 0;
cent->x = 0;
cent->y = 0;
cent->maxx = 0;
cent->maxy = 0;
cent->minx = width;
cent->miny = height;
/* If Labeling enabled - locate center of largest labelgroup */
if (imgs->labelsize_max) {
/* Locate largest labelgroup */
for (y = 0; y < height; y++) {
for (x = 0; x < width; x++) {
if (*(labels++)&32768) {
cent->x += x;
cent->y += y;
centc++;
}
}
}
} else {
/* Locate movement */
for (y = 0; y < height; y++) {
for (x = 0; x < width; x++) {
if (*(out++)) {
cent->x += x;
cent->y += y;
centc++;
}
}
}
}
if (centc) {
cent->x = cent->x / centc;
cent->y = cent->y / centc;
}
/* Now we find the size of the Motion */
/* First reset pointers back to initial value */
centc = 0;
labels = imgs->labels;
out = imgs->out;
/* If Labeling then we find the area around largest labelgroup instead */
if (imgs->labelsize_max) {
for (y = 0; y < height; y++) {
for (x = 0; x < width; x++) {
if (*(labels++)&32768) {
if (x > cent->x)
xdist += x - cent->x;
else if (x < cent->x)
xdist += cent->x - x;
if (y > cent->y)
ydist += y - cent->y;
else if (y < cent->y)
ydist += cent->y - y;
centc++;
}
}
}
} else {
for (y = 0; y < height; y++) {
for (x = 0; x < width; x++) {
if (*(out++)) {
if (x > cent->x)
xdist += x - cent->x;
else if (x < cent->x)
xdist += cent->x - x;
if (y > cent->y)
ydist += y - cent->y;
else if (y < cent->y)
ydist += cent->y - y;
centc++;
}
}
}
- 上一篇:Modbus主从站仿真程序
- 下一篇:基于STM32F103的4*5矩阵按键
相关资源
- umeshmotion网格推移
- Genymotion-ARM-Translation_v1.1
- 情感化设计 Emotional Design 中文版
- Unity3D的仿真手模型,适用Leapmotion与
- 翠欧ZMotion Basic 编程手册
- Leap Motion与HTC Vive配合使用笔记
- leapmotion开发手册中文
- genymotion 2.8.0 mac 破解包
- [中文]Leap Motion官方开发文档
- s71200_motion_control
- Image Correlation for Shape Motion and Deforma
- LeapMotion_CoreAsset_Orion_4.1.5
- EmotionRecognition.rar
- genymotion的arm支持库地址
- genymotion-arm-translation附带脚本
- Statistical Monitoring of Clinical Trials(Le
- Principles of Robot Motion_ Theory Algorithms
- 运动历史图motion history image,MHI
- 西门子simotion中文手册.pdf
- PLCopen part1&part2;
- GenymotionV2.8.1 破解版 Crack 可设置3G/4
-
Incremental Sampling-ba
sed Algorithms for O - Leapmotion开发SDK文档
- mtion CPU Q173D OS
- The Space and Motion of Communicating Agents
- motion-perfect2指令中文手册
- leapmotion拼图
- Simotion-ST编程说明书中文
- 博世力士乐IndraMotion MTX micro数控教程
- Genymotion-ARM-Translation_for_8.0
评论
共有 条评论