Revision 14c71a7d vision/src/v2v3_converter.cpp

View differences:

vision/src/v2v3_converter.cpp
1
#nclude <ros/ros.h>
1
#include <ros/ros.h>
2 2
#include <stdio.h>
3 3
#include <vision/TargetDescriptor.h>
4 4
#include <image_transport/image_transport.h>
......
8 8
ros::Publisher pub; // publishes Point
9 9
ros::Publisher img_pub; //publishes Image with only blob showing
10 10

  
11
int hk = 15; // target hsv values
11
int hk = 216; // target hsv values
12 12
int sk = 255;
13 13
int vk = 255;
14 14

  
......
32 32
	return (img->data[p + img->width] == img->data[p]);
33 33
}
34 34

  
35
int min(int a, int b){
36
	if (a <= b) return a;
37
	else return b;
38
}
39

  
40
int max(int a, int b){
41
	if (a >= b) return a;
42
	else return b;
43
}
44

  
35 45
/* Checks for any adjacent pixel, ensuring a continuous blob.
36 46
 */
37 47
bool hasAnAdjacent(sensor_msgs::Image * image, int j){
......
122 132
      int h;
123 133
      int s;
124 134
      int v; 
125
      int min;
135
      int low;
126 136

  
127 137
      // get min, max
128 138
      v = max(max(orig->data[i], orig->data[i+1]), orig->data[i+2]);
129
      min = min(min(orig->data[i], orig->data[i+1]), orig->data[i+2]);
139
      low = min(min(orig->data[i], orig->data[i+1]), orig->data[i+2]);
130 140

  
131 141
      // set s
132 142
      if (v != 0){
133
      s = (v - min) / v; 
143
      s = (v - low) / v; 
134 144
      }
135 145
      else s = 0;
136 146

  

Also available in: Unified diff