DiskGrabber

class DiskGrabber(*args, **kwargs)

Bases: FrameGrabber

Class to grab (ie. read) images from the disk.

Defined a virtual video device. “Grab” the images from the disk. Derived from the vpFrameGrabber class.

Note

See vpFrameGrabber

Here an example of capture from the directory “/local/soft/ViSP/ViSP-images/cube”. We want to acquire 10 images from the first named “image.0001.pgm” by steps of 2.

#include <visp3/core/vpImage.h>
#include <visp3/io/vpDiskGrabber.h>

#ifdef ENABLE_VISP_NAMESPACE
using namespace VISP_NAMESPACE_NAME;
#endif

int main(){
  vpImage<unsigned char> I; // Grey level image

  // Declare a framegrabber able to read a sequence of successive
  // images from the disk
  vpDiskGrabber g;

  // Set the path to the directory containing the sequence
  g.setDirectory("/local/soft/ViSP/ViSP-images/cube");
  // Set the image base name. The directory and the base name constitute
  // the constant part of the full filename
  g.setBaseName("image.");
  // Set the step between two images of the sequence
  g.setStep(2);
  // Set the number of digits to build the image number
  g.setNumberOfZero(4);
  // Set the first frame number of the sequence
  g.setImageNumber(1);
  // Set the image file extension
  g.setExtension("pgm");

  // Open the framegrabber by loading the first image of the sequence
  g.open(I) ;

  unsigned int cpt = 1;
  // this is the loop over the image sequence
  while(cpt ++ < 10)
  {
    // read the image and then increment the image counter so that the next
    // call to acquire(I) will get the next image
    g.acquire(I) ;
  }
}

Overloaded function.

  1. __init__(self: visp._visp.io.DiskGrabber) -> None

Default constructor.

  1. __init__(self: visp._visp.io.DiskGrabber, genericName: str) -> None

  2. __init__(self: visp._visp.io.DiskGrabber, dir: str, basename: str, number: int, step: int, noz: int, ext: str) -> None

Methods

__init__

Overloaded function.

acquire

Overloaded function.

close

Not useful.

getImageName

Return the name of the file in which the last frame was read.

getImageNumber

Return the current image number.

open

Overloaded function.

setBaseName

Set the image base name.

setDirectory

Set the main directory name (ie location of the image sequence).

setExtension

Set the image extension.

setGenericName

Set the image generic name like image-%04d.png .

setImageNumber

Set the number of the image to be read.

setNumberOfZero

Set the step between two images.

setStep

Set the step between two images.

Inherited Methods

init

getHeight

Return the number of rows in the image.

getWidth

Return the number of columns in the image.

Operators

__doc__

__init__

Overloaded function.

__module__

Attributes

__annotations__

init

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: visp._visp.io.DiskGrabber) -> None

Default constructor.

  1. __init__(self: visp._visp.io.DiskGrabber, genericName: str) -> None

  2. __init__(self: visp._visp.io.DiskGrabber, dir: str, basename: str, number: int, step: int, noz: int, ext: str) -> None

acquire(*args, **kwargs)

Overloaded function.

  1. acquire(self: visp._visp.io.DiskGrabber, I: visp._visp.core.ImageGray) -> None

Acquire an image reading the next image from the disk. After this call, the image number is incremented considering the step.

Parameters:
I

The image read from a file.

  1. acquire(self: visp._visp.io.DiskGrabber, I: visp._visp.core.ImageRGBa) -> None

Acquire an image reading the next image from the disk. After this call, the image number is incremented considering the step.

Parameters:
I

The image read from a file.

  1. acquire(self: visp._visp.io.DiskGrabber, I: visp._visp.core.ImageFloat) -> None

Acquire an image reading the next image from the disk. After this call, the image number is incremented considering the step.

Parameters:
I

The image read from a file.

  1. acquire(self: visp._visp.io.DiskGrabber, I: visp._visp.core.ImageGray, image_number: int) -> None

Acquire an image reading the image with number img_number from the disk. After this call, the image number is incremented considering the step.

Parameters:
I

The image read from a file.

image_number

The number of the desired image.

  1. acquire(self: visp._visp.io.DiskGrabber, I: visp._visp.core.ImageRGBa, image_number: int) -> None

Acquire an image reading the image with number img_number from the disk. After this call, the image number is incremented considering the step.

Parameters:
I

The image read from a file.

image_number

The number of the desired image.

  1. acquire(self: visp._visp.io.DiskGrabber, I: visp._visp.core.ImageFloat, image_number: int) -> None

Acquire an image reading the pfm image with number img_number from the disk. After this call, the image number is incremented considering the step.

Parameters:
I

The image read from a file.

image_number

The number of the desired image.

close(self) None

Not useful.

Does nothing. Here for compatibility issue with the vpFrameGrabber class.

getHeight(self) int

Return the number of rows in the image.

getImageName(self) str

Return the name of the file in which the last frame was read.

getImageNumber(self) int

Return the current image number.

getWidth(self) int

Return the number of columns in the image.

open(*args, **kwargs)

Overloaded function.

  1. open(self: visp._visp.io.DiskGrabber, I: visp._visp.core.ImageGray) -> None

Read the first image of the sequence. The image number is not incremented.

  1. open(self: visp._visp.io.DiskGrabber, I: visp._visp.core.ImageRGBa) -> None

Read the first image of the sequence. The image number is not incremented.

  1. open(self: visp._visp.io.DiskGrabber, I: visp._visp.core.ImageFloat) -> None

Read the first image of the sequence. The image number is not incremented.

setBaseName(self, name: str) None

Set the image base name.

setDirectory(self, dir: str) None

Set the main directory name (ie location of the image sequence).

setExtension(self, ext: str) None

Set the image extension.

setGenericName(self, genericName: str) None

Set the image generic name like image-%04d.png .

setImageNumber(self, number: int) None

Set the number of the image to be read.

setNumberOfZero(self, noz: int) None

Set the step between two images.

setStep(self, step: int) None

Set the step between two images.