Is there a way to generate a customised mock driver similar to CVMock.vin?

Hi there,
When I do not have a camera attached, for my testing I use the CVMock.vin driver. However, it would be preferred if I could have mock image data that is more applicable to the application to aid camera-less testing. Is it possible to generate our own ‘mock.vin’ file, and if so, how can one go about doing this?

Thanks in advance…

Hi @Foster

yes, it is in fact possible to configure what the CVMock.vin driver shows. The driver evaluates the CVMock.ini file which it is searching in either %CVBDATA%Drivers or in the application’s current directory (if the file exists in both locations, the one in the current directory has priority over the one in %CVBDATA%Drivers.

The file is - as the name implies - an old-style ini file with name/value pairs. There are a few of them sprinkled over the :cvb: installation and most of them contain a description of how to fill them out, along with one or more sample configurations:

; INI for CVMock.vin 

; --------------------------------------------------------------------------------------------------
; The CVMock.vin driver will first attempt to find this configuration file in the working directory
; of the calling application. If none is found, the CVMock.ini from %CVBDATA%drivers is used.
; --------------------------------------------------------------------------------------------------

; MockType:
;     0 -> MockVin generated image
;     1 -> Load Emu file from loadPath
;   	         If .emu files with loadAtOnce = 0 are loaded, the buffer size is set to
;              imgBuff which then mustn't be 0!
;     2 -> Load image files from loadPath

; LoadPath
;     Location where images or .emu to load are stored. Shortcuts for the leading path
;     component are available for: 
;
;         Environment strings:
;             To utilize an environment string as a part of the path, use the 
;             respective name enclosed in percentage signs (%).
;             E.g. %CVB%/tutorial
;
;         Application directory:
;             If the images are to be read from the application directory itself, 
;             @APPDIR is dynamically adapted to reference this path.
;             E.g. @APPDIR/clara.bmp

; ImgPrefix
;     Name which is part of each image to be loaded e.g. img001, img002
;	    either as regex img.*.bmp or img*.bmp

; FrameRate
;     Display images in frames per second. This value overrides the .emu's frame rate specified by the "Delay" value.

; BufferCount
;     Amount of images to be preloaded. 0 will load all available images at once
;     except when loading from .emu which defines loadAtOnce on its own.


; ------------------------------------------------------------------------------------
; Following parameters are only needed for mockType=0.
; ------------------------------------------------------------------------------------

; BufferWidth
;     Width of the buffer/image in pixels.

; BufferHeight
;     Height of the buffer/image inpixels.

; BufferFormats:
;     0   -> Mono8       ramp pattern
;     1   -> RGB24       red ramp others 0
;     2   -> RGB24       green ramp others 0
;     3   -> RGB24       blue ramp others 0
;     4   -> Mon10   4 x Mono8 ramp
;     5   -> RGB30   4 x red ramp others 0
;     6   -> RGB30   4 x green ramp others 0
;     7   -> RGB30   4 x blue ramp others 0
;     8   -> Mono12 16 x Mono8 ramp
;     9   -> RGB36  16 x red ramp others 0
;     10  -> RGB36  16 x green ramp others 0
;     11  -> RGB36  16 x blue ramp others 0

; BufferRoll
;     Steps to advance between images for moving buffer
;     256 steps available for all formats

; required for valid ini format
ProfileName=Default

[Board0_Channel0]
; default values if nothing but the port node is defined
; these lines cannot have comments next to themselves
MockType=1
LoadPath=%CVB%/tutorial/Polimago/Images/Cookies/_LoadMe.emu
FrameRate=50
ImgPrefix=.*.bmp
imgBuff=5

Hi @illusive,
Excellent - this is exactly what I needed…

Many thanks and Frohe Weihnachten!
Lee