Revision 14c71a7d
ID | 14c71a7d5ad2769dcf1a98442a6532eb4d5da442 |
Edited and so it works, with the exception of now losing all of the CBlobResults includes when linking. I'm going to figure that out next.
vision/CMakeLists.txt | ||
---|---|---|
23 | 23 |
|
24 | 24 |
rosbuild_add_executable(v2v3_converter src/v2v3_converter.cpp) |
25 | 25 |
rosbuild_add_executable(rviz_interactive_target src/rviz_interactive_target.cpp) |
26 |
rosbuild_add_executable(newConverter src/converteroverwrite.cpp) |
|
27 |
rosbuild_add_executable(opencvdetect src/opencvdetect.cpp) |
|
26 | 28 |
|
27 | 29 |
#common commands for building c++ executables and libraries |
28 | 30 |
#rosbuild_add_library(${PROJECT_NAME} src/example.cpp) |
vision/manifest.xml | ||
---|---|---|
16 | 16 |
<depend package="sensor_msgs"/> |
17 | 17 |
<depend package="visualization_msgs"/> |
18 | 18 |
<depend package="interactive_markers"/> |
19 |
<depend package="cv_bridge"/> |
|
19 | 20 |
|
20 | 21 |
</package> |
21 | 22 |
|
vision/msg_gen/cpp/include/vision/TargetDescriptor.h | ||
---|---|---|
1 |
/* Auto-generated by genmsg_cpp for file /home/parallels/quadrotor/vision/msg/TargetDescriptor.msg */
|
|
1 |
/* Auto-generated by genmsg_cpp for file /home/nstanley/ros_workspace/quadrotor/vision/msg/TargetDescriptor.msg */
|
|
2 | 2 |
#ifndef VISION_MESSAGE_TARGETDESCRIPTOR_H |
3 | 3 |
#define VISION_MESSAGE_TARGETDESCRIPTOR_H |
4 | 4 |
#include <string> |
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