Project

General

Profile

Revision b1055c82

IDb1055c828b854143bcc00a315b99ec0386491940

Added by Thomas Mullins about 12 years ago

Nick made some changes to make it compile.

View differences:

vision/CMakeLists.txt
1 1
cmake_minimum_required(VERSION 2.4.6)
2 2
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
3
find_package(OpenCV REQUIRED)
3 4

  
4 5
# Set the build type.  Options are:
5 6
#  Coverage       : w/ debug symbols, w/o optimization, w/ code-coverage
......
30 31
#rosbuild_link_boost(${PROJECT_NAME} thread)
31 32
#rosbuild_add_executable(example examples/example.cpp)
32 33
#target_link_libraries(example ${PROJECT_NAME})
34
target_link_libraries(v2v3_converter ${OpenCV_LIBS}) 
vision/manifest.xml
11 11
  <depend package="roscpp"/>
12 12
  <depend package="tf"/>
13 13
  <depend package="geometry_msgs"/>
14
  <depend package="cv_bridge"/>
15
  <depend package="opencv2"/>
16
  <depend package="image_transport"/>
17
  <depend package="std_msgs"/>
18
  <depend package="sensor_msgs"/>
14 19

  
15 20
</package>
16 21

  
vision/src/v2v3_converter.cpp
2 2
#include <vision/TargetDescriptor.h>
3 3
#include <geometry_msgs/Point.h>
4 4
#include <tf/transform_listener.h>
5
// include opencv
5
#include <opencv/cv.hpp>
6
//#include <cv_bridge/cv_bridge.h>
6 7

  
7 8
ros::Publisher pub;
8 9

  
......
10 11
int sk = 255;
11 12
int vk = 255;
12 13

  
13
bool isRight(CvImagePtr img, int p){
14
bool isRight(cv_bridge::CvImagePtr img, int p){
14 15
	return (img->data[p + 1] == img->data[p]);
15 16
}
16 17

  
17
bool isLeft(CvImagePtr img, int p){
18
bool isLeft(cv_bridge::CvImagePtr img, int p){
18 19
	return (img->data[p - 1] == img->data[p]);
19 20
}
20 21

  
21
bool isUp(CvImagePtr img, int p){
22
	return (img->data[p - img->width * img->nChannels] == img->data[p]);
22
bool isUp(cv_bridge::CvImagePtr img, int p){
23
	return (img->data[p - img->width() * img->channels()] == img->data[p]);
23 24
}
24 25

  
25
bool isDown(CvImagePtr img, int p){
26
bool isDown(cv_bridge::CvImagePtr img, int p){
26 27
	return (img->data[p + img->width * img->nChannels] == img->data[p]);
27 28
}
28 29

  
29
bool hasAnAdjacent(CvImagePtr image, int j){
30
bool hasAnAdjacent(cv_bridge::CvImagePtr image, int j){
30 31
	int nl = image->height; // number of lines
31 32
	int nc = image->width; // number of columns CHECK TO MAKE SURE THIS IS RIGHT AND NOT WITH CHANNELS
32 33
	int pos = j / image->nChannels; 
......
48 49
/* Detects the blobs in an image within above defined constraints. Transforms image into 1 
49 50
 * for pixels in the blob, 0 for not in the blob.
50 51
 */
51
void detectBlobs(CvImagePtr image, int * comX, int * comY, int * area){
52
void detectBlobs(cv_bridge::CvImagePtr image, int * comX, int * comY, int * area){
52 53
	int nl = image->height; // number of lines
53 54
	int nc = image->width * image->nChannels; // number of columns
54 55
	int step = image->widthStep; // effective width
......
108 109

  
109 110
  Image * source = &orig; // pointer to the image
110 111

  
111
  CvImagePtr origRGBImage = toCvCopy(const sensor_msgs::Image& source, 
112
  cv_bridge::CvImagePtr origRGBImage = toCvCopy(const sensor_msgs::Image& source, 
112 113
	const std::string& encoding = "rgb8"); // convert to OpenCV, CHECK FOR SYNTAX
113 114

  
114 115
  // convert to HSV
115 116

  
116
  CvImagePtr HSVImage;
117
  cv_bridge::CvImagePtr HSVImage;
117 118
  cvCvtColor (origRGBImage, HSVImage, CV_RGB2HSV);
118 119

  
119 120
  // detect blob

Also available in: Unified diff