35 #include <gtest/gtest.h> 38 #include <calibration_msgs/DenseLaserSnapshot.h> 46 calibration_msgs::DenseLaserSnapshot
buildSnapshot(
double start_range,
double start_intensity,
double increment,
47 const unsigned int H,
const unsigned int W)
49 calibration_msgs::DenseLaserSnapshot snapshot;
51 snapshot.readings_per_scan = W;
52 snapshot.num_scans = H;
54 snapshot.ranges.resize(H*W);
55 snapshot.intensities.resize(H*W);
57 for (
unsigned int i=0; i<H*W; i++)
59 snapshot.ranges[i] = start_range + i*increment;
60 snapshot.intensities[i] = start_intensity + i*increment;
68 static const double eps = 1e-8;
72 for (
int i=0; i<image.rows; i++)
74 for (
int j=0; j<image.cols; j++)
76 printf(
"%3u ", image.at<
unsigned char>(i, j));
86 calibration_msgs::DenseLaserSnapshot snapshot;
93 cv::Mat image = bridge.
toCvMat();
96 ASSERT_TRUE(image.data);
105 EXPECT_EQ( (
int) *((
unsigned char*)(image.data)+0), 0);
106 EXPECT_EQ( (
int) *((
unsigned char*)(image.data)+4*image.step + 9), 255);
112 calibration_msgs::DenseLaserSnapshot snapshot;
117 cv::Mat image = bridge.
toCvMat();
119 ASSERT_TRUE(image.data);
128 EXPECT_EQ( (
int) *((
unsigned char*)(image.data)+5), 0);
129 EXPECT_EQ( (
int) *((
unsigned char*)(image.data)+45), 255);
134 int main(
int argc,
char **argv){
135 testing::InitGoogleTest(&argc, argv);
136 return RUN_ALL_TESTS();
void displayImage(cv::Mat &image)
bool fromIntensity(const calibration_msgs::DenseLaserSnapshot &snapshot, float min_val, float max_val)
static const unsigned int RAYS_PER_SCAN
TEST(CvLaserBridge, easy)
int main(int argc, char **argv)
static const unsigned int NUM_SCANS
calibration_msgs::DenseLaserSnapshot buildSnapshot(double start_range, double start_intensity, double increment, const unsigned int H, const unsigned int W)