Package: videometer
Videometer toolbox for PythonA toolbox for multispectral .HIPS images from Videometer A/SInstallationSystem requirements:Windows operating system64-bit Intel processorUse the package managerpipto installpipinstallvideometerNote : First time the videometer.hips is imported it will fetch DLLsUsage - Readvideometer.hips.read(path, bandIndexesToUse=[])Reads a HIPS image and stores it as an ImageClass object.ParametersInput:-path <String>: Path to the image.-bandIndexesToUse <List of Ints>(optional) List of the indexes who are suppose to be inthe returned ImageClass object. If empty then it will return all of them (default).Output:- ImageClass objectImageClass is explained below.ExamplefromvideometerimporthipsimageCls=hips.read("image.hips")Usage - readOnlyPixelValuesvideometer.hips.readOnlyPixelValues(path)Reads a HIPS image and returns pixel values in a 3-D Numpy array.Makes the reading quicker when only the pixel values are wanted.ParametersInput:-path <String>: Path to the image.Output:- 3-D Numpy arrayExamplefromvideometerimporthipsimg=hips.readOnlyPixelValues("image.hips")Usage - Writevideometer.hips.write(image, path, compression="SameAsImageClass", verbose=False)Writes a HIPS image from an ImageClass object or a NumPy array that correspondsto the pixel values of a spectral image.ParametersInput:-image <ImageClass OR 3-D NumPy array>:  The image to write.-path <String>:  path of the to be written HIPS file.Note it has to include the .hips extension and a existing folder structure.-compression <String>:   Compression level of the image, same as in VideometerLab(Table can be seen below and more detailed one in VideometerLab underFile > Preferences > Compression ) :Level of Compression : {
    "SameAsImageClass" : Keep the same compression as is in the ImageClass 
                        (if it is a numpy array then it will be Uncompressed) 
    "Uncompressed" : No compression
                    (Same as Original in VideometerLab software),
    "VeryHighQuality" : (see VideometerLab software),
    "HighQuality" : (see VideometerLab software),
    "HighCompression" : (see VideometerLab software),
    "VeryHighCompression" : (see VideometerLab software)
}-verbose <Boolean>:   If true then prints out the name of the file otherwise not.Default is falseOutput:- Returns a full path to the written .HIPS image if successful otherwise None.Compression Preset TablePresetStorageReflectance PrecisionTypical Image SizeUncompressedRAW (32bit float)N/A912MB (100%)Very High Quality12 bit PNG0.03171MB (19%)High Quality10 bit PNG0.12159MB (17%)High Compression8 bit PNG0.47110MB (10%)Very High Compression8 bit JPEG0.47 + Edge artifacts31MB (3%)Example - Writing ImageClassfromvideometerimporthipsimageCls=hips.read("image.hips")fullPath2Image=hips.write(imageCls,"image.hips",compression="HighCompression")iffullPath2ImageisNone:print("FAILED")else:print("SUCCESS!")Example - Writing NumPy arrayfromvideometerimporthipsimportnumpyasnpnpArray=np.array([[0.,1.,2.],[3.,4.,5.],[6.,7.,8.]],dtype=np.float32)npArray=npArray.reshape((3,3,1))# Height, Width, BandsfullPath2Image=hips.write(npArray,"imageFromNumpyArray.hips")iffullPath2ImageisNone:print("Failed")else:print("Success!")Usage - Showvideometer.hips.show(  image, ifUseMask=False, bandIndexesToUse=[], ifOnlyGetListOfPLTObjects=False):Function that shows images of individual bands.ParametersInput:-image <ImageClass OR 3-D NumPy array>:  ImageClass object or NumPy array (3-D).-ifUseMask <Boolean>If set to true and mask is set on the ImageClass object then the image will show masked.-bandIndexesToUse <List of Ints>(optional) : List of Indexes of the bands to be shown.If empty then it will return all of them (default).-ifOnlyGetListOfPLTObjects  <Boolean>(Optional): If set to True it won't plot the images (Mainly used in testing)Output:- Shows the images- Returns the list of the matplotlib.image.AxesImage objects (Mostly used in testing)Usage - Show RGBvideometer.hips.showRGB(imageClass, ifUseMask=False):Function that shows srgb representation of the image.If ifUseForegroundMask is true then the image will be shown masked.ParametersInput:-image <ImageClass>:    ImageClass object to be shown.-ifUseMask <Boolean>:  To toggle mask on or off if set on the ImageClass object.Output:- Shows the images- Returns the matplotlib.image.AxesImage object (Mostly used for testing).ImageClassThe center of the toolbox.AttributesPixelValues- NumPy array of floats (3-D)Contains float pixel values of the HIPS image. Shape of the array is (height, width, bands).Height- IntHeight of the HIPS image.Width- IntWidth of the HIPS image.MmPixel- FloatPhysical size of each pixel in mm.Bands- IntNumber of bands in the image.BandNames- NumPy array of stringsList of names of the bands.WaveLengths- NumPy array of floatsContains wavelenghts of the bands in HIPS image.Description- StringDescription set of the imageHistory- StringExplains the history of the image.Illumination– NumPy array of stringsList of Illumination name type of each band.StrobeTimes– NumPy array of intStrobe time in ms of each band in the image.StrobeTimesUniversal- NumPy array of floatsUniversal strobe time of each band in the image.FreehandLayers– List of dictionariesEach set Freehand layer is a dictionary with the following template :{
    "name" : <string>
    "layerId" : <int>
    "description" : <string>
    "pixels" :  <2-D numpy array>
}RGBPixels– NumPy array (height, width, 3)Array representing sRGB pixel values of the image.The values are set by using to_sRGB method in the ImageClass otherwise it will return NoneForegroundPixels– NumPy array (2-D)Foreground mask of the image given as a binary 2-D numpy array.If Foreground pixels are not set on the image object it will return None.DeadPixels– NumPy array (2-D)Dead pixels of the image given as a binary 2-D numpy arra.If Dead pixels are not set on the image object it will return None.CorrectedPixels– NumPy array (2-D)Corrected pixels of the image given as a binary 2-D numpy array.If Corrected pixels are not set on the image object it will return None.SaturatedPixels– NumPy array (2-D)Saturated pixels of the image given as a binary 2-D numpy arra.If Saturated pixels are not set on the image object it will return None.ExtraData– Dictionary <string> : <Float>Contains additional information about the image (e.g. temperature
data and similar).ExtraDataInt– Dictionary  <string> : <Int>Contains additional information about the image.ExtraDataString– Dictionary <string> : <string>Contains additional information about the image.FunctionsTo_sRGB(spectraName="D65")Performs conversion of the spectral image to sRGB image.ParametersInput:-SpectraName (optional) <String>: Name of the spectra used for the transformation, default is D65.Output:- Returns the numpy sRGB image  <NumPy array 2-D>- Updates the "RGBPixels" attributeextractBands(bandIndexesToUse)Similar to the Image Tools > Conversion > Extract bands in VideometerLab software.The bands and their information given in the bandsIndexesToUse remain in the ImageClass,others are deleted.ParametersInput:-bandIndexesToUse <List of Ints>: List of indexes of the bands to remain in the class.Output: NoneBugs or suggestionsSuggestions and bug reports may be sent toasc@videometer.comorjmk@videometer.comEnjoy!LicenceBSD-3-Clause-Clear license