merge with origin
This commit is contained in:
@@ -278,8 +278,20 @@
|
||||
{
|
||||
self.captureVideoPreviewLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:self.captureSession];
|
||||
|
||||
if ([self.captureVideoPreviewLayer isOrientationSupported]) {
|
||||
[self.captureVideoPreviewLayer setOrientation:self.defaultAVCaptureVideoOrientation];
|
||||
if ([self.captureVideoPreviewLayer respondsToSelector:@selector(connection)])
|
||||
{
|
||||
if ([self.captureVideoPreviewLayer.connection isVideoOrientationSupported])
|
||||
{
|
||||
[self.captureVideoPreviewLayer.connection setVideoOrientation:self.defaultAVCaptureVideoOrientation];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Deprecated in 6.0; here for backward compatibility
|
||||
if ([self.captureVideoPreviewLayer isOrientationSupported])
|
||||
{
|
||||
[self.captureVideoPreviewLayer setOrientation:self.defaultAVCaptureVideoOrientation];
|
||||
}
|
||||
}
|
||||
|
||||
if (parentView != nil) {
|
||||
@@ -290,9 +302,6 @@
|
||||
NSLog(@"[Camera] created AVCaptureVideoPreviewLayer");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
- (void)setDesiredCameraPosition:(AVCaptureDevicePosition)desiredPosition;
|
||||
{
|
||||
for (AVCaptureDevice *device in [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo]) {
|
||||
|
||||
@@ -111,18 +111,21 @@ bool TiffDecoder::readHeader()
|
||||
bool result = false;
|
||||
|
||||
close();
|
||||
TIFF* tif = TIFFOpen( m_filename.c_str(), "rb" );
|
||||
// TIFFOpen() mode flags are different to fopen(). A 'b' in mode "rb" has no effect when reading.
|
||||
// http://www.remotesensing.org/libtiff/man/TIFFOpen.3tiff.html
|
||||
TIFF* tif = TIFFOpen( m_filename.c_str(), "r" );
|
||||
|
||||
if( tif )
|
||||
{
|
||||
int wdth = 0, hght = 0, photometric = 0;
|
||||
uint32 wdth = 0, hght = 0;
|
||||
uint16 photometric = 0;
|
||||
m_tif = tif;
|
||||
|
||||
if( TIFFGetField( tif, TIFFTAG_IMAGEWIDTH, &wdth ) &&
|
||||
TIFFGetField( tif, TIFFTAG_IMAGELENGTH, &hght ) &&
|
||||
TIFFGetField( tif, TIFFTAG_PHOTOMETRIC, &photometric ))
|
||||
{
|
||||
int bpp=8, ncn = photometric > 1 ? 3 : 1;
|
||||
uint16 bpp=8, ncn = photometric > 1 ? 3 : 1;
|
||||
TIFFGetField( tif, TIFFTAG_BITSPERSAMPLE, &bpp );
|
||||
TIFFGetField( tif, TIFFTAG_SAMPLESPERPIXEL, &ncn );
|
||||
|
||||
@@ -175,12 +178,12 @@ bool TiffDecoder::readData( Mat& img )
|
||||
if( m_tif && m_width && m_height )
|
||||
{
|
||||
TIFF* tif = (TIFF*)m_tif;
|
||||
int tile_width0 = m_width, tile_height0 = 0;
|
||||
uint32 tile_width0 = m_width, tile_height0 = 0;
|
||||
int x, y, i;
|
||||
int is_tiled = TIFFIsTiled(tif);
|
||||
int photometric;
|
||||
uint16 photometric;
|
||||
TIFFGetField( tif, TIFFTAG_PHOTOMETRIC, &photometric );
|
||||
int bpp = 8, ncn = photometric > 1 ? 3 : 1;
|
||||
uint16 bpp = 8, ncn = photometric > 1 ? 3 : 1;
|
||||
TIFFGetField( tif, TIFFTAG_BITSPERSAMPLE, &bpp );
|
||||
TIFFGetField( tif, TIFFTAG_SAMPLESPERPIXEL, &ncn );
|
||||
const int bitsPerByte = 8;
|
||||
|
||||
@@ -88,7 +88,7 @@ public:
|
||||
stringstream s;
|
||||
s << tag;
|
||||
|
||||
const string filename = "output_"+s.str()+".avi";
|
||||
const string filename = tempfile((s.str()+".avi").c_str());
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
@@ -408,8 +408,8 @@ TEST(Highgui_Tiff, decode_tile16384x16384)
|
||||
|
||||
try
|
||||
{
|
||||
cv::imread(file3);
|
||||
EXPECT_NO_THROW(cv::imread(file4));
|
||||
cv::imread(file3, CV_LOAD_IMAGE_UNCHANGED);
|
||||
EXPECT_NO_THROW(cv::imread(file4, CV_LOAD_IMAGE_UNCHANGED));
|
||||
}
|
||||
catch(const std::bad_alloc&)
|
||||
{
|
||||
@@ -420,6 +420,53 @@ TEST(Highgui_Tiff, decode_tile16384x16384)
|
||||
remove(file4.c_str());
|
||||
}
|
||||
|
||||
class CV_GrfmtReadTifTiledWithNotFullTiles: public cvtest::BaseTest
|
||||
{
|
||||
// see issue #2601 "16-bit Grayscale TIFF Load Failures Due to Buffer Underflow and Endianness"
|
||||
|
||||
// Setup data for two minimal 16-bit grayscale TIFF files in both endian formats
|
||||
uchar tiff_sample_data[2][86] = { {
|
||||
// Little endian
|
||||
0x49, 0x49, 0x2a, 0x00, 0x0c, 0x00, 0x00, 0x00, 0xad, 0xde, 0xef, 0xbe, 0x06, 0x00, 0x00, 0x01,
|
||||
0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x01, 0x03, 0x00, 0x01, 0x00,
|
||||
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x01, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00,
|
||||
0x00, 0x00, 0x06, 0x01, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x11, 0x01,
|
||||
0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x17, 0x01, 0x04, 0x00, 0x01, 0x00,
|
||||
0x00, 0x00, 0x04, 0x00, 0x00, 0x00 }, {
|
||||
// Big endian
|
||||
0x4d, 0x4d, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x0c, 0xde, 0xad, 0xbe, 0xef, 0x00, 0x06, 0x01, 0x00,
|
||||
0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00, 0x01, 0x01, 0x00, 0x03, 0x00, 0x00,
|
||||
0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x01, 0x02, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10,
|
||||
0x00, 0x00, 0x01, 0x06, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x01, 0x11,
|
||||
0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x01, 0x17, 0x00, 0x04, 0x00, 0x00,
|
||||
0x00, 0x01, 0x00, 0x00, 0x00, 0x04 }
|
||||
};
|
||||
|
||||
// Test imread() for both a little endian TIFF and big endian TIFF
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
string filename = cv::tempfile(".tiff");
|
||||
|
||||
// Write sample TIFF file
|
||||
FILE* fp = fopen(filename.c_str(), "wb");
|
||||
ASSERT_TRUE(fp != NULL);
|
||||
ASSERT_EQ((size_t)1, fwrite(tiff_sample_data, 86, 1, fp));
|
||||
fclose(fp);
|
||||
|
||||
Mat img = imread(filename, CV_LOAD_IMAGE_UNCHANGED);
|
||||
|
||||
EXPECT_EQ(1, img.rows);
|
||||
EXPECT_EQ(2, img.cols);
|
||||
EXPECT_EQ(CV_16U, img.type());
|
||||
EXPECT_EQ(sizeof(ushort), img.elemSize());
|
||||
EXPECT_EQ(1, img.channels());
|
||||
EXPECT_EQ(0xDEAD, img.at<ushort>(0,0));
|
||||
EXPECT_EQ(0xBEEF, img.at<ushort>(0,1));
|
||||
|
||||
remove(filename.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
class CV_GrfmtReadTifTiledWithNotFullTiles: public cvtest::BaseTest
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -332,9 +332,7 @@ void CV_HighGuiTest::VideoTest(const string& dir, const cvtest::VideoFormat& fmt
|
||||
}
|
||||
}
|
||||
|
||||
printf("Before saved release for %s\n", tmp_name.c_str());
|
||||
cvReleaseCapture( &saved );
|
||||
printf("After release\n");
|
||||
|
||||
ts->printf(ts->LOG, "end test function : ImagesVideo \n");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user