Beispiel #1
0
// create a Cartesian image suitable for texture mapping from the raw
// bearing/range measurements; also return a mask of valid image regions
shared_ptr<DidsonCartesian> Didson::getCartesian(int width, int widthTmp) const {
  // generate map for Cartesian image
  vector<int> map;
  int height;
  pair<vector<int>, int> tmp1 = createMapping(width, maxRange(), minRange(),
      consts.bearingFov * 0.5, numBearings(), numRanges());
  map = tmp1.first;
  height = tmp1.second;

  // avoid having to write out the inverse mapping function by creating
  // a map with sufficiently high resolution as a lookup table for the inverse map
  // not ideal, but works...
  vector<int> invMap(consts.numRanges * consts.numBearings);
  vector<int> mapTmp;
  int heightTmp;
  pair<vector<int>, int> tmp2 = createMapping(widthTmp, maxRange(), minRange(),
      consts.bearingFov * 0.5, numBearings(), consts.numRanges);
  mapTmp = tmp2.first;
  heightTmp = tmp2.second;

  int c = 0;
  for (int y = 0; y < heightTmp; y++) {
    for (int x = 0; x < widthTmp; x++) {
      int idx = mapTmp[c];
      if (idx != -1) {
        int icol = x * ((double) width / (double) widthTmp);
        int irow = y * ((double) height / (double) heightTmp);
        int i = irow * width + icol;
        invMap[idx] = i;
      }
      c++;
    }
  }

  shared_ptr<DidsonCartesian> cartesian(new DidsonCartesian(map, invMap));
  cartesian->image = cv::Mat(height, width, CV_8UC1);
  cartesian->mask = cv::Mat(height, width, CV_8UC1);
  for (int i = 0; i < width * height; i++) {
    if (map[i] == -1) {
      cartesian->image.data[i] = 0;
      cartesian->mask.data[i] = 0;
    } else {
      cartesian->image.data[i] = _image.data[map[i]];
      cartesian->mask.data[i] = 255;
    }
  }

  return cartesian;
}
Beispiel #2
0
SpotLight::SpotLight()
{
	m_atten[0]	= 1.f;
	m_atten[1]	= 0.f;
	m_atten[2]	= 0.f;
	m_range		= maxRange();
	m_inner		= maxConeAngle();
	m_outer		= maxConeAngle();
}
Beispiel #3
0
void SpotLight::setRange( float range )
{
	assert( range >= 0.f && range <= maxRange() );
	m_range = range;
}