Commit 7c5bd788 authored by Alexander Smorkalov's avatar Alexander Smorkalov

Test fixes

Calib3d badarg tests fixed. Default exception handling enabled;
Highgui Video I/O tests fixed on ARM;
Code cleanup.
parent 070a77ae
...@@ -2759,8 +2759,7 @@ public: ...@@ -2759,8 +2759,7 @@ public:
virtual int getCaptureDomain() { return CV_CAP_MSMF; } // Return the type of the capture object: CV_CAP_VFW, etc... virtual int getCaptureDomain() { return CV_CAP_MSMF; } // Return the type of the capture object: CV_CAP_VFW, etc...
protected: protected:
void init(); void init();
int index, width, height,fourcc; int index, width, height, fourcc;
int widthSet, heightSet;
IplImage* frame; IplImage* frame;
videoInput VI; videoInput VI;
}; };
...@@ -2777,18 +2776,18 @@ CvCaptureCAM_MSMF::CvCaptureCAM_MSMF(): ...@@ -2777,18 +2776,18 @@ CvCaptureCAM_MSMF::CvCaptureCAM_MSMF():
width(-1), width(-1),
height(-1), height(-1),
fourcc(-1), fourcc(-1),
widthSet(-1),
heightSet(-1),
frame(NULL), frame(NULL),
VI(videoInput::getInstance()) VI(videoInput::getInstance())
{ {
CoInitialize(0); CoInitialize(0);
} }
CvCaptureCAM_MSMF::~CvCaptureCAM_MSMF() CvCaptureCAM_MSMF::~CvCaptureCAM_MSMF()
{ {
close(); close();
CoUninitialize(); CoUninitialize();
} }
void CvCaptureCAM_MSMF::close() void CvCaptureCAM_MSMF::close()
{ {
if( index >= 0 ) if( index >= 0 )
...@@ -2797,7 +2796,7 @@ void CvCaptureCAM_MSMF::close() ...@@ -2797,7 +2796,7 @@ void CvCaptureCAM_MSMF::close()
index = -1; index = -1;
cvReleaseImage(&frame); cvReleaseImage(&frame);
} }
widthSet = heightSet = width = height = -1; width = height = -1;
} }
// Initialize camera input // Initialize camera input
...@@ -2846,50 +2845,7 @@ double CvCaptureCAM_MSMF::getProperty( int property_id ) ...@@ -2846,50 +2845,7 @@ double CvCaptureCAM_MSMF::getProperty( int property_id )
return VI.getWidth(index); return VI.getWidth(index);
case CV_CAP_PROP_FRAME_HEIGHT: case CV_CAP_PROP_FRAME_HEIGHT:
return VI.getHeight(index); return VI.getHeight(index);
case CV_CAP_PROP_FOURCC:
// FIXME: implement method in VideoInput back end
//return VI.getFourcc(index);
;
case CV_CAP_PROP_FPS:
// FIXME: implement method in VideoInput back end
//return VI.getFPS(index);
;
}
// video filter properties
switch( property_id )
{
case CV_CAP_PROP_BRIGHTNESS:
case CV_CAP_PROP_CONTRAST:
case CV_CAP_PROP_HUE:
case CV_CAP_PROP_SATURATION:
case CV_CAP_PROP_SHARPNESS:
case CV_CAP_PROP_GAMMA:
case CV_CAP_PROP_MONOCROME:
case CV_CAP_PROP_WHITE_BALANCE_BLUE_U:
case CV_CAP_PROP_BACKLIGHT:
case CV_CAP_PROP_GAIN:
// FIXME: implement method in VideoInput back end
// if ( VI.getVideoSettingFilter(index, VI.getVideoPropertyFromCV(property_id), min_value,
// max_value, stepping_delta, current_value, flags,defaultValue) )
// return (double)current_value;
return 0.;
}
// camera properties
switch( property_id )
{
case CV_CAP_PROP_PAN:
case CV_CAP_PROP_TILT:
case CV_CAP_PROP_ROLL:
case CV_CAP_PROP_ZOOM:
case CV_CAP_PROP_EXPOSURE:
case CV_CAP_PROP_IRIS:
case CV_CAP_PROP_FOCUS:
// FIXME: implement method in VideoInput back end
// if (VI.getVideoSettingCamera(index,VI.getCameraPropertyFromCV(property_id),min_value,
// max_value,stepping_delta,current_value,flags,defaultValue) ) return (double)current_value;
return 0.;
} }
// unknown parameter or value not available
return -1; return -1;
} }
bool CvCaptureCAM_MSMF::setProperty( int property_id, double value ) bool CvCaptureCAM_MSMF::setProperty( int property_id, double value )
...@@ -2906,89 +2862,21 @@ bool CvCaptureCAM_MSMF::setProperty( int property_id, double value ) ...@@ -2906,89 +2862,21 @@ bool CvCaptureCAM_MSMF::setProperty( int property_id, double value )
height = cvRound(value); height = cvRound(value);
handled = true; handled = true;
break; break;
case CV_CAP_PROP_FOURCC:
fourcc = (int)(unsigned long)(value);
if ( fourcc == -1 ) {
// following cvCreateVideo usage will pop up caprturepindialog here if fourcc=-1
// TODO - how to create a capture pin dialog
}
handled = true;
break;
case CV_CAP_PROP_FPS:
// FIXME: implement method in VideoInput back end
// int fps = cvRound(value);
// if (fps != VI.getFPS(index))
// {
// VI.stopDevice(index);
// VI.setIdealFramerate(index,fps);
// if (widthSet > 0 && heightSet > 0)
// VI.setupDevice(index, widthSet, heightSet);
// else
// VI.setupDevice(index);
// }
// return VI.isDeviceSetup(index);
;
} }
if ( handled ) { if ( handled ) {
// a stream setting
if( width > 0 && height > 0 ) if( width > 0 && height > 0 )
{ {
if( width != (int)VI.getWidth(index) || height != (int)VI.getHeight(index) )//|| fourcc != VI.getFourcc(index) ) if( width != (int)VI.getWidth(index) || height != (int)VI.getHeight(index) && VI.isDeviceSetup(index))//|| fourcc != VI.getFourcc(index) )
{ {
// FIXME: implement method in VideoInput back end VI.closeDevice(index);
// int fps = static_cast<int>(VI.getFPS(index)); VI.setupDevice(index, width, height);
// VI.stopDevice(index);
// VI.setIdealFramerate(index, fps);
// VI.setupDeviceFourcc(index, width, height, fourcc);
} }
bool success = VI.isDeviceSetup(index); return VI.isDeviceSetup(index);
if (success)
{
widthSet = width;
heightSet = height;
width = height = fourcc = -1;
}
return success;
} }
return true; return true;
} }
// show video/camera filter dialog
// FIXME: implement method in VideoInput back end
// if ( property_id == CV_CAP_PROP_SETTINGS ) {
// VI.showSettingsWindow(index);
// return true;
// }
//video Filter properties
switch( property_id )
{
case CV_CAP_PROP_BRIGHTNESS:
case CV_CAP_PROP_CONTRAST:
case CV_CAP_PROP_HUE:
case CV_CAP_PROP_SATURATION:
case CV_CAP_PROP_SHARPNESS:
case CV_CAP_PROP_GAMMA:
case CV_CAP_PROP_MONOCROME:
case CV_CAP_PROP_WHITE_BALANCE_BLUE_U:
case CV_CAP_PROP_BACKLIGHT:
case CV_CAP_PROP_GAIN:
// FIXME: implement method in VideoInput back end
//return VI.setVideoSettingFilter(index,VI.getVideoPropertyFromCV(property_id),(long)value);
;
}
//camera properties
switch( property_id )
{
case CV_CAP_PROP_PAN:
case CV_CAP_PROP_TILT:
case CV_CAP_PROP_ROLL:
case CV_CAP_PROP_ZOOM:
case CV_CAP_PROP_EXPOSURE:
case CV_CAP_PROP_IRIS:
case CV_CAP_PROP_FOCUS:
// FIXME: implement method in VideoInput back end
//return VI.setVideoSettingCamera(index,VI.getCameraPropertyFromCV(property_id),(long)value);
;
}
return false; return false;
} }
...@@ -3109,103 +2997,9 @@ void CvCaptureFile_MSMF::close() ...@@ -3109,103 +2997,9 @@ void CvCaptureFile_MSMF::close()
bool CvCaptureFile_MSMF::setProperty(int property_id, double value) bool CvCaptureFile_MSMF::setProperty(int property_id, double value)
{ {
// image capture properties // image capture properties
bool handled = false;
unsigned int width, height;
int fourcc;
switch( property_id )
{
case CV_CAP_PROP_FRAME_WIDTH:
// width = cvRound(value);
// handled = true;
break;
case CV_CAP_PROP_FRAME_HEIGHT:
// height = cvRound(value);
// handled = true;
break;
case CV_CAP_PROP_FOURCC:
fourcc = (int)(unsigned long)(value);
if ( fourcc == -1 ) {
// following cvCreateVideo usage will pop up caprturepindialog here if fourcc=-1
// TODO - how to create a capture pin dialog
}
handled = true;
break;
case CV_CAP_PROP_FPS:
// FIXME: implement method in VideoInput back end
// int fps = cvRound(value);
// if (fps != VI.getFPS(index))
// {
// VI.stopDevice(index);
// VI.setIdealFramerate(index,fps);
// if (widthSet > 0 && heightSet > 0)
// VI.setupDevice(index, widthSet, heightSet);
// else
// VI.setupDevice(index);
// }
// return VI.isDeviceSetup(index);
;
}
if ( handled ) {
// a stream setting
if( width > 0 && height > 0 )
{
if( width != captureFormats[captureFormatIndex].width ||
height != captureFormats[captureFormatIndex].height )//|| fourcc != VI.getFourcc(index) )
{
// FIXME: implement method in VideoInput back end
// int fps = static_cast<int>(VI.getFPS(index));
// VI.stopDevice(index);
// VI.setIdealFramerate(index, fps);
// VI.setupDeviceFourcc(index, width, height, fourcc);
}
if (isOpened)
{
// widthSet = width;
// heightSet = height;
// width = height = fourcc = -1;
}
return isOpened;
}
return true;
}
// show video/camera filter dialog
// FIXME: implement method in VideoInput back end // FIXME: implement method in VideoInput back end
// if ( property_id == CV_CAP_PROP_SETTINGS ) { (void) property_id;
// VI.showSettingsWindow(index); (void) value;
// return true;
// }
//video Filter properties
switch( property_id )
{
case CV_CAP_PROP_BRIGHTNESS:
case CV_CAP_PROP_CONTRAST:
case CV_CAP_PROP_HUE:
case CV_CAP_PROP_SATURATION:
case CV_CAP_PROP_SHARPNESS:
case CV_CAP_PROP_GAMMA:
case CV_CAP_PROP_MONOCROME:
case CV_CAP_PROP_WHITE_BALANCE_BLUE_U:
case CV_CAP_PROP_BACKLIGHT:
case CV_CAP_PROP_GAIN:
// FIXME: implement method in VideoInput back end
//return VI.setVideoSettingFilter(index,VI.getVideoPropertyFromCV(property_id),(long)value);
;
}
//camera properties
switch( property_id )
{
case CV_CAP_PROP_PAN:
case CV_CAP_PROP_TILT:
case CV_CAP_PROP_ROLL:
case CV_CAP_PROP_ZOOM:
case CV_CAP_PROP_EXPOSURE:
case CV_CAP_PROP_IRIS:
case CV_CAP_PROP_FOCUS:
// FIXME: implement method in VideoInput back end
//return VI.setVideoSettingCamera(index,VI.getCameraPropertyFromCV(property_id),(long)value);
;
}
return false; return false;
} }
...@@ -3238,7 +3032,7 @@ double CvCaptureFile_MSMF::getProperty(int property_id) ...@@ -3238,7 +3032,7 @@ double CvCaptureFile_MSMF::getProperty(int property_id)
bool CvCaptureFile_MSMF::grabFrame() bool CvCaptureFile_MSMF::grabFrame()
{ {
DWORD waitResult = -1; DWORD waitResult = (DWORD)-1;
if (isOpened) if (isOpened)
{ {
SetEvent(grabberThread->getImageGrabber()->ig_hFrameGrabbed); SetEvent(grabberThread->getImageGrabber()->ig_hFrameGrabbed);
...@@ -3507,7 +3301,7 @@ void CvVideoWriter_MSMF::close() ...@@ -3507,7 +3301,7 @@ void CvVideoWriter_MSMF::close()
} }
initiated = false; initiated = false;
HRESULT hr = sinkWriter->Finalize(); sinkWriter->Finalize();
MFShutdown(); MFShutdown();
} }
...@@ -3667,6 +3461,16 @@ HRESULT CvVideoWriter_MSMF::WriteFrame(DWORD *videoFrameBuffer, const LONGLONG& ...@@ -3667,6 +3461,16 @@ HRESULT CvVideoWriter_MSMF::WriteFrame(DWORD *videoFrameBuffer, const LONGLONG&
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
#if defined(_M_ARM)
hr = MFCopyImage(
pData, // Destination buffer.
-cbWidth, // Destination stride.
(BYTE*)videoFrameBuffer, // First row in source image.
cbWidth, // Source stride.
cbWidth, // Image width in bytes.
videoHeight // Image height in pixels.
);
#else
hr = MFCopyImage( hr = MFCopyImage(
pData, // Destination buffer. pData, // Destination buffer.
cbWidth, // Destination stride. cbWidth, // Destination stride.
...@@ -3675,6 +3479,7 @@ HRESULT CvVideoWriter_MSMF::WriteFrame(DWORD *videoFrameBuffer, const LONGLONG& ...@@ -3675,6 +3479,7 @@ HRESULT CvVideoWriter_MSMF::WriteFrame(DWORD *videoFrameBuffer, const LONGLONG&
cbWidth, // Image width in bytes. cbWidth, // Image width in bytes.
videoHeight // Image height in pixels. videoHeight // Image height in pixels.
); );
#endif
} }
if (buffer) if (buffer)
......
...@@ -73,10 +73,12 @@ const VideoFormat g_specific_fmt_list[] = ...@@ -73,10 +73,12 @@ const VideoFormat g_specific_fmt_list[] =
VideoFormat("wmv", CV_FOURCC_MACRO('M', 'P', 'G', '1')), VideoFormat("wmv", CV_FOURCC_MACRO('M', 'P', 'G', '1')),
VideoFormat("wmv", CV_FOURCC_MACRO('M', 'S', 'S', '1')), VideoFormat("wmv", CV_FOURCC_MACRO('M', 'S', 'S', '1')),
VideoFormat("wmv", CV_FOURCC_MACRO('M', 'S', 'S', '2')),*/ VideoFormat("wmv", CV_FOURCC_MACRO('M', 'S', 'S', '2')),*/
//VideoFormat("avi", CV_FOURCC_MACRO('H', '2', '6', '4')), #if !defined(_M_ARM)
VideoFormat("wmv", CV_FOURCC_MACRO('W', 'M', 'V', '1')), VideoFormat("wmv", CV_FOURCC_MACRO('W', 'M', 'V', '1')),
VideoFormat("wmv", CV_FOURCC_MACRO('W', 'M', 'V', '2')), VideoFormat("wmv", CV_FOURCC_MACRO('W', 'M', 'V', '2')),
#endif
VideoFormat("wmv", CV_FOURCC_MACRO('W', 'M', 'V', '3')), VideoFormat("wmv", CV_FOURCC_MACRO('W', 'M', 'V', '3')),
VideoFormat("avi", CV_FOURCC_MACRO('H', '2', '6', '4')),
//VideoFormat("wmv", CV_FOURCC_MACRO('W', 'V', 'C', '1')), //VideoFormat("wmv", CV_FOURCC_MACRO('W', 'V', 'C', '1')),
VideoFormat() VideoFormat()
}; };
......
...@@ -3,10 +3,4 @@ set(CMAKE_SYSTEM_PROCESSOR "arm-v7a") ...@@ -3,10 +3,4 @@ set(CMAKE_SYSTEM_PROCESSOR "arm-v7a")
set(CMAKE_FIND_ROOT_PATH "${CMAKE_SOURCE_DIR}/platforms/winrt") set(CMAKE_FIND_ROOT_PATH "${CMAKE_SOURCE_DIR}/platforms/winrt")
set(CMAKE_REQUIRED_DEFINITIONS -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE) set(CMAKE_REQUIRED_DEFINITIONS -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE)
add_definitions(-D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE) add_definitions(-D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE)
\ No newline at end of file
set(CMAKE_CXX_FLAGS "" CACHE STRING "c++ flags")
set(CMAKE_C_FLAGS "" CACHE STRING "c flags")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -EHsc -GS")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -GS")
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment