Skip to content

Commit

Permalink
Fixing crop transformation after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
eldakms committed May 13, 2016
1 parent ff3837c commit 27b7c72
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Source/Readers/ImageReader/ImageConfigHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ class ImageConfigHelper
return m_cropType == CropType::MultiView10;
}

static CropType ParseCropType(const std::string &src);

private:
ImageConfigHelper(const ImageConfigHelper&) = delete;
ImageConfigHelper& operator=(const ImageConfigHelper&) = delete;

CropType ParseCropType(const std::string &src);

std::string m_mapPath;
std::vector<StreamDescriptionPtr> m_streams;
ImageLayoutKind m_dataFormat;
Expand Down
9 changes: 5 additions & 4 deletions Source/Readers/ImageReader/ImageTransformers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ struct ImageSequenceData : DenseSequenceData

ImageTransformerBase::ImageTransformerBase(const ConfigParameters& readerConfig) : m_imageElementType(0)
{
m_imageConfig = std::make_unique<ImageConfigHelper>(readerConfig);
m_seed = readerConfig(L"seed", 0u);
}

Expand Down Expand Up @@ -106,9 +105,11 @@ CropTransformer::CropTransformer(const ConfigParameters& config) : ImageTransfor

m_jitterType = ParseJitterType(config(L"jitterType", ""));

m_cropType = ImageConfigHelper::ParseCropType(config(L"cropType", ""));

if (!config.ExistsCurrent(L"hflip"))
{
m_hFlip = m_imageConfig->GetCropType() == CropType::Random;
m_hFlip = m_cropType == CropType::Random;
}
else
{
Expand Down Expand Up @@ -152,9 +153,9 @@ void CropTransformer::Apply(size_t id, cv::Mat &mat)
RuntimeError("Jitter type currently not implemented.");
}

int viewIndex = m_imageConfig->IsMultiViewCrop() ? (int)(id % 10) : 0;
int viewIndex = m_cropType == CropType::MultiView10 ? (int)(id % 10) : 0;

mat = mat(GetCropRect(m_imageConfig->GetCropType(), viewIndex, mat.rows, mat.cols, ratio, *rng));
mat = mat(GetCropRect(m_cropType, viewIndex, mat.rows, mat.cols, ratio, *rng));
if ((m_hFlip && std::bernoulli_distribution()(*rng)) ||
viewIndex >= 5)
{
Expand Down
2 changes: 0 additions & 2 deletions Source/Readers/ImageReader/ImageTransformers.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ class ImageTransformerBase : public Transformer
virtual void Apply(size_t id, cv::Mat &from) = 0;

protected:
std::unique_ptr<ImageConfigHelper> m_imageConfig;

StreamDescription m_inputStream;
StreamDescription m_outputStream;
unsigned int m_seed;
Expand Down

0 comments on commit 27b7c72

Please sign in to comment.