cleanup cv_image code. This also fixes a build error with the very latest version of OpenCV.

This commit is contained in:
Davis King 2019-12-28 08:29:22 -05:00
parent 34dc730304
commit a4bf6e1e6a
2 changed files with 1 additions and 93 deletions

View File

@ -23,7 +23,7 @@ namespace dlib
typedef pixel_type type;
typedef default_memory_manager mem_manager_type;
cv_image (const cv::Mat img)
cv_image (const cv::Mat &img)
{
DLIB_CASSERT(img.depth() == cv::DataType<typename pixel_traits<pixel_type>::basic_pixel_type>::depth &&
img.channels() == pixel_traits<pixel_type>::num,
@ -119,34 +119,6 @@ namespace dlib
long nc() const { return _nc; }
long width_step() const { return _widthStep; }
cv_image& operator=( const cv_image& item)
{
_data = item._data;
_widthStep = item._widthStep;
_nr = item._nr;
_nc = item._nc;
return *this;
}
cv_image& operator=( const IplImage* img)
{
init(img);
return *this;
}
cv_image& operator=( const IplImage img)
{
init(&img);
return *this;
}
cv_image& operator=( const cv::Mat img)
{
IplImage temp = img;
init(&temp);
return *this;
}
private:
void init (const IplImage* img)

View File

@ -181,70 +181,6 @@ namespace dlib
of this image
!*/
cv_image& operator= (
const cv_image& item
);
/*!
ensures
- #*this is an identical copy of item
- returns #*this
!*/
cv_image& operator=(
const IplImage* img
);
/*!
requires
- img->dataOrder == 0
(i.e. Only interleaved color channels are supported with cv_image)
- (img->depth&0xFF)/8*img->nChannels == sizeof(pixel_type)
(i.e. The size of the pixel_type needs to match the size of the pixels
inside the OpenCV image)
ensures
- #nr() == img->height
#nc() == img->width
- using the operator[] on this object you will be able to access the pixels
inside this OpenCV image.
- returns #*this
!*/
cv_image& operator=(
const IplImage img
);
/*!
requires
- img->dataOrder == 0
(i.e. Only interleaved color channels are supported with cv_image)
- (img->depth&0xFF)/8*img->nChannels == sizeof(pixel_type)
(i.e. The size of the pixel_type needs to match the size of the pixels
inside the OpenCV image)
ensures
- #nr() == img->height
#nc() == img->width
- using the operator[] on this object you will be able to access the pixels
inside this OpenCV image.
- returns #*this
!*/
cv_image& operator=(
const cv::Mat img
);
/*!
requires
- img.depth() == cv::DataType<pixel_traits<pixel_type>::basic_pixel_type>::depth
(i.e. The pixel_type template argument needs to match the type of pixel
used inside the OpenCV image)
- img.channels() == pixel_traits<pixel_type>::num
(i.e. the number of channels in the pixel_type needs to match the number of
channels in the OpenCV image)
ensures
- #nr() == img.rows
- #nc() == img.cols
- using the operator[] on this object you will be able to access the pixels
inside this OpenCV image.
- returns #*this
!*/
long width_step (
) const;
/*!