Skip to main content

ModifyCamera

ModifyCamera /W=winName [ /Z ] keyword=value

The ModifyCamera operation is used to change the settings of the named camera.

You must specify the camera window of interest using the /W flag.

warning

ModifyCamera was added in Igor Pro 7.00, and deprecated in Igor Pro 10.00. Use MMI_ModifyCamera instead.

Flags

/W=winNameSpecifies the camera window to target. Use the name of the camera window, e.g., camera0, not the name/description of the camera.
If the camera window is embedded in a graph the name would have the form e.g., Graph0#CM0.
/TO=msms is a timeout in milliseconds. The capture of an image is terminated if it takes longer than ms milliseconds to complete.
In the case of sequential capture, the timeout is applied to the first frame only.
If capture is terminated due to timeout, IGOR returns a "timeout while writing data" error.
/ZSuppress errors. Sets V_Flag to zero or to a non-zero error code.

Keywords

cancelCaptureCancels a capture in progress, if any.
capture[=dataFolderAndName]
Captures a single frame and store it in a wave.
dataFolderAndName is a data folder path to a wave or a simple name of a wave in the current data folder. The wave may or may not exist when you invoke capture. If it does exist, it is overwritten.
If you omit =dataFolderAndName, ModifyCamera creates the wave with the name M_Frame in the current data folder.
The created wave is a three-layer RGB wave of type unsigned byte.
It is best to use the capture keyword without any other keywords because the order of execution of keywords is unspecified.
ModifyCamera executes the capture before returning control to Igor. The time required is hardware-dependent and sets the speed limit when capturing a sequence of frames.
customFocusPoint={fx,fy}
Specifies a custom focus point where fx and fy are in the range [0,1] in relative frame coordinates measured from the top-left corner of the frame. You must invoke setFocusPointMode before other keywords to set a custom focus point.
grabSequence={nf ,dt }Grabs a sequence of nf frames every dt milliseconds and stores the frames in the 4D wave M_FrameSequence in the current data folder.
nf and dt are integers greater than or equal to 1.
Time resolution is on the order of 1 millisecond and may be further degraded by hardware limitations.
grabToFunctionStarts a continuous loop of grabbing camera frames and passing them to the user function specified by the grabFunctionName keyword. The loop is terminated when the user function returns a negative number or a timeout occurs. For details, see GrabToFunction Details below.
grabFunctionName=func
Sets the user function that is called continuously when you execute the grabToFunction keyword. For details, see GrabToFunction Details below.
setPixelFormat=pixelFormatStr
pixelFormatStr is a string containg one of the following:
ARGB32, ARGB32_Premultiplied, RGB32, RGB24, RGB565, RGB555, ARGB8565_Premultiplied, BGRA32, BGRA32_Premultiplied, BGR32, BGR24, BGR565, BGR555, BGRA5658_Premultiplied, AYUV444, Format_AYUV444_Premultiplied, YUV444, YUV420P, YV12, UYVY, YUYV, NV12, NV21, Format_IMC1, Format_IMC2, Format_IMC3, Format_IMC4, Format_Y8, Format_Y16, Format_Jpeg,
While the various "Premultiplied" formats are supported, they are not useful because all exports are strictly in RGB (no alpha). Also, since the capture results in an RGB wave, any pixel format choice here would potentially entail additional time-consuming conversions from the internal format to RGB.
searchAndLockIn stillImage capture mode, this keyword instructs the camera to search and lock the focus in preparation for a capture.
setAspectRatio={w,h}Sets the viewing aspect ratio in pixels.
setAutoApertureTells the camera driver to determine the best aperture setting.
setAutoISOSensitivityTells the camera driver to determine the optimal ISO setting.
setAutoShutterSpeedTells the camera driver to determine the optimal shutter speed.
setCaptureMode=cmSets the capture mode:
cm = 0:Preview
cm = 1:Still image
cm = 2:Video capture
setColorFilter=cfSets the color filter that is applied to the input. Supported filters include:
ValueFilter
0None
1Grayscale
2Negative
3Solarize
4Sepia
5Posterize
6Whiteboard
7Blackboard
8Aqua
1000Start of vendor-specific color filters
setContrast=contrastSets the contrast in the range [-1,1]. The default is 0.
setDenoising=dnSets denoising in the range [-1,1]. The default is 0.
setExposureComp=ecSets exposure compensation in ev units.
setExposureMode=emSets the camera's exposure mode. The following modes are supported:
emExposure Mode
0Auto
1Manual
2Portrait
3Night
4Backlight
5Spotlight
6Sports
7Snow
8Beach
9Large aperture
10Small aperture
11Action
12Landscape
13Night portrait
14Theater
15Sunset
16Steady photo
17Fireworks
18Party
19Candlelight
20Barcode
1000Start of vendor-specific exposure modes
setFlashMode=fmSets the operating mode of the camera's flash. Supported flash modes are:
fmFlash Mode
1Auto
2Off
4On
8Redeye reduction
16Fill
32Torch
64Video light
128Front curtain
256Rear curtain
512Manual
setFocusMode=fmSets the camera's focus mode. Supported focus modes are:
fmFocus Mode
1Manual
2Hyperfocal
4Infinity
8Auto focus
16Continuous
32Macro
setFocusPointMode=fpm
Sets the camera's focus point mode. Supported focus point modes are:
ValueFocus Point Mode
0Auto
1Center
2Face detection
3Custom point
setFrameRate={min,max}
Sets the frame rate in the range [min,max].
setManualAperture=fnSets the aperture to a specific f-number. You may want to check that fn is in the supported range. See GetCamera supportedApertures.
setManualIsoSensitivity=isoInt
Sets the ISO manually to isoInt. You may want to check that isoInt is in the supported list. See GetCamera supportedIsoSensitivities.
setManualShutterSpeed=ss
Sets manual shutter speed to ss , in seconds. You may want to check that ss is within supported range. See GetCamera supportedShutterSpeeds.
setManualWB=tempSets the manual white balance to the specified temperature in degrees Kelvin.
setMeteringMode=mmSets the metering mode. Supported metering modes are:
mmMetering Mode
1Matrix
2Average
3Spot
setPixelFormat=pfThe following pixel format values are defined:
pfPixel Format
1ARGB32
2ARGB32_Premultiplied
3RGB32
4RGB24
5RGB565
6RGB555
7ARGB8565_Premultiplied
8BGRA32
9BGRA32_Premultiplied
10BGR32
11BGR24
12BGR565
13BGR555
14BGRA5658_Premultiplied
15AYUV444
16Format_AYUV444_Premultiplied
17YUV444
18YUV420P
19YV12
20UYVY
While the various "Premultiplied" formats are supported, they are not useful because all exports are strictly in RGB (no alpha). Also, since the capture results in an RGB wave, any pixelFormat choice here would potentially entail additional time-consuming conversions from the internal format to RGB.
setResolution={w,h}Sets the resolution to w (width) and h (height). You may want to check that you are using values supported by the driver. See GetCamera viewfinderResolutions.
setSaturation=stSets the saturation change in the range [-1,1]. The default is 0.
setSharpening=srSets the sharpening change in the range [-1,1]. The default is 0.
setSpotMeteringPoint={x,y}
Sets the metering point. x and y are the horizontal and vertical fractions of the frame measured from the top-left corner and in the range [0,1].
setWBMode=wbSets the white balance mode. Supported white balance modes are:
wbWhite Balance Mode
0Auto
1Manual
2Sunlight
3Cloudy
4Shade
5Tungsten
6Fluorescent
7Flash
8Sunset
1000Start of vendor-specific white balance modes
startPreviewStarts live video in the camera window.
stopPreviewStops live video in the camera window.
unlockUnlocks focus and return to focus searching. See the searchAndLock keyword.
zoomTo={opticalZoom, digitalZoom}
Sets the camera's optical and digital zoom values. There may be a delay before the optical zoom attains the requested value.

Details

This operation includes a broad range of keywords corresponding to options that may not be supported in practice by either the system or the specific camera driver. In most sitations the operation will not return an error in response to an unsupported request. The only reliable way to determine if a requested setting is supported is to execute GetCamera with the appropriate keyword.

GrabToFunction Details

The grabToFunction keyword starts a continuous loop of grabbing camera frames and passing them to the user function specified by the grabFunctionName keyword.

The function takes two parameters: a wave that contains the RGB image data and a counter specifying the zero-based index of the current frame.

The function must return a negative number to terminate frame grabbing or 0 to continue frame grabbing.

The function must not attempt to display, kill or modify the input wave.

To see how this works, paste these functions into your procedure window:

Function MyGrabFunction(frameWave, frameIndex)
Wave frameWave
Variable frameIndex // Zero-based frame index number

ImageThreshold/M=1/Q/P=0 frameWave
Wave M_ImageThresh
if (WinType("DemoGraph") == 0)
NewImage/N=DemoGraph M_ImageThresh
else
DoUpdate/W=DemoGraph
endif

// Terminate after a 100 image grabs
if (frameIndex >= 100)
Print "Finished 100 frames"
return -1 // Tells grabToFunction to terminate
endif

// Support termination using the escape key:
if(GetKeyState(0) & 32)
Print "Frame grabbing aborted by escape key"
return -1 // Tells grabToFunction to terminate
endif

return 0 // Tells grabToFunction to continue
End

Function StartFrameGrabbing()
if (WinType("DemoCamera") == 0)
NewCamera/N=DemoCamera
endif
ModifyCamera/W=DemoCamera grabFunctionName=MyGrabFunction
Print "Starting frame grabbing"
ModifyCamera/W=DemoCamera grabToFunction
End

Now execute this command line:

StartFrameGrabbing()

Output Variables

ModifyCamera sets the following output variable:

V_flag0 if the operation succeeded or a non-zero error code.

See Also

NewCamera, GetCamera, MMI - Overview