44 if (snapshot.num_scans * snapshot.readings_per_scan != snapshot.intensities.size())
46 ROS_ERROR(
"Got malformed snapshot. Expected [%u x %u]=%u, but snapshot.intensities.size()=%u",
47 snapshot.num_scans, snapshot.readings_per_scan,
48 snapshot.num_scans * snapshot.readings_per_scan,
49 snapshot.intensities.size());
53 fromSnapshot(snapshot, snapshot.intensities, min_val, max_val);
57 void CvLaserBridge::fromSnapshot(
const calibration_msgs::DenseLaserSnapshot& snapshot,
const std::vector<float>& src,
float min_val,
float max_val)
59 assert(snapshot.num_scans * snapshot.readings_per_scan == src.size());
61 cv::Mat_<float> source_image(snapshot.num_scans, snapshot.readings_per_scan, const_cast<float*>(&(src[0])));
63 double range = (max_val - min_val);
64 double scale = 255/range;
65 double shift = -min_val * 255/range;
67 ROS_DEBUG(
"Scale: %f Shift: %f\n", scale, shift);
69 source_image.convertTo(
dest_image_, CV_8UC1, scale, shift);
bool fromIntensity(const calibration_msgs::DenseLaserSnapshot &snapshot, float min_val, float max_val)
void fromSnapshot(const calibration_msgs::DenseLaserSnapshot &snapshot, const std::vector< float > &src, float min_val, float max_val)