Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions dlib/image_loader/jpeg_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,21 @@ namespace dlib
return (output_components_ == 4);
}


// ----------------------------------------------------------------------------------------

long jpeg_loader::nr() const
{
return static_cast<long>(height_);
}

// ----------------------------------------------------------------------------------------

long jpeg_loader::nc() const
{
return static_cast<long>(width_);
}

// ----------------------------------------------------------------------------------------

struct jpeg_loader_error_mgr
Expand Down
2 changes: 2 additions & 0 deletions dlib/image_loader/jpeg_loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ namespace dlib
bool is_gray() const;
bool is_rgb() const;
bool is_rgba() const;
long nr() const;
long nc() const;

template<typename T>
void get_image( T& t_) const
Expand Down
16 changes: 16 additions & 0 deletions dlib/image_loader/jpeg_loader_abstract.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,22 @@ namespace dlib
- returns false
!*/

long nr (
) const;
/*!
ensures
- returns the number of rows (height) of the image contained by this
object.
!*/

long nc (
) const;
/*!
ensures
- returns the number of colums (width) of the image contained by this
object.
!*/

template<
typename image_type
>
Expand Down
4 changes: 3 additions & 1 deletion dlib/image_loader/png_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,13 @@ namespace dlib
bool png_loader::is_rgb() const { return color_type == PNG_COLOR_TYPE_RGB; }
bool png_loader::is_rgba() const { return color_type == PNG_COLOR_TYPE_RGB_ALPHA; }
unsigned int png_loader::bit_depth () const {return bit_depth_;}
long png_loader::nr() const { return height; }
long png_loader::nc() const { return width; }

// ----------------------------------------------------------------------------------------

}

#endif // DLIB_PNG_SUPPORT

#endif // DLIB_PNG_LOADER_CPp_
#endif // DLIB_PNG_LOADER_CPp_
4 changes: 3 additions & 1 deletion dlib/image_loader/png_loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ namespace dlib
bool is_rgb() const;
bool is_rgba() const;
unsigned int bit_depth () const;
long nr() const;
long nc() const;

template<class image_type>
void get_image( image_type& img) const
Expand Down Expand Up @@ -193,4 +195,4 @@ namespace dlib
#include "png_loader.cpp"
#endif

#endif // DLIB_PNG_IMPORT
#endif // DLIB_PNG_IMPORT
18 changes: 17 additions & 1 deletion dlib/image_loader/png_loader_abstract.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,22 @@ namespace dlib
object. The possible values are 8 or 16.
!*/

long nr (
) const;
/*!
ensures
- returns the number of rows (height) of the image contained by this
object.
!*/

long nc (
) const;
/*!
ensures
- returns the number of colums (width) of the image contained by this
object.
!*/

template<
typename image_type
>
Expand Down Expand Up @@ -220,4 +236,4 @@ namespace dlib

}

#endif // DLIB_PNG_IMPORT_ABSTRACT
#endif // DLIB_PNG_IMPORT_ABSTRACT
5 changes: 5 additions & 0 deletions dlib/image_loader/webp_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ namespace dlib
get_info();
}

// ----------------------------------------------------------------------------------------

long webp_loader::nr() const { return height_; }
long webp_loader::nc() const { return width_; }

// ----------------------------------------------------------------------------------------

void webp_loader::get_info()
Expand Down
3 changes: 3 additions & 0 deletions dlib/image_loader/webp_loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ namespace dlib
webp_loader(const dlib::file& f);
webp_loader(const unsigned char* imgbuffer, size_t buffersize);

long nr() const;
long nc() const;

template<typename image_type>
void get_image(image_type& image) const
{
Expand Down
16 changes: 16 additions & 0 deletions dlib/image_loader/webp_loader_abstract.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,22 @@ namespace dlib
- all resources associated with *this has been released
!*/

long nr (
) const;
/*!
ensures
- returns the number of rows (height) of the image contained by this
object.
!*/

long nc (
) const;
/*!
ensures
- returns the number of colums (width) of the image contained by this
object.
!*/

template<
typename image_type
>
Expand Down