Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
6d0407b6
Commit
6d0407b6
authored
May 20, 2015
by
Piotr Dobrowolski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
VideoCapture with digital camera and gPhoto2 library
parent
298c98ea
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
100 additions
and
10 deletions
+100
-10
CMakeLists.txt
CMakeLists.txt
+5
-0
OpenCVFindLibsVideo.cmake
cmake/OpenCVFindLibsVideo.cmake
+6
-0
cvconfig.h.in
cmake/templates/cvconfig.h.in
+3
-0
CMakeLists.txt
modules/videoio/CMakeLists.txt
+4
-0
videoio.hpp
modules/videoio/include/opencv2/videoio.hpp
+19
-1
videoio_c.h
modules/videoio/include/opencv2/videoio/videoio_c.h
+20
-1
cap.cpp
modules/videoio/src/cap.cpp
+39
-8
cap_gphoto2.cpp
modules/videoio/src/cap_gphoto2.cpp
+0
-0
precomp.hpp
modules/videoio/src/precomp.hpp
+3
-0
test_precomp.hpp
modules/videoio/test/test_precomp.hpp
+1
-0
autofocus.cpp
samples/cpp/autofocus.cpp
+0
-0
No files found.
CMakeLists.txt
View file @
6d0407b6
...
...
@@ -205,6 +205,7 @@ OCV_OPTION(WITH_DIRECTX "Include DirectX support" ON
OCV_OPTION
(
WITH_INTELPERC
"Include Intel Perceptual Computing support"
OFF
IF
(
WIN32 AND NOT WINRT
)
)
OCV_OPTION
(
WITH_IPP_A
"Include Intel IPP_A support"
OFF
IF
(
MSVC OR X86 OR X86_64
)
)
OCV_OPTION
(
WITH_GDAL
"Include GDAL Support"
OFF
IF
(
NOT ANDROID AND NOT IOS AND NOT WINRT
)
)
OCV_OPTION
(
WITH_GPHOTO2
"Include gPhoto2 library support"
ON
IF
(
UNIX AND NOT ANDROID
)
)
# OpenCV build components
# ===================================================
...
...
@@ -1032,6 +1033,10 @@ if(DEFINED WITH_INTELPERC)
status
(
" Intel PerC:"
HAVE_INTELPERC THEN
"YES"
ELSE NO
)
endif
(
DEFINED WITH_INTELPERC
)
if
(
DEFINED WITH_GPHOTO2
)
status
(
" gPhoto2:"
HAVE_GPHOTO2 THEN
"YES"
ELSE NO
)
endif
(
DEFINED WITH_GPHOTO2
)
# ========================== Other third-party libraries ==========================
status
(
""
)
...
...
cmake/OpenCVFindLibsVideo.cmake
View file @
6d0407b6
...
...
@@ -311,3 +311,9 @@ endif()
if
(
WITH_INTELPERC
)
include
(
"
${
OpenCV_SOURCE_DIR
}
/cmake/OpenCVFindIntelPerCSDK.cmake"
)
endif
(
WITH_INTELPERC
)
# --- gPhoto2 ---
ocv_clear_vars
(
HAVE_GPHOTO2
)
if
(
WITH_GPHOTO2
)
CHECK_MODULE
(
libgphoto2 HAVE_GPHOTO2
)
endif
(
WITH_GPHOTO2
)
cmake/templates/cvconfig.h.in
View file @
6d0407b6
...
...
@@ -178,3 +178,6 @@
/* Define if your processor stores words with the most significant byte
first (like Motorola and SPARC, unlike Intel and VAX). */
#cmakedefine WORDS_BIGENDIAN
/* gPhoto2 library */
#cmakedefine HAVE_GPHOTO2
modules/videoio/CMakeLists.txt
View file @
6d0407b6
...
...
@@ -186,6 +186,10 @@ if(HAVE_INTELPERC)
list
(
APPEND VIDEOIO_LIBRARIES
${
INTELPERC_LIBRARIES
}
)
endif
(
HAVE_INTELPERC
)
if
(
HAVE_GPHOTO2
)
list
(
APPEND videoio_srcs
${
CMAKE_CURRENT_LIST_DIR
}
/src/cap_gphoto2.cpp
)
endif
(
HAVE_GPHOTO2
)
if
(
IOS
)
add_definitions
(
-DHAVE_IOS=1
)
list
(
APPEND videoio_srcs
...
...
modules/videoio/include/opencv2/videoio.hpp
View file @
6d0407b6
...
...
@@ -89,7 +89,8 @@ enum { CAP_ANY = 0, // autodetect
CAP_WINRT
=
1410
,
// Microsoft Windows Runtime using Media Foundation
CAP_INTELPERC
=
1500
,
// Intel Perceptual Computing SDK
CAP_OPENNI2
=
1600
,
// OpenNI2 (for Kinect)
CAP_OPENNI2_ASUS
=
1610
// OpenNI2 (for Asus Xtion and Occipital Structure sensors)
CAP_OPENNI2_ASUS
=
1610
,
// OpenNI2 (for Asus Xtion and Occipital Structure sensors)
CAP_GPHOTO2
=
1700
// gPhoto2 connection
};
// generic properties (based on DC1394 properties)
...
...
@@ -382,6 +383,23 @@ enum { VIDEOWRITER_PROP_QUALITY = 1, // Quality (0..100%) of the videostream
VIDEOWRITER_PROP_FRAMEBYTES
=
2
,
// (Read-only): Size of just encoded video frame
};
// gPhoto2 properties, if propertyId is less than 0 then work on widget with that __additive inversed__ camera setting ID
// Get IDs by using CAP_PROP_GPHOTO2_WIDGET_ENUMERATE.
// @see CvCaptureCAM_GPHOTO2 for more info
enum
{
CAP_PROP_GPHOTO2_PREVIEW
=
17001
,
// Capture only preview from liveview mode.
CAP_PROP_GPHOTO2_WIDGET_ENUMERATE
=
17002
,
// Readonly, returns (const char *).
CAP_PROP_GPHOTO2_RELOAD_CONFIG
=
17003
,
// Trigger, only by set. Reload camera settings.
CAP_PROP_GPHOTO2_RELOAD_ON_CHANGE
=
17004
,
// Reload all settings on set.
CAP_PROP_GPHOTO2_COLLECT_MSGS
=
17005
,
// Collect messages with details.
CAP_PROP_GPHOTO2_FLUSH_MSGS
=
17006
,
// Readonly, returns (const char *).
CAP_PROP_SPEED
=
17007
,
// Exposure speed. Can be readonly, depends on camera program.
CAP_PROP_APERTURE
=
17008
,
// Aperture. Can be readonly, depends on camera program.
CAP_PROP_EXPOSUREPROGRAM
=
17009
,
// Camera exposure program.
CAP_PROP_VIEWFINDER
=
17010
// Enter liveview mode.
};
//enum {
class
IVideoCapture
;
/** @brief Class for video capturing from video files, image sequences or cameras. The class provides C++ API
...
...
modules/videoio/include/opencv2/videoio/videoio_c.h
View file @
6d0407b6
...
...
@@ -110,7 +110,9 @@ enum
CV_CAP_INTELPERC
=
1500
,
// Intel Perceptual Computing
CV_CAP_OPENNI2
=
1600
// OpenNI2 (for Kinect)
CV_CAP_OPENNI2
=
1600
,
// OpenNI2 (for Kinect)
CV_CAP_GPHOTO2
=
1700
};
/* start capturing frames from camera: index = camera_index + domain_offset (CV_CAP_*) */
...
...
@@ -391,6 +393,23 @@ enum
CV_CAP_INTELPERC_IMAGE
=
3
};
// gPhoto2 properties, if propertyId is less than 0 then work on widget with that __additive inversed__ camera setting ID
// Get IDs by using CAP_PROP_GPHOTO2_WIDGET_ENUMERATE.
// @see CvCaptureCAM_GPHOTO2 for more info
enum
{
CV_CAP_PROP_GPHOTO2_PREVIEW
=
17001
,
// Capture only preview from liveview mode.
CV_CAP_PROP_GPHOTO2_WIDGET_ENUMERATE
=
17002
,
// Readonly, returns (const char *).
CV_CAP_PROP_GPHOTO2_RELOAD_CONFIG
=
17003
,
// Trigger, only by set. Reload camera settings.
CV_CAP_PROP_GPHOTO2_RELOAD_ON_CHANGE
=
17004
,
// Reload all settings on set.
CV_CAP_PROP_GPHOTO2_COLLECT_MSGS
=
17005
,
// Collect messages with details.
CV_CAP_PROP_GPHOTO2_FLUSH_MSGS
=
17006
,
// Readonly, returns (const char *).
CV_CAP_PROP_SPEED
=
17007
,
// Exposure speed. Can be readonly, depends on camera program.
CV_CAP_PROP_APERTURE
=
17008
,
// Aperture. Can be readonly, depends on camera program.
CV_CAP_PROP_EXPOSUREPROGRAM
=
17009
,
// Camera exposure program.
CV_CAP_PROP_VIEWFINDER
=
17010
// Enter liveview mode.
};
/* retrieve or set capture properties */
CVAPI
(
double
)
cvGetCaptureProperty
(
CvCapture
*
capture
,
int
property_id
);
CVAPI
(
int
)
cvSetCaptureProperty
(
CvCapture
*
capture
,
int
property_id
,
double
value
);
...
...
modules/videoio/src/cap.cpp
View file @
6d0407b6
...
...
@@ -518,6 +518,9 @@ static Ptr<IVideoCapture> IVideoCapture_create(int index)
#endif
#ifdef WINRT_VIDEO
CAP_WINRT
,
#endif
#ifdef HAVE_GPHOTO2
CV_CAP_GPHOTO2
,
#endif
-
1
,
-
1
};
...
...
@@ -536,7 +539,8 @@ static Ptr<IVideoCapture> IVideoCapture_create(int index)
{
#if defined(HAVE_DSHOW) || \
defined(HAVE_INTELPERC) || \
defined(WINRT_VIDEO) || \
defined(WINRT_VIDEO) || \
defined(HAVE_GPHOTO2) || \
(0)
Ptr
<
IVideoCapture
>
capture
;
...
...
@@ -558,6 +562,11 @@ static Ptr<IVideoCapture> IVideoCapture_create(int index)
if
(
capture
)
return
capture
;
break
;
// CAP_WINRT
#endif
#ifdef HAVE_GPHOTO2
case
CV_CAP_GPHOTO2
:
capture
=
createGPhoto2Capture
(
index
);
break
;
#endif
}
if
(
capture
&&
capture
->
isOpened
())
...
...
@@ -572,14 +581,37 @@ static Ptr<IVideoCapture> IVideoCapture_create(int index)
static
Ptr
<
IVideoCapture
>
IVideoCapture_create
(
const
String
&
filename
)
{
Ptr
<
IVideoCapture
>
capture
;
int
domains
[]
=
{
CV_CAP_ANY
,
#ifdef HAVE_GPHOTO2
CV_CAP_GPHOTO2
,
#endif
-
1
,
-
1
};
capture
=
createMotionJpegCapture
(
filename
);
if
(
capture
&&
capture
->
isOpened
()
)
// try every possibly installed camera API
for
(
int
i
=
0
;
domains
[
i
]
>=
0
;
i
++
)
{
return
capture
;
}
Ptr
<
IVideoCapture
>
capture
;
switch
(
domains
[
i
])
{
case
CV_CAP_ANY
:
capture
=
createMotionJpegCapture
(
filename
);
break
;
#ifdef HAVE_GPHOTO2
case
CV_CAP_GPHOTO2
:
capture
=
createGPhoto2Capture
(
filename
);
break
;
#endif
}
if
(
capture
&&
capture
->
isOpened
())
{
return
capture
;
}
}
// failed open a camera
return
Ptr
<
IVideoCapture
>
();
}
...
...
@@ -800,4 +832,4 @@ int VideoWriter::fourcc(char c1, char c2, char c3, char c4)
return
(
c1
&
255
)
+
((
c2
&
255
)
<<
8
)
+
((
c3
&
255
)
<<
16
)
+
((
c4
&
255
)
<<
24
);
}
}
\ No newline at end of file
}
modules/videoio/src/cap_gphoto2.cpp
0 → 100644
View file @
6d0407b6
This diff is collapsed.
Click to expand it.
modules/videoio/src/precomp.hpp
View file @
6d0407b6
...
...
@@ -186,6 +186,9 @@ namespace cv
Ptr
<
IVideoCapture
>
createMotionJpegCapture
(
const
String
&
filename
);
Ptr
<
IVideoWriter
>
createMotionJpegWriter
(
const
String
&
filename
,
double
fps
,
Size
frameSize
,
bool
iscolor
);
Ptr
<
IVideoCapture
>
createGPhoto2Capture
(
int
index
);
Ptr
<
IVideoCapture
>
createGPhoto2Capture
(
const
String
&
deviceName
);
};
#endif
/* __VIDEOIO_H_ */
modules/videoio/test/test_precomp.hpp
View file @
6d0407b6
...
...
@@ -37,6 +37,7 @@
defined(HAVE_AVFOUNDATION) || \
defined(HAVE_GIGE_API) || \
defined(HAVE_INTELPERC) || \
defined(HAVE_GPHOTO2) || \
(0)
//defined(HAVE_ANDROID_NATIVE_CAMERA) || - enable after #1193
# define BUILD_WITH_CAMERA_SUPPORT 1
...
...
samples/cpp/autofocus.cpp
0 → 100644
View file @
6d0407b6
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment