Skip to content

Commit

Permalink
Add VideoCaptureProperties for video capture settings and descriptive…
Browse files Browse the repository at this point in the history
… godocs

Signed-off-by: deadprogram <[email protected]>
  • Loading branch information
deadprogram committed Oct 8, 2017
1 parent 66c165d commit bc9a420
Show file tree
Hide file tree
Showing 3 changed files with 152 additions and 4 deletions.
14 changes: 11 additions & 3 deletions imgproc_colorcodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,9 @@ const (
// ColorGrayToBGR555 converts from grayscale to BGR555 (16-bit images).
ColorGrayToBGR555 = 30

// ColorGrayToBGR555 converts from BGR555 (16-bit images) to grayscale.
// ColorBGR555ToGRAY converts from BGR555 (16-bit images) to grayscale.
ColorBGR555ToGRAY = 31

// convert RGB/BGR to CIE XYZ

// ColorBGRToXYZ converts from BGR to CIE XYZ.
ColorBGRToXYZ = 32

Expand Down Expand Up @@ -195,12 +193,22 @@ const (
// ColorRGBToHSVFull converts from RGB to HSV (hue saturation value) full.
ColorRGBToHSVFull = 67

// ColorBGRToHLSFull converts from BGR to HLS (hue lightness saturation) full.
ColorBGRToHLSFull = 68

// ColorRGBToHLSFull converts from RGB to HLS (hue lightness saturation) full.
ColorRGBToHLSFull = 69

// ColorHSVToBGRFull converts from HSV (hue saturation value) to BGR full.
ColorHSVToBGRFull = 70

// ColorHSVToRGBFull converts from HSV (hue saturation value) to RGB full.
ColorHSVToRGBFull = 71

// ColorHLSToBGRFull converts from HLS (hue lightness saturation) to BGR full.
ColorHLSToBGRFull = 72

// ColorHLSToRGBFull converts from HLS (hue lightness saturation) to RGB full.
ColorHLSToRGBFull = 73

ColorLBGRToLab = 74
Expand Down
141 changes: 140 additions & 1 deletion videoio.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,145 @@ import (
"unsafe"
)

// VideoCaptureProperties are the properties used for VideoCapture operations.
type VideoCaptureProperties int

const (
// VideoCapturePosMsec contains current position of the
// video file in milliseconds.
VideoCapturePosMsec VideoCaptureProperties = 0

// VideoCapturePosFrames 0-based index of the frame to be
// decoded/captured next.
VideoCapturePosFrames = 1

// VideoCapturePosAVIRatio relative position of the video file:
// 0=start of the film, 1=end of the film.
VideoCapturePosAVIRatio = 2

// VideoCaptureFrameWidth is width of the frames in the video stream.
VideoCaptureFrameWidth = 3

// VideoCaptureFrameHeight controls height of frames in the video stream.
VideoCaptureFrameHeight = 4

// VideoCaptureFPS controls capture frame rate.
VideoCaptureFPS = 5

// VideoCaptureFOURCC contains the 4-character code of codec.
// see VideoWriter::fourcc for details.
VideoCaptureFOURCC = 6

// VideoCaptureFrameCount contains number of frames in the video file.
VideoCaptureFrameCount = 7

// VideoCaptureFormat format of the Mat objects returned by
// VideoCapture::retrieve().
VideoCaptureFormat = 8

// VideoCaptureMode contains backend-specific value indicating
// the current capture mode.
VideoCaptureMode = 9

// VideoCaptureBrightness is brightness of the image
// (only for those cameras that support).
VideoCaptureBrightness = 10

// VideoCaptureContrast is contrast of the image
// (only for cameras that support it).
VideoCaptureContrast = 11

// VideoCaptureSaturation saturation of the image
// (only for cameras that support).
VideoCaptureSaturation = 12

// VideoCaptureHue hue of the image (only for cameras that support).
VideoCaptureHue = 13

// VideoCaptureGain is the gain of the capture image.
// (only for those cameras that support).
VideoCaptureGain = 14

// VideoCaptureExposure is the exposure of the capture image.
// (only for those cameras that support).
VideoCaptureExposure = 15

// VideoCaptureConvertRGB is a boolean flags indicating whether
// images should be converted to RGB.
VideoCaptureConvertRGB = 16

// VideoCaptureWhiteBalanceBlueU is currently unsupported.
VideoCaptureWhiteBalanceBlueU = 17

// VideoCaptureRectification is the rectification flag for stereo cameras.
// Note: only supported by DC1394 v 2.x backend currently.
VideoCaptureRectification = 18

// VideoCaptureMonochrome indicates whether images should be
// converted to monochrome.
VideoCaptureMonochrome = 19

// VideoCaptureSharpness controls image capture sharpness.
VideoCaptureSharpness = 20

// VideoCaptureAutoExposure controls the DC1394 exposure control
// done by camera, user can adjust reference level using this feature.
VideoCaptureAutoExposure = 21

// VideoCaptureGamma controls video capture gamma.
VideoCaptureGamma = 22

// VideoCaptureTemperature controls video capture temperature.
VideoCaptureTemperature = 23

// VideoCaptureTrigger controls video capture trigger.
VideoCaptureTrigger = 24

// VideoCaptureTriggerDelay controls video capture trigger delay.
VideoCaptureTriggerDelay = 25

// VideoCaptureWhiteBalanceRedV controls video capture setting for
// white balance.
VideoCaptureWhiteBalanceRedV = 26

// VideoCaptureZoom controls video capture zoom.
VideoCaptureZoom = 27

// VideoCaptureFocus controls video capture focus.
VideoCaptureFocus = 28

// VideoCaptureGUID controls video capture GUID.
VideoCaptureGUID = 29

// VideoCaptureISOSpeed controls video capture ISO speed.
VideoCaptureISOSpeed = 30

// VideoCaptureBacklight controls video capture backlight.
VideoCaptureBacklight = 32

// VideoCapturePan controls video capture pan.
VideoCapturePan = 33

// VideoCaptureTilt controls video capture tilt.
VideoCaptureTilt = 34

// VideoCaptureRoll controls video capture roll.
VideoCaptureRoll = 35

// VideoCaptureIris controls video capture iris.
VideoCaptureIris = 36

// VideoCaptureSettings is the pop up video/camera filter dialog. Note:
// only supported by DSHOW backend currently. The property value is ignored.
VideoCaptureSettings = 37

// VideoCaptureBufferSize controls video capture buffer size.
VideoCaptureBufferSize = 38

// VideoCaptureAutoFocus controls video capture auto focus..
VideoCaptureAutoFocus = 39
)

// VideoCapture is a wrapper around the OpenCV VideoCapture class.
//
// For further details, please see:
Expand Down Expand Up @@ -47,7 +186,7 @@ func (v *VideoCapture) Close() error {
}

// Set parameter with property (=key).
func (v *VideoCapture) Set(prop int, param int) {
func (v *VideoCapture) Set(prop int, param VideoCaptureProperties) {
C.VideoCapture_Set(v.p, C.int(prop), C.int(param))
}

Expand Down
1 change: 1 addition & 0 deletions videoio_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ func TestVideoCaptureFile(t *testing.T) {
t.Error("Unable to open VideoCaptureFile")
}

vc.Set(VideoCaptureBrightness, 100)
vc.Grab(10)

img := NewMat()
Expand Down

0 comments on commit bc9a420

Please sign in to comment.