예제 #1
0
  //static
  void GradientsMergeMosaic::mergeMosaicProcessImage(imageType_t const & rImage_p, realType_t dBlackPoint_p,
						     pcl_enum eType_p,
						     int32 shrinkCount_p,
						     int32 featherRadius_p,
						     imageType_t &rSumImageDx_p,
						     imageType_t &rSumImageDy_p,
						     sumMaskImageType_t &rSumMaskImage_p,
						     weightImageType_t &rCountImageDx_p,
						     weightImageType_t &rCountImageDy_p)
  {
#ifdef DEBUG
    int const nCols=rImage_p.Width();
    int const nRows=rImage_p.Height();
    int const nChannels=rImage_p.NumberOfChannels();
#endif
    Assert(nCols==rSumImageDx_p.Width()+1);
    Assert(nRows==rSumImageDx_p.Height());
    Assert(nChannels==rSumImageDx_p.NumberOfChannels());

    Assert(nCols==rSumImageDy_p.Width());
    Assert(nRows==rSumImageDy_p.Height()+1);
    Assert(nChannels==rSumImageDy_p.NumberOfChannels());

    Assert(nCols==rSumMaskImage_p.Width());
    Assert(nRows==rSumMaskImage_p.Height());
    Assert(1==rSumMaskImage_p.NumberOfChannels());

    Assert(eType_p!=GradientsMergeMosaicType::Average || nCols==rCountImageDx_p.Width()+1);
    Assert(eType_p!=GradientsMergeMosaicType::Average || nRows==rCountImageDx_p.Height());
    Assert(eType_p!=GradientsMergeMosaicType::Average || 1==rCountImageDx_p.NumberOfChannels());
    Assert(eType_p!=GradientsMergeMosaicType::Average || nCols==rCountImageDy_p.Width());
    Assert(eType_p!=GradientsMergeMosaicType::Average || nRows==rCountImageDy_p.Height()+1);
    Assert(eType_p!=GradientsMergeMosaicType::Average || 1==rCountImageDy_p.NumberOfChannels());

    Assert(shrinkCount_p>=0);
    Assert(featherRadius_p>=0);
    Assert(dBlackPoint_p>=0.0);
    weightImageType_t maskImage;

    TimeMessage startAddImage("Adding image to data");

    TimeMessage startBinarize("Binarize Image");
    binarizeImage(rImage_p,dBlackPoint_p,maskImage);
    // save this for border computation later
    weightImageType_t fullMask(maskImage);
    startBinarize.Stop();

    // we are doing this because image after StarAlign usually contain aliased pixels.
    // These must not to be used during merge.
    TimeMessage startShrink("Shrinking mask");
    erodeMask(maskImage,shrinkCount_p);
    startShrink.Stop();
    TimeMessage startFeather("Feathering mask");
    featherMask(maskImage,featherRadius_p);
    startFeather.Stop();

    TimeMessage startBorder("Computing border");
    addBorder(fullMask,maskImage);
    fullMask.AllocateData(0,0); // save memory
    startBorder.Stop();

    TimeMessage startSumMask("Creating combined mask");
    addToMask(maskImage,eType_p,rSumMaskImage_p);
    startSumMask.Stop();
    TimeMessage startAddGradients("Adding gradients data");
    addToImage(rImage_p,eType_p,maskImage,rSumImageDx_p,rSumImageDy_p,rCountImageDx_p, rCountImageDy_p);
    startAddGradients.Stop();
  }
예제 #2
0
  //static
  void GradientsHdrComposition::hdrCompositionProcessImage(
							   imageType_t const & rImage_p,
							   int imageNum_p,
							   realType_t dBias_p,
							   realType_t dBlackPoint_p,
							   int32 shrinkCount_p,
							   imageType_t &rSumImageDx_p,
							   imageType_t &rSumImageDy_p,
							   numImageType_t &rDxImage_p,
							   numImageType_t &rDyImage_p)
  {
#ifdef DEBUG
    int const nCols=rImage_p.Width();
    int const nRows=rImage_p.Height();
    int const nChannels=rImage_p.NumberOfChannels();
#endif
    Assert(nCols==rSumImageDx_p.Width()+1);
    Assert(nRows==rSumImageDx_p.Height());
    Assert(nChannels==rSumImageDx_p.NumberOfChannels());

    Assert(nCols==rSumImageDy_p.Width());
    Assert(nRows==rSumImageDy_p.Height()+1);
    Assert(nChannels==rSumImageDy_p.NumberOfChannels());

    Assert(nCols==rDxImage_p.Width());
    Assert(nRows==rDxImage_p.Height());
    Assert(nChannels==rDxImage_p.NumberOfChannels());

    Assert(nCols==rDyImage_p.Width());
    Assert(nRows==rDyImage_p.Height());
    Assert(nChannels==rDyImage_p.NumberOfChannels());

    Assert(shrinkCount_p>=0);
    Assert(dBlackPoint_p>=0.0);

    TimeMessage startAddImage("Adding image to data");

    TimeMessage startBiasImage("Applying bias()");
    imageType_t loggedImage=rImage_p;
    loggedImage.ResetSelections();
    loggedImage-=dBias_p;
    startBiasImage.Stop();

    TimeMessage startLogImage("Applying log()");
    logImage(loggedImage,loggedImage);
    startLogImage.Stop();

    // binarize image to find where background is.
    // actual image is then eroded by shrinkCount to make sure
    // that no aliased pixels are part of the image
    weightImageType_t maskImage;
    TimeMessage startBinarize("Binarize Image");
    binarizeImage(rImage_p,dBlackPoint_p,maskImage);
    TimeMessage startShrink("Shrinking mask");
    erodeMask(maskImage,shrinkCount_p);
    startShrink.Stop();

    TimeMessage startAddGradients("Adding gradients data");
    addToImage(loggedImage,imageNum_p,maskImage,rSumImageDx_p,rSumImageDy_p,rDxImage_p,rDyImage_p);
    startAddGradients.Stop();
  }