在opencv3.2.0中,对imread函数做了修改
Mat imread( const String& filename, int flags )
{
/// create the basic container
Mat img;
/// load the data
imread_( filename, flags, LOAD_MAT, &img );
/// optionally rotate the data if EXIF' orientation flag says so
if( (flags & IMREAD_IGNORE_ORIENTATION) == 0 && flags != IMREAD_UNCHANGED )
{
ApplyExifOrientation(filename, img);
}
/// return a reference to the data
return img;
}
这是320源码中 loadsave.cpp的内容。
可以看到,对于 imread 的 flag 的处理中,增加了一个 ApplyExifOrientation 函数,该函数源码如下:
static void ApplyExifOrientation(const String& filename, Mat& img)
{
int orientation = IMAGE_ORIENTATION_TL;
if (filename.size() > 0)
{
ExifReader reader( filename );
if( reader.parse() )
{