aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Communication/PMR/Diagnostics/ValueComponentState.pb-c.c
blob: 0dfc42f2c8e99ed8a0569f3de536ba6ddb89c34e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/* Generated by the protocol buffer compiler.  DO NOT EDIT! */
/* Generated from: ValueComponentState.proto */

/* Do not generate deprecated warnings for self */
#ifndef PROTOBUF_C__NO_DEPRECATED
#define PROTOBUF_C__NO_DEPRECATED
#endif

#include "ValueComponentState.pb-c.h"
void   value_component_state__init
                     (ValueComponentState         *message)
{
  static const ValueComponentState init_value = VALUE_COMPONENT_STATE__INIT;
  *message = init_value;
}
size_t value_component_state__get_packed_size
                     (const ValueComponentState *message)
{
  assert(message->base.descriptor == &value_component_state__descriptor);
  return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
}
size_t value_component_state__pack
                     (const ValueComponentState *message,
                      uint8_t       *out)
{
  assert(message->base.descriptor == &value_component_state__descriptor);
  return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
}
size_t value_component_state__pack_to_buffer
                     (const ValueComponentState *message,
                      ProtobufCBuffer *buffer)
{
  assert(message->base.descriptor == &value_component_state__descriptor);
  return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
}
ValueComponentState *
       value_component_state__unpack
                     (ProtobufCAllocator  *allocator,
                      size_t               len,
                      const uint8_t       *data)
{
  return (ValueComponentState *)
     protobuf_c_message_unpack (&value_component_state__descriptor,
                                allocator, len, data);
}
void   value_component_state__free_unpacked
                     (ValueComponentState *message,
                      ProtobufCAllocator *allocator)
{
  if(!message)
    return;
  assert(message->base.descriptor == &value_component_state__descriptor);
  protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
}
static const ProtobufCFieldDescriptor value_component_state__field_descriptors[2] =
{
  {
    "Component",
    1,
    PROTOBUF_C_LABEL_OPTIONAL,
    PROTOBUF_C_TYPE_ENUM,
    offsetof(ValueComponentState, has_component),
    offsetof(ValueComponentState, component),
    &value_component__descriptor,
    NULL,
    0,             /* flags */
    0,NULL,NULL    /* reserved1,reserved2, etc */
  },
  {
    "Value",
    2,
    PROTOBUF_C_LABEL_OPTIONAL,
    PROTOBUF_C_TYPE_DOUBLE,
    offsetof(ValueComponentState, has_value),
    offsetof(ValueComponentState, value),
    NULL,
    NULL,
    0,             /* flags */
    0,NULL,NULL    /* reserved1,reserved2, etc */
  },
};
static const unsigned value_component_state__field_indices_by_name[] = {
  0,   /* field[0] = Component */
  1,   /* field[1] = Value */
};
static const ProtobufCIntRange value_component_state__number_ranges[1 + 1] =
{
  { 1, 0 },
  { 0, 2 }
};
const ProtobufCMessageDescriptor value_component_state__descriptor =
{
  PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC,
  "ValueComponentState",
  "ValueComponentState",
  "ValueComponentState",
  "",
  sizeof(ValueComponentState),
  2,
  value_component_state__field_descriptors,
  value_component_state__field_indices_by_name,
  1,  value_component_state__number_ranges,
  (ProtobufCMessageInit) value_component_state__init,
  NULL,NULL,NULL    /* reserved[123] */
};
)*hist.Vhist(0,j)); } return sqrt(res); } double TrackingFunctionPF::calc(const double* x) const{ Rect rect=rectFromRow(x); if(rect.area()==0){ return 2.0; } return _origHist.dist(TrackingHistogram(_image(rect),_nh,_ns,_nv)); } TrackingFunctionPF::TrackingFunctionPF(const Mat& chosenRect):_nh(HIST_SIZE),_ns(HIST_SIZE),_nv(HIST_SIZE),_origHist(chosenRect,_nh,_ns,_nv){ } void TrackingFunctionPF::update(const Mat& image){ _image=image; TrackingHistogram hist(image,_nh,_ns,_nv); } void TrackingFunctionPF::correctParams(double* pt)const{ pt[0]=CLIP(pt[0],0.0,_image.cols+0.9); pt[1]=CLIP(pt[1],0.0,_image.rows+0.9); pt[2]=CLIP(pt[2],0.0,_image.cols+0.9); pt[3]=CLIP(pt[3],0.0,_image.rows+0.9); if(pt[0]>pt[2]){ double tmp=pt[0]; pt[0]=pt[2]; pt[2]=tmp; } if(pt[1]>pt[3]){ double tmp=pt[1]; pt[1]=pt[3]; pt[3]=tmp; } } Rect TrackingFunctionPF::rectFromRow(const double* row){ return Rect(Point_<int>((int)row[0],(int)row[1]),Point_<int>((int)row[2],(int)row[3])); } }