Beispiel #1
0
void MapBackground::CreateMapTileImage(MapTile* pMapTile, void* gResult, uint32 gResultLen, bool isJpg)
{
	if (!IsTileVisible(pMapTile))
	{
		return;
	}
	CIwImage image;
	if (!isJpg)
	{
		//pMapTile->pTexture = g_pNotFoundTexture;
		s3eFile* tempfile = s3eFileOpenFromMemory((void*)gResult, gResultLen);
		image.ReadFile(tempfile);

		//image.LoadFromFile("tiles/r0302322130033033130.png");

		if (image.GetWidth())
		{
			pMapTile->pTexture = new CIwTexture;
			pMapTile->pTexture->CopyFromImage(&image);
			pMapTile->pTexture->Upload();
		}

		s3eFileClose(tempfile);
	}
	else
	{
		JPEGImage(gResult, gResultLen, image);
		pMapTile->pTexture = new CIwTexture;
		pMapTile->pTexture->CopyFromImage(&image);
		pMapTile->pTexture->Upload();
	}
}
Beispiel #2
0
void CameraProvider::update(Image& image)
{
#ifdef CAMERA_INCLUDED
  if(camera)
  {
    image.setImage(const_cast<unsigned char*>(camera->getImage()));
    image.timeStamp = camera->getTimeStamp();
    camera->setSettings(theCameraSettings);
  }
#endif
  DEBUG_RESPONSE("representation:JPEGImage", OUTPUT(idJPEGImage, bin, JPEGImage(image)); );
Beispiel #3
0
void MapBackground::CreateMapTileImage2(MapTile* pMapTile, char* szPath, bool isJpg)
{
	if (!IsTileVisible(pMapTile))
	{
		return;
	}
	CIwImage image;
	if (!isJpg)
	{
		image.LoadFromFile(szPath);
		if (image.GetWidth())
		{
			pMapTile->pTexture = new CIwTexture;
			pMapTile->pTexture->CopyFromImage(&image);
			pMapTile->pTexture->Upload();
		}
	}
	else
	{
		s3eFile* pFile = s3eFileOpen(szPath, "r");

		if (pFile)
		{
			uint32 gResultLen = s3eFileGetSize(pFile);
			void* gResult = (void*)s3eMalloc(gResultLen + 1);

			uint32 test = s3eFileRead(gResult, sizeof(char), gResultLen, pFile);
			gResultLen = test;
			s3eFileClose(pFile);

			JPEGImage(gResult, gResultLen, image);
			pMapTile->pTexture = new CIwTexture;
			pMapTile->pTexture->CopyFromImage(&image);
			pMapTile->pTexture->Upload();

			delete gResult;
		}
	}
}
void ExpCameraProvider::update(Image& image)
{
#ifdef CAMERA_INCLUDED
  ASSERT(!currentImageCamera);
  if(camera->hasImage() && (!lowerCamera->hasImage() || camera->getTimeStamp() < lowerCamera->getTimeStamp()))
  {
    image.setImage(const_cast<unsigned char*>(camera->getImage()));
    lastImageTimeStampLL = camera->getTimeStamp();
    imageTimeStamp = image.timeStamp = std::max(lastImageTimeStamp + 1, (unsigned) (camera->getTimeStamp() / 1000) - SystemCall::getSystemTimeBase());
    camera->setSettings(theCameraSettings);
    camera->writeCameraSettings();
    currentImageCamera = camera;

    imageInfo.prevCamera = imageInfo.camera;
    imageInfo.camera = camera->getCurrentCamera();
  }
  else if(lowerCamera->hasImage())
  {
    image.setImage(const_cast<unsigned char*>(lowerCamera->getSSEImage()));
    lastImageTimeStampLL = lowerCamera->getTimeStamp();
    otherImageTimeStamp = image.timeStamp = std::max(lastImageTimeStamp + 1, (unsigned) (lowerCamera->getTimeStamp() / 1000) - SystemCall::getSystemTimeBase());
    lowerCamera->setSettings(theCameraSettings);
    lowerCamera->writeCameraSettings();
    currentImageCamera = lowerCamera;

    imageInfo.prevCamera = imageInfo.camera;
    imageInfo.camera = lowerCamera->getCurrentCamera();
  }
  imageInfo.whiteBalanced = camera->whiteBalanced && lowerCamera->whiteBalanced;
  imageInfo.toggling = true;
  ASSERT(image.timeStamp >= lastImageTimeStamp);
  lastImageTimeStamp = image.timeStamp;
#else
  imageInfo.whiteBalanced = true;
#endif // CAMERA_INCLUDED
  DEBUG_RESPONSE("representation:JPEGImage", OUTPUT(idJPEGImage, bin, JPEGImage(image)););
void CognitionLogDataProvider::update(Image& image)
{
  if(SystemCall::getMode() == SystemCall::logfileReplay)
  {
    CameraInfo& info = (CameraInfo&) Blackboard::getInstance()["CameraInfo"];
    if(lowFrameRateImage)
    {
      if(lowFrameRateImage->imageUpdated)
        lastImages[info.camera] = lowFrameRateImage->image;
      image = lastImages[info.camera];
    }
    else if(info.width != image.width || info.height != image.height)
      image = Image(true, info.width, info.height);
  }

  static const float distance = 300.f;

  DECLARE_DEBUG_DRAWING3D("representation:Image", "camera");
  IMAGE3D("representation:Image", distance, 0, 0, 0, 0, 0,
          distance * theCameraInfo.width / theCameraInfo.focalLength,
          distance * theCameraInfo.height / theCameraInfo.focalLength,
          image);
  DEBUG_RESPONSE("representation:JPEGImage") OUTPUT(idJPEGImage, bin, JPEGImage(image));
}