Skip to content

Commit

Permalink
Style checks
Browse files Browse the repository at this point in the history
  • Loading branch information
MuLx10 committed Jun 17, 2019
1 parent 5dbec96 commit 9ffb022
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 21 deletions.
2 changes: 1 addition & 1 deletion LICENSE.txt
Expand Up @@ -12,7 +12,7 @@ licensed under the Boost Software License, version 1.0. This code is found in
src/mlpack/core/boost_backport/ and more details on the licensing are available
there.

mlpack contains some usage of the source code of stb, which is licensed
mlpack may contain some usage of the source code of stb, which is licensed
under the MIT License and the Public Domain (www.unlicense.org). This code
is used in src/mlpack/core/data/load_image.hpp.

Expand Down
6 changes: 3 additions & 3 deletions src/mlpack/core/data/load_image.hpp
Expand Up @@ -105,9 +105,9 @@ class LoadImage
bool Load(const std::string& fileName,
bool flipVertical,
arma::Mat<unsigned char>&& outputMatrix,
size_t &width,
size_t &height,
size_t &channels);
size_t& width,
size_t& height,
size_t& channels);

/**
* Load the image file into the given matrix.
Expand Down
31 changes: 14 additions & 17 deletions src/mlpack/core/data/load_image_impl.hpp
Expand Up @@ -27,7 +27,7 @@ LoadImage::LoadImage():
matrixHeight(0),
channels(3)
{

//Do nothing.
}

LoadImage::LoadImage(const size_t width,
Expand All @@ -37,7 +37,7 @@ LoadImage::LoadImage(const size_t width,
matrixHeight(height),
channels(channels)
{

// Do nothing.
}

LoadImage::~LoadImage()
Expand All @@ -57,11 +57,11 @@ bool LoadImage::ImageFormatSupported(const std::string& fileName)
bool LoadImage::Load(const std::string& fileName,
bool flipVertical,
arma::Mat<unsigned char>&& outputMatrix,
size_t &width,
size_t &height,
size_t &channels)
size_t& width,
size_t& height,
size_t& channels)
{
unsigned char *image;
unsigned char* image;

if (!ImageFormatSupported(fileName))
{
Expand All @@ -77,10 +77,10 @@ bool LoadImage::Load(const std::string& fileName,

stbi_set_flip_vertically_on_load(flipVertical);

// Temporary variablesneeded as stb_image.h supports int parameters.
// Temporary variables needed as stb_image.h supports int parameters.
int tempWidth, tempHeight, tempChannels;

// For grayscale images
// For grayscale images.
if (channels == 1)
{
image = stbi_load(fileName.c_str(),
Expand Down Expand Up @@ -120,18 +120,17 @@ bool LoadImage::Load(const std::string& fileName,
}

bool LoadImage::Load(const std::string& fileName,
bool flipVertical,
arma::Mat<unsigned char>&& outputMatrix)
bool flipVertical,
arma::Mat<unsigned char>&& outputMatrix)
{
size_t width, height;
bool status = Load(fileName,
flipVertical,
std::move(outputMatrix),
bool status = Load(fileName, flipVertical, std::move(outputMatrix),
width, height, channels);
if (!status)
return status;

Log::Info << width <<" "<< height <<" "<< channels << std::endl;
Log::Info << "Image width: " << width <<" height: "<< height <<" channels: "
<< channels << std::endl;

// Throw error if the image is incompatible with the matrix.
if (matrixWidth > 0 && matrixHeight > 0 &&
Expand Down Expand Up @@ -162,9 +161,7 @@ bool LoadImage::Load(const std::vector<std::string>& files,

arma::Mat<unsigned char> img;
size_t width, height;
bool status = Load(files[0],
flipVertical,
std::move(img),
bool status = Load(files[0], flipVertical, std::move(img),
width, height, channels);
Log::Info << "Loaded " << files[0] << std::endl;

Expand Down

0 comments on commit 9ffb022

Please sign in to comment.