Boring changes - highgui.

This commit is contained in:
Roman Donchenko 2013-08-13 16:47:18 +04:00
parent 254d4ae429
commit beeb932d22
13 changed files with 49 additions and 49 deletions

View File

@ -544,8 +544,8 @@ protected:
Ptr<CvVideoWriter> writer;
};
template<> CV_EXPORTS void Ptr<CvCapture>::delete_obj();
template<> CV_EXPORTS void Ptr<CvVideoWriter>::delete_obj();
template<> CV_EXPORTS void DefaultDeleter<CvCapture>::operator ()(CvCapture* obj) const;
template<> CV_EXPORTS void DefaultDeleter<CvVideoWriter>::operator ()(CvVideoWriter* obj) const;
} // cv

View File

@ -49,10 +49,10 @@
namespace cv
{
template<> void Ptr<CvCapture>::delete_obj()
template<> void DefaultDeleter<CvCapture>::operator ()(CvCapture* obj) const
{ cvReleaseCapture(&obj); }
template<> void Ptr<CvVideoWriter>::delete_obj()
template<> void DefaultDeleter<CvVideoWriter>::operator ()(CvVideoWriter* obj) const
{ cvReleaseVideoWriter(&obj); }
}
@ -492,14 +492,14 @@ VideoCapture::~VideoCapture()
bool VideoCapture::open(const String& filename)
{
if (isOpened()) release();
cap = cvCreateFileCapture(filename.c_str());
cap.reset(cvCreateFileCapture(filename.c_str()));
return isOpened();
}
bool VideoCapture::open(int device)
{
if (isOpened()) release();
cap = cvCreateCameraCapture(device);
cap.reset(cvCreateCameraCapture(device));
return isOpened();
}
@ -578,7 +578,7 @@ VideoWriter::~VideoWriter()
bool VideoWriter::open(const String& filename, int _fourcc, double fps, Size frameSize, bool isColor)
{
writer = cvCreateVideoWriter(filename.c_str(), _fourcc, fps, frameSize, isColor);
writer.reset(cvCreateVideoWriter(filename.c_str(), _fourcc, fps, frameSize, isColor));
return isOpened();
}

View File

@ -70,7 +70,7 @@ void BmpDecoder::close()
ImageDecoder BmpDecoder::newDecoder() const
{
return new BmpDecoder;
return makePtr<BmpDecoder>();
}
bool BmpDecoder::readHeader()
@ -496,7 +496,7 @@ BmpEncoder::~BmpEncoder()
ImageEncoder BmpEncoder::newEncoder() const
{
return new BmpEncoder;
return makePtr<BmpEncoder>();
}
bool BmpEncoder::write( const Mat& img, const std::vector<int>& )

View File

@ -551,7 +551,7 @@ void ExrDecoder::RGBToGray( float *in, float *out )
ImageDecoder ExrDecoder::newDecoder() const
{
return new ExrDecoder;
return makePtr<ExrDecoder>();
}
/////////////////////// ExrEncoder ///////////////////
@ -726,7 +726,7 @@ bool ExrEncoder::write( const Mat& img, const std::vector<int>& )
ImageEncoder ExrEncoder::newEncoder() const
{
return new ExrEncoder;
return makePtr<ExrEncoder>();
}
}

View File

@ -208,7 +208,7 @@ void JpegDecoder::close()
ImageDecoder JpegDecoder::newDecoder() const
{
return new JpegDecoder;
return makePtr<JpegDecoder>();
}
bool JpegDecoder::readHeader()
@ -539,7 +539,7 @@ JpegEncoder::~JpegEncoder()
ImageEncoder JpegEncoder::newEncoder() const
{
return new JpegEncoder;
return makePtr<JpegEncoder>();
}
bool JpegEncoder::write( const Mat& img, const std::vector<int>& params )

View File

@ -88,7 +88,7 @@ Jpeg2KDecoder::~Jpeg2KDecoder()
ImageDecoder Jpeg2KDecoder::newDecoder() const
{
return new Jpeg2KDecoder;
return makePtr<Jpeg2KDecoder>();
}
void Jpeg2KDecoder::close()
@ -403,7 +403,7 @@ Jpeg2KEncoder::~Jpeg2KEncoder()
ImageEncoder Jpeg2KEncoder::newEncoder() const
{
return new Jpeg2KEncoder;
return makePtr<Jpeg2KEncoder>();
}
bool Jpeg2KEncoder::isFormatSupported( int depth ) const

View File

@ -101,7 +101,7 @@ PngDecoder::~PngDecoder()
ImageDecoder PngDecoder::newDecoder() const
{
return new PngDecoder;
return makePtr<PngDecoder>();
}
void PngDecoder::close()
@ -317,7 +317,7 @@ bool PngEncoder::isFormatSupported( int depth ) const
ImageEncoder PngEncoder::newEncoder() const
{
return new PngEncoder;
return makePtr<PngEncoder>();
}

View File

@ -116,7 +116,7 @@ bool PxMDecoder::checkSignature( const String& signature ) const
ImageDecoder PxMDecoder::newDecoder() const
{
return new PxMDecoder;
return makePtr<PxMDecoder>();
}
void PxMDecoder::close()
@ -357,7 +357,7 @@ PxMEncoder::~PxMEncoder()
ImageEncoder PxMEncoder::newEncoder() const
{
return new PxMEncoder;
return makePtr<PxMEncoder>();
}

View File

@ -63,7 +63,7 @@ SunRasterDecoder::~SunRasterDecoder()
ImageDecoder SunRasterDecoder::newDecoder() const
{
return new SunRasterDecoder;
return makePtr<SunRasterDecoder>();
}
void SunRasterDecoder::close()
@ -388,7 +388,7 @@ SunRasterEncoder::SunRasterEncoder()
ImageEncoder SunRasterEncoder::newEncoder() const
{
return new SunRasterEncoder;
return makePtr<SunRasterEncoder>();
}
SunRasterEncoder::~SunRasterEncoder()

View File

@ -108,7 +108,7 @@ int TiffDecoder::normalizeChannelsNumber(int channels) const
ImageDecoder TiffDecoder::newDecoder() const
{
return new TiffDecoder;
return makePtr<TiffDecoder>();
}
bool TiffDecoder::readHeader()
@ -400,7 +400,7 @@ TiffEncoder::~TiffEncoder()
ImageEncoder TiffEncoder::newEncoder() const
{
return new TiffEncoder;
return makePtr<TiffEncoder>();
}
bool TiffEncoder::isFormatSupported( int depth ) const

View File

@ -90,7 +90,7 @@ bool WebPDecoder::checkSignature(const String & signature) const
ImageDecoder WebPDecoder::newDecoder() const
{
return new WebPDecoder;
return makePtr<WebPDecoder>();
}
bool WebPDecoder::readHeader()
@ -201,7 +201,7 @@ WebPEncoder::~WebPEncoder() { }
ImageEncoder WebPEncoder::newEncoder() const
{
return new WebPEncoder();
return makePtr<WebPEncoder>();
}
bool WebPEncoder::write(const Mat& img, const std::vector<int>& params)

View File

@ -58,35 +58,35 @@ struct ImageCodecInitializer
{
ImageCodecInitializer()
{
decoders.push_back( new BmpDecoder );
encoders.push_back( new BmpEncoder );
decoders.push_back( makePtr<BmpDecoder>() );
encoders.push_back( makePtr<BmpEncoder>() );
#ifdef HAVE_JPEG
decoders.push_back( new JpegDecoder );
encoders.push_back( new JpegEncoder );
decoders.push_back( makePtr<JpegDecoder>() );
encoders.push_back( makePtr<JpegEncoder>() );
#endif
#ifdef HAVE_WEBP
decoders.push_back( new WebPDecoder );
encoders.push_back( new WebPEncoder );
decoders.push_back( makePtr<WebPDecoder>() );
encoders.push_back( makePtr<WebPEncoder>() );
#endif
decoders.push_back( new SunRasterDecoder );
encoders.push_back( new SunRasterEncoder );
decoders.push_back( new PxMDecoder );
encoders.push_back( new PxMEncoder );
decoders.push_back( makePtr<SunRasterDecoder>() );
encoders.push_back( makePtr<SunRasterEncoder>() );
decoders.push_back( makePtr<PxMDecoder>() );
encoders.push_back( makePtr<PxMEncoder>() );
#ifdef HAVE_TIFF
decoders.push_back( new TiffDecoder );
decoders.push_back( makePtr<TiffDecoder>() );
#endif
encoders.push_back( new TiffEncoder );
encoders.push_back( makePtr<TiffEncoder>() );
#ifdef HAVE_PNG
decoders.push_back( new PngDecoder );
encoders.push_back( new PngEncoder );
decoders.push_back( makePtr<PngDecoder>() );
encoders.push_back( makePtr<PngEncoder>() );
#endif
#ifdef HAVE_JASPER
decoders.push_back( new Jpeg2KDecoder );
encoders.push_back( new Jpeg2KEncoder );
decoders.push_back( makePtr<Jpeg2KDecoder>() );
encoders.push_back( makePtr<Jpeg2KEncoder>() );
#endif
#ifdef HAVE_OPENEXR
decoders.push_back( new ExrDecoder );
encoders.push_back( new ExrEncoder );
decoders.push_back( makePtr<ExrDecoder>() );
encoders.push_back( makePtr<ExrEncoder>() );
#endif
}
@ -198,7 +198,7 @@ imread_( const String& filename, int flags, int hdrtype, Mat* mat=0 )
Mat temp, *data = &temp;
ImageDecoder decoder = findDecoder(filename);
if( decoder.empty() )
if( !decoder )
return 0;
decoder->setSource(filename);
if( !decoder->readHeader() )
@ -269,7 +269,7 @@ static bool imwrite_( const String& filename, const Mat& image,
CV_Assert( image.channels() == 1 || image.channels() == 3 || image.channels() == 4 );
ImageEncoder encoder = findEncoder( filename );
if( encoder.empty() )
if( !encoder )
CV_Error( CV_StsError, "could not find a writer for the specified extension" );
if( !encoder->isFormatSupported(image.depth()) )
@ -309,7 +309,7 @@ imdecode_( const Mat& buf, int flags, int hdrtype, Mat* mat=0 )
String filename;
ImageDecoder decoder = findDecoder(buf);
if( decoder.empty() )
if( !decoder )
return 0;
if( !decoder->setSource(buf) )
@ -409,7 +409,7 @@ bool imencode( const String& ext, InputArray _image,
CV_Assert( channels == 1 || channels == 3 || channels == 4 );
ImageEncoder encoder = findEncoder( ext );
if( encoder.empty() )
if( !encoder )
CV_Error( CV_StsError, "could not find encoder for the specified extension" );
if( !encoder->isFormatSupported(image.depth()) )

View File

@ -71,8 +71,8 @@ void CV_FramecountTest::run(int)
{
string file_path = src_dir+"video/big_buck_bunny."+ext[i];
cap = cvCreateFileCapture(file_path.c_str());
if (cap.empty())
cap.reset(cvCreateFileCapture(file_path.c_str()));
if (!cap)
{
ts->printf(cvtest::TS::LOG, "\nFile information (video %d): \n\nName: big_buck_bunny.%s\nFAILED\n\n", i+1, ext[i].c_str());
ts->printf(cvtest::TS::LOG, "Error: cannot read source video file.\n");