mirror of
https://github.com/Motion-Project/motion.git
synced 2026-02-05 04:21:32 -05:00
Revise name to ctx_images
This commit is contained in:
16
src/alg.c
16
src/alg.c
@@ -27,7 +27,7 @@ struct segment {
|
||||
* alg_locate_center_size
|
||||
* Locates the center and size of the movement.
|
||||
*/
|
||||
void alg_locate_center_size(struct images *imgs, int width, int height, struct ctx_coord *cent)
|
||||
void alg_locate_center_size(struct ctx_images *imgs, int width, int height, struct ctx_coord *cent)
|
||||
{
|
||||
unsigned char *out = imgs->img_motion.image_norm;
|
||||
int *labels = imgs->labels;
|
||||
@@ -175,7 +175,7 @@ void alg_locate_center_size(struct images *imgs, int width, int height, struct c
|
||||
* alg_draw_location
|
||||
* Draws a box around the movement.
|
||||
*/
|
||||
void alg_draw_location(struct ctx_coord *cent, struct images *imgs, int width, unsigned char *new,
|
||||
void alg_draw_location(struct ctx_coord *cent, struct ctx_images *imgs, int width, unsigned char *new,
|
||||
int style, int mode, int process_thisframe)
|
||||
{
|
||||
unsigned char *out = imgs->img_motion.image_norm;
|
||||
@@ -243,7 +243,7 @@ void alg_draw_location(struct ctx_coord *cent, struct images *imgs, int width, u
|
||||
* alg_draw_red_location
|
||||
* Draws a RED box around the movement.
|
||||
*/
|
||||
void alg_draw_red_location(struct ctx_coord *cent, struct images *imgs, int width, unsigned char *new,
|
||||
void alg_draw_red_location(struct ctx_coord *cent, struct ctx_images *imgs, int width, unsigned char *new,
|
||||
int style, int mode, int process_thisframe)
|
||||
{
|
||||
unsigned char *out = imgs->img_motion.image_norm;
|
||||
@@ -364,7 +364,7 @@ void alg_draw_red_location(struct ctx_coord *cent, struct images *imgs, int widt
|
||||
*/
|
||||
void alg_noise_tune(struct ctx_cam *cam, unsigned char *new)
|
||||
{
|
||||
struct images *imgs = &cam->imgs;
|
||||
struct ctx_images *imgs = &cam->imgs;
|
||||
int i;
|
||||
unsigned char *ref = imgs->ref;
|
||||
int diff, sum = 0, count = 0;
|
||||
@@ -524,7 +524,7 @@ static int iflood(int x, int y, int width, int height,
|
||||
*/
|
||||
static int alg_labeling(struct ctx_cam *cam)
|
||||
{
|
||||
struct images *imgs = &cam->imgs;
|
||||
struct ctx_images *imgs = &cam->imgs;
|
||||
unsigned char *out = imgs->img_motion.image_norm;
|
||||
int *labels = imgs->labels;
|
||||
int ix, iy, pixelpos;
|
||||
@@ -940,7 +940,7 @@ void alg_tune_smartmask(struct ctx_cam *cam)
|
||||
*/
|
||||
int alg_diff_standard(struct ctx_cam *cam, unsigned char *new)
|
||||
{
|
||||
struct images *imgs = &cam->imgs;
|
||||
struct ctx_images *imgs = &cam->imgs;
|
||||
int i, diffs = 0;
|
||||
int noise = cam->noise;
|
||||
int smartmask_speed = cam->smartmask_speed;
|
||||
@@ -996,7 +996,7 @@ int alg_diff_standard(struct ctx_cam *cam, unsigned char *new)
|
||||
*/
|
||||
static char alg_diff_fast(struct ctx_cam *cam, int max_n_changes, unsigned char *new)
|
||||
{
|
||||
struct images *imgs = &cam->imgs;
|
||||
struct ctx_images *imgs = &cam->imgs;
|
||||
int i, diffs = 0, step = imgs->motionsize/10000;
|
||||
int noise = cam->noise;
|
||||
unsigned char *ref = imgs->ref;
|
||||
@@ -1045,7 +1045,7 @@ int alg_diff(struct ctx_cam *cam, unsigned char *new)
|
||||
*/
|
||||
int alg_lightswitch(struct ctx_cam *cam, int diffs)
|
||||
{
|
||||
struct images *imgs = &cam->imgs;
|
||||
struct ctx_images *imgs = &cam->imgs;
|
||||
|
||||
if (cam->conf.lightswitch_percent < 0)
|
||||
cam->conf.lightswitch_percent = 0;
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
|
||||
struct ctx_coord;
|
||||
|
||||
void alg_locate_center_size(struct images *, int width, int height, struct ctx_coord *);
|
||||
void alg_draw_location(struct ctx_coord *, struct images *, int width, unsigned char *, int, int, int);
|
||||
void alg_draw_red_location(struct ctx_coord *, struct images *, int width, unsigned char *, int, int, int);
|
||||
void alg_locate_center_size(struct ctx_images *, int width, int height, struct ctx_coord *);
|
||||
void alg_draw_location(struct ctx_coord *, struct ctx_images *, int width, unsigned char *, int, int, int);
|
||||
void alg_draw_red_location(struct ctx_coord *, struct ctx_images *, int width, unsigned char *, int, int, int);
|
||||
int alg_diff(struct ctx_cam *cam, unsigned char *);
|
||||
int alg_diff_standard(struct ctx_cam *cam, unsigned char *);
|
||||
int alg_lightswitch(struct ctx_cam *cam, int diffs);
|
||||
|
||||
@@ -538,7 +538,7 @@ static void motion_remove_pid(void)
|
||||
static void motion_detected(struct ctx_cam *cam, int dev, struct ctx_image_data *img)
|
||||
{
|
||||
struct config *conf = &cam->conf;
|
||||
struct images *imgs = &cam->imgs;
|
||||
struct ctx_images *imgs = &cam->imgs;
|
||||
struct ctx_coord *location = &img->location;
|
||||
|
||||
/* Draw location */
|
||||
|
||||
44
src/motion.h
44
src/motion.h
@@ -11,7 +11,7 @@
|
||||
#define _INCLUDE_MOTION_H
|
||||
|
||||
/* Forward declarations, used in functional definitions of headers */
|
||||
struct images;
|
||||
struct ctx_images;
|
||||
struct ctx_image_data;
|
||||
struct ctx_dbse;
|
||||
|
||||
@@ -250,39 +250,7 @@ struct ctx_image_data {
|
||||
int total_labels;
|
||||
};
|
||||
|
||||
struct stream_data {
|
||||
unsigned char *jpeg_data; /* Image compressed as JPG */
|
||||
long jpeg_size; /* The number of bytes for jpg */
|
||||
int cnct_count; /* Counter of the number of connections */
|
||||
};
|
||||
|
||||
/*
|
||||
* DIFFERENCES BETWEEN imgs.width, conf.width AND rotate_data.cap_width
|
||||
* (and the corresponding height values, of course)
|
||||
* ===========================================================================
|
||||
* Location Purpose
|
||||
*
|
||||
* conf The values in conf reflect width and height set in the
|
||||
* configuration file. These can be set via http remote control,
|
||||
* but they are not used internally by Motion, so it won't break
|
||||
* anything. These values are transferred to imgs in vid_start.
|
||||
*
|
||||
* imgs The values in imgs are the actual output dimensions. Normally
|
||||
* the output dimensions are the same as the capture dimensions,
|
||||
* but for 90 or 270 degrees rotation, they are not. E.g., if
|
||||
* you capture at 320x240, and rotate 90 degrees, the output
|
||||
* dimensions are 240x320.
|
||||
* These values are set from the conf values in vid_start, or
|
||||
* from the first JPEG image in netcam_start. For 90 or 270
|
||||
* degrees rotation, they are swapped in rotate_init.
|
||||
*
|
||||
* rotate_data The values in rotate_data are named cap_width and cap_height,
|
||||
* and contain the capture dimensions. The difference between
|
||||
* capture and output dimensions is explained above.
|
||||
* These values are set in rotate_init.
|
||||
*/
|
||||
|
||||
struct images {
|
||||
struct ctx_images {
|
||||
struct ctx_image_data *image_ring; /* The base address of the image ring buffer */
|
||||
int image_ring_size;
|
||||
int image_ring_in; /* Index in image ring buffer we last added a image into */
|
||||
@@ -326,6 +294,12 @@ struct images {
|
||||
int largest_label;
|
||||
};
|
||||
|
||||
struct stream_data {
|
||||
unsigned char *jpeg_data; /* Image compressed as JPG */
|
||||
long jpeg_size; /* The number of bytes for jpg */
|
||||
int cnct_count; /* Counter of the number of connections */
|
||||
};
|
||||
|
||||
enum FLIP_TYPE {
|
||||
FLIP_TYPE_NONE,
|
||||
FLIP_TYPE_HORIZONTAL,
|
||||
@@ -368,7 +342,7 @@ struct ctx_cam {
|
||||
unsigned int log_type;
|
||||
|
||||
struct config conf;
|
||||
struct images imgs;
|
||||
struct ctx_images imgs;
|
||||
struct trackoptions track;
|
||||
int track_posx;
|
||||
int track_posy;
|
||||
|
||||
@@ -612,7 +612,7 @@ static void put_ppm_bgr24_file(FILE *picture, unsigned char *image, int width, i
|
||||
void overlay_smartmask(struct ctx_cam *cam, unsigned char *out)
|
||||
{
|
||||
int i, x, v, width, height, line;
|
||||
struct images *imgs = &cam->imgs;
|
||||
struct ctx_images *imgs = &cam->imgs;
|
||||
unsigned char *smartmask = imgs->smartmask_final;
|
||||
unsigned char *out_y, *out_u, *out_v;
|
||||
|
||||
@@ -656,7 +656,7 @@ void overlay_smartmask(struct ctx_cam *cam, unsigned char *out)
|
||||
void overlay_fixed_mask(struct ctx_cam *cam, unsigned char *out)
|
||||
{
|
||||
int i, x, v, width, height, line;
|
||||
struct images *imgs = &cam->imgs;
|
||||
struct ctx_images *imgs = &cam->imgs;
|
||||
unsigned char *mask = imgs->mask;
|
||||
unsigned char *out_y, *out_u, *out_v;
|
||||
|
||||
@@ -700,7 +700,7 @@ void overlay_fixed_mask(struct ctx_cam *cam, unsigned char *out)
|
||||
void overlay_largest_label(struct ctx_cam *cam, unsigned char *out)
|
||||
{
|
||||
int i, x, v, width, height, line;
|
||||
struct images *imgs = &cam->imgs;
|
||||
struct ctx_images *imgs = &cam->imgs;
|
||||
int *labels = imgs->labels;
|
||||
unsigned char *out_y, *out_u, *out_v;
|
||||
|
||||
|
||||
26
src/track.c
26
src/track.c
@@ -50,22 +50,22 @@ static unsigned int servo_center(struct ctx_cam *cam, int xoff, int yoff);
|
||||
static unsigned int stepper_center(struct ctx_cam *cam, int xoff, int yoff);
|
||||
static unsigned int iomojo_center(struct ctx_cam *cam, int xoff, int yoff);
|
||||
|
||||
static unsigned int stepper_move(struct ctx_cam *cam, struct ctx_coord *cent, struct images *imgs);
|
||||
static unsigned int stepper_move(struct ctx_cam *cam, struct ctx_coord *cent, struct ctx_images *imgs);
|
||||
static unsigned int servo_move(struct ctx_cam *cam, struct ctx_coord *cent,
|
||||
struct images *imgs, unsigned int manual);
|
||||
static unsigned int iomojo_move(struct ctx_cam *cam, int dev, struct ctx_coord *cent, struct images *imgs);
|
||||
struct ctx_images *imgs, unsigned int manual);
|
||||
static unsigned int iomojo_move(struct ctx_cam *cam, int dev, struct ctx_coord *cent, struct ctx_images *imgs);
|
||||
|
||||
#ifdef HAVE_V4L2
|
||||
static unsigned int lqos_center(struct ctx_cam *cam, int dev, int xoff, int yoff);
|
||||
static unsigned int lqos_move(struct ctx_cam *cam, int dev, struct ctx_coord *cent,
|
||||
struct images *imgs, unsigned int manual);
|
||||
struct ctx_images *imgs, unsigned int manual);
|
||||
static unsigned int uvc_center(struct ctx_cam *cam, int dev, int xoff, int yoff);
|
||||
static unsigned int uvc_move(struct ctx_cam *cam, int dev, struct ctx_coord *cent,
|
||||
struct images *imgs, unsigned int manual);
|
||||
struct ctx_images *imgs, unsigned int manual);
|
||||
#endif /* HAVE_V4L2 */
|
||||
|
||||
static unsigned int generic_move(struct ctx_cam *cam, enum track_action action, unsigned int manual,
|
||||
int xoff, int yoff, struct ctx_coord *cent, struct images *imgs);
|
||||
int xoff, int yoff, struct ctx_coord *cent, struct ctx_images *imgs);
|
||||
|
||||
|
||||
/* Add a call to your functions here: */
|
||||
@@ -115,7 +115,7 @@ unsigned int track_center(struct ctx_cam *cam, int dev,
|
||||
}
|
||||
|
||||
/* Add a call to your functions here: */
|
||||
unsigned int track_move(struct ctx_cam *cam, int dev, struct ctx_coord *cent, struct images *imgs,
|
||||
unsigned int track_move(struct ctx_cam *cam, int dev, struct ctx_coord *cent, struct ctx_images *imgs,
|
||||
unsigned int manual)
|
||||
{
|
||||
|
||||
@@ -249,7 +249,7 @@ static unsigned int stepper_center(struct ctx_cam *cam, int x_offset, int y_offs
|
||||
}
|
||||
|
||||
static unsigned int stepper_move(struct ctx_cam *cam,
|
||||
struct ctx_coord *cent, struct images *imgs)
|
||||
struct ctx_coord *cent, struct ctx_images *imgs)
|
||||
{
|
||||
unsigned int command = 0, data = 0;
|
||||
|
||||
@@ -400,7 +400,7 @@ static unsigned int servo_position(struct ctx_cam *cam, unsigned int motor)
|
||||
*
|
||||
*/
|
||||
static unsigned int servo_move(struct ctx_cam *cam, struct ctx_coord *cent,
|
||||
struct images *imgs, unsigned int manual)
|
||||
struct ctx_images *imgs, unsigned int manual)
|
||||
{
|
||||
unsigned int command = 0;
|
||||
unsigned int data = 0;
|
||||
@@ -757,7 +757,7 @@ static unsigned int iomojo_center(struct ctx_cam *cam, int x_offset, int y_offse
|
||||
}
|
||||
|
||||
static unsigned int iomojo_move(struct ctx_cam *cam, int dev, struct ctx_coord *cent,
|
||||
struct images *imgs)
|
||||
struct ctx_images *imgs)
|
||||
{
|
||||
char command[5];
|
||||
int direction = 0;
|
||||
@@ -876,7 +876,7 @@ static unsigned int lqos_center(struct ctx_cam *cam, int dev, int x_angle, int y
|
||||
}
|
||||
|
||||
static unsigned int lqos_move(struct ctx_cam *cam, int dev, struct ctx_coord *cent,
|
||||
struct images *imgs, unsigned int manual)
|
||||
struct ctx_images *imgs, unsigned int manual)
|
||||
{
|
||||
int delta_x = cent->x - (imgs->width / 2);
|
||||
int delta_y = cent->y - (imgs->height / 2);
|
||||
@@ -1117,7 +1117,7 @@ static unsigned int uvc_center(struct ctx_cam *cam, int dev, int x_angle, int y_
|
||||
}
|
||||
|
||||
static unsigned int uvc_move(struct ctx_cam *cam, int dev, struct ctx_coord *cent,
|
||||
struct images *imgs, unsigned int manual)
|
||||
struct ctx_images *imgs, unsigned int manual)
|
||||
{
|
||||
/* RELATIVE MOVING : Act.Position +/- X and Y */
|
||||
|
||||
@@ -1306,7 +1306,7 @@ static unsigned int uvc_move(struct ctx_cam *cam, int dev, struct ctx_coord *cen
|
||||
#endif /* HAVE_V4L2 */
|
||||
|
||||
static unsigned int generic_move(struct ctx_cam *cam, enum track_action action, unsigned int manual,
|
||||
int xoff, int yoff, struct ctx_coord *cent, struct images *imgs)
|
||||
int xoff, int yoff, struct ctx_coord *cent, struct ctx_images *imgs)
|
||||
{
|
||||
char fmtcmd[PATH_MAX];
|
||||
cam->track_posx += cent->x;
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
extern struct trackoptions track_template;
|
||||
|
||||
unsigned int track_center(struct ctx_cam *cam, int, unsigned int, int, int);
|
||||
unsigned int track_move(struct ctx_cam *cam, int, struct ctx_coord *, struct images *, unsigned int);
|
||||
unsigned int track_move(struct ctx_cam *cam, int, struct ctx_coord *, struct ctx_images *, unsigned int);
|
||||
|
||||
enum track_action { TRACK_CENTER, TRACK_MOVE };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user