Skip to content

Commit

Permalink
Fix tab issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
cha-zhang committed Apr 18, 2016
1 parent bbf9814 commit c811071
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions Source/Readers/ImageReader/ByteReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ByteReader
virtual ~ByteReader() = default;

virtual void Register(size_t seqId, const std::string& path) = 0;
virtual cv::Mat Read(size_t seqId, const std::string& path, bool grayscale) = 0;
virtual cv::Mat Read(size_t seqId, const std::string& path, bool grayscale) = 0;

DISABLE_COPY_AND_MOVE(ByteReader);
};
Expand All @@ -31,7 +31,7 @@ class FileByteReader : public ByteReader
{
public:
void Register(size_t, const std::string&) override {}
cv::Mat Read(size_t seqId, const std::string& path, bool grayscale) override;
cv::Mat Read(size_t seqId, const std::string& path, bool grayscale) override;
};

#ifdef USE_ZIP
Expand Down
4 changes: 2 additions & 2 deletions Source/Readers/ImageReader/ImageConfigHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ ImageConfigHelper::ImageConfigHelper(const ConfigParameters& config)

m_mapPath = config(L"file");

m_grayscale = config(L"grayscale", false);
std::string rand = config(L"randomize", "auto");
m_grayscale = config(L"grayscale", false);
std::string rand = config(L"randomize", "auto");

if (AreEqualIgnoreCase(rand, "auto"))
{
Expand Down
10 changes: 5 additions & 5 deletions Source/Readers/ImageReader/ImageConfigHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ class ImageConfigHelper
return m_randomize;
}

bool UseGrayscale() const
{
return m_grayscale;
}
bool UseGrayscale() const
{
return m_grayscale;
}

bool IsMultiViewCrop() const
{
Expand All @@ -66,7 +66,7 @@ class ImageConfigHelper
int m_cpuThreadCount;
bool m_randomize;
bool m_multiViewCrop;
bool m_grayscale;
bool m_grayscale;
};

typedef std::shared_ptr<ImageConfigHelper> ImageConfigHelperPtr;
Expand Down
14 changes: 7 additions & 7 deletions Source/Readers/ImageReader/ImageDataDeserializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class ImageDataDeserializer::ImageChunk : public Chunk, public std::enable_share
const auto& imageSequence = m_description;

auto image = std::make_shared<DeserializedImage>();
image->m_image = std::move(m_parent.ReadImage(m_description.m_id, imageSequence.m_path, m_parent.m_grayscale));
image->m_image = std::move(m_parent.ReadImage(m_description.m_id, imageSequence.m_path, m_parent.m_grayscale));
auto& cvImage = image->m_image;

if (!cvImage.data)
Expand Down Expand Up @@ -119,7 +119,7 @@ ImageDataDeserializer::ImageDataDeserializer(const ConfigParameters& config)
ImageConfigHelper configHelper(config);
m_streams = configHelper.GetStreams();
assert(m_streams.size() == 2);
m_grayscale = configHelper.UseGrayscale();
m_grayscale = configHelper.UseGrayscale();
const auto& label = m_streams[configHelper.GetLabelStreamId()];
const auto& feature = m_streams[configHelper.GetFeatureStreamId()];

Expand Down Expand Up @@ -273,17 +273,17 @@ cv::Mat ImageDataDeserializer::ReadImage(size_t seqId, const std::string& path,

ImageDataDeserializer::SeqReaderMap::const_iterator r;
if (m_readers.empty() || (r = m_readers.find(seqId)) == m_readers.end())
return m_defaultReader.Read(seqId, path, grayscale);
return m_defaultReader.Read(seqId, path, grayscale);
return (*r).second->Read(seqId, path, grayscale);
}

cv::Mat FileByteReader::Read(size_t, const std::string& path, bool grayscale)
{
assert(!path.empty());

if (grayscale)
return cv::imread(path, cv::IMREAD_GRAYSCALE);
else
return cv::imread(path, cv::IMREAD_COLOR);
if (grayscale)
return cv::imread(path, cv::IMREAD_GRAYSCALE);
else
return cv::imread(path, cv::IMREAD_COLOR);
}
}}}
8 changes: 4 additions & 4 deletions Source/Readers/ImageReader/ImageDataDeserializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ class ImageDataDeserializer : public DataDeserializerBase
// Element type of the feature/label stream (currently float/double only).
ElementType m_featureElementType;

// whether images shall be loaded in grayscale
bool m_grayscale;
// Not using nocase_compare here as it's not correct on Linux.
// whether images shall be loaded in grayscale
bool m_grayscale;

// Not using nocase_compare here as it's not correct on Linux.
using PathReaderMap = std::unordered_map<std::string, std::shared_ptr<ByteReader>>;
void RegisterByteReader(size_t seqId, const std::string& path, PathReaderMap& knownReaders);
cv::Mat ReadImage(size_t seqId, const std::string& path, bool grayscale);
Expand Down

0 comments on commit c811071

Please sign in to comment.