Skip to content
Permalink
Browse files

Style checks

  • Loading branch information
MuLx10 committed Jun 17, 2019
1 parent 5dbec96 commit 9ffb02249dab39b72e68acf17b58593d27ba4147
Showing with 18 additions and 21 deletions.
  1. +1 −1 LICENSE.txt
  2. +3 −3 src/mlpack/core/data/load_image.hpp
  3. +14 −17 src/mlpack/core/data/load_image_impl.hpp
@@ -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.

@@ -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.
@@ -27,7 +27,7 @@ LoadImage::LoadImage():
matrixHeight(0),
channels(3)
{

//Do nothing.
}

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

// Do nothing.
}

LoadImage::~LoadImage()
@@ -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))
{
@@ -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(),
@@ -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 &&
@@ -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;

0 comments on commit 9ffb022

Please sign in to comment.
You can’t perform that action at this time.