Package pyrobot :: Package camera :: Package fake :: Class FakeCamera
[frames | no frames]

Class FakeCamera

      Device --+    
               |    
PyrobotImage --+    
               |    
          Camera --+
                   |
                  FakeCamera


A fake camera.  This will emulate a camera, but instead of
accessing the hardware, it will load a series of images from file.

Method Summary
  __init__(self, pattern, start, stop, char, interval, visionSystem, verbose)
pattern is a filename with indicators on where to put digits for the sequence.
  freezeFrame(self)
  pauseButton(self)
  playButton(self)
  setUpdateInterval(self, val)
  unFreezeFrame(self)
  update(self)
Update method for getting next sequence from a video camera.
    Inherited from Camera
  addFilter(self, func, *args)
Add a filter to the filter list.
  apply(self, command, *args)
  clearCallbackList(self)
  clearFilters(self)
  delFilter(self, pos)
  getCanvasHeight(self)
  getCanvasWidth(self)
  getData(self)
  getDeviceData(self)
Returns the device data, whatever it might be.
  getDeviceState(self)
Returns the .state.
  getFilterList(self)
  getImage(self)
  hideWindow(self)
  listCallbackList(self)
  loadFilters(self)
  makeFilterMenu(self, data)
  makeMenu(self, bar, name, commands)
Assumes self.menuButtons exists...
  makeWindow(self)
Method to make and show the device window.
  popCallbackList(self)
  popFilterList(self)
  printit(self, event)
  processAll(self)
  processLeftClickDown(self, event)
  processLeftClickUp(self, event)
  processMiddleClick(self, event)
  processRightClick(self, event)
  saveAsTGA(self, path)
Save a copy of the image to disk, in TGA format (Gimp and display can read it).
  saveFilters(self)
  saveImage(self)
  setFilterList(self, filterList)
Filters take the form: ("name", (args))...
  setTitle(self, title)
Sets the title of the device.
  startDevice(self)
Starts the device (sets the .state).
  stopDevice(self)
Stops the device (sets the .state).
  toggleFilterMode(self)
  togglePlay(self, event)
  updateButton(self)
  updateDevice(self)
Method called to update the device properties.
  updateOnce(self)
  updateWindow(self)
Method to update the device window.
    Inherited from PyrobotImage
  convolve(self, convmask, bit, threshold)
  cropPixels(self, l, t, r, b)
cropPixels() ------------ crops pixels in the amount specified from left, top, right, and bottom if unspecified, right is assumed to be the same as left and bottom the same as top.
  display(self)
Display PyrobotImage in ASCII Art.
  get(self, x, y, offset)
Get a pixel value.
  getBitmap(self, cutoff, cutoff2, mode)
getBitmap()...
  getCol(self, x)
Get the entire col, in tuples...
  getColorFilter(self, r, g, b)
returns a filtered image r,g,b values indicate percentage of each color to keep eg.
  getDim(self)
  getGrayScale(self)
Method to convert depth 3 color into depth 1 grayscale...
  getPlane(self, colorPlane)
  getRow(self, y)
Get the entire row, in tuples...
  getScaledImage(self, xscale, yscale, mode)
return a scaled version of the current image...
  getVal(self, x, y)
Get the entire color value of the pixel in quetion, returned as a tuple.
  histogram(self, cols, rows, initvals)
Creates a histogram.
  incr(self, x, y, offset)
Method to increment a pixel value.
  loadFromFile(self, filename)
Method to load image from file.
  reset(self, vector)
Reset an image to a vector.
  resetToColor(self, r, g, b)
reset the image to a specified color...
  saveToFile(self, filename)
Method to save image to a file.
  setVal(self, x, y, val)
Method to set the entire RGB value of a pixel.
  swapPlanes(self, plane1, plane2)
    Inherited from Device
  __getitem__(self, item)
Get a SensorValue, a range, or a set.
  __iter__(self)
Used to iterate through SensorValues of device.
  addWidgets(self, window)
Method to addWidgets to the device window.
  angle(self, *args, **kwargs)
Device-level method to get all of the angles.
  destroy(self)
Hides the window.
  distance(self, *args, **kwargs)
Device-level method to get all of the distances.
  getActive(self)
Returns the value of .active.
  getGroupNames(self, pos)
Return all of the groups a pos is in.
  getMaxvalue(self)
Get the maxvalue of the sensor.
  getSensorValue(self, pos)
Returns a specific SensorValue from the range device.
  getVisible(self)
Returns the .visible of the sensor.
  rawToUnits(self, raw, noise, units)
Convert the sensor units into default units.
  setActive(self, value)
Sets the .active property.
  setMaxvalue(self, value)
Set the maxvalue of the sensor.
  setup(self)
Use this to put setup code in (instead of in __init__).
  setVisible(self, value)
Sets the .visible attribute, and hides/shows window.

Property Summary
    Inherited from Device
  geometry
  noise
  pos
  rawValue
  value

Method Details

__init__(self, pattern=None, start=0, stop=19, char='?', interval=1.0, visionSystem=None, verbose=0)
(Constructor)

pattern is a filename with indicators on where to put digits for the
sequence.  Absolute or relative filenames can be used.

For example, 'image???-.ppm' would start at 'image000.ppm'
and continue up to stop.

char is the character that should be replaced in the pattern.

interval = how often do I get new image

As an example, to load som-0.ppm through som-19.ppm, we could call
FakeCamera('vision/snaps/som-?.ppm', 0, 19)
Overrides:
pyrobot.camera.Camera.__init__

update(self)

Update method for getting next sequence from a video camera.
Overrides:
pyrobot.camera.Camera.update (inherited documentation)

Generated by Epydoc 2.1 on Mon Jul 25 01:39:26 2005 http://epydoc.sf.net