# Command Source_OpenFile

## Using of command

This command is use for load picture from file to test program image structure. Command use OpenCv function cvLoadImage.
Following file formats are suported:

1. Windows bitmaps - BMP, DIB
2. JPEG files - JPEG, JPG, JPE
3. Portable Network Graphics - PNG
4. Portable image format - PBM, PGM, PPM
5. Sun rasters - SR, RAS
6. TIFF files - TIFF, TIF
7. OpenEXR HDR images - EXR
8. JPEG 2000 images - jp2

## Commands parameters

Function has 3 parameters:

1. Path to picture file: This parameter sets path for picture file which will be loaded.Click on this parameter line open Open file dialog, where user can select picture file
2. Load file parameter: This parameter specify colorness and depth of the loaded image.CV_LOAD_IMAGE_UNCHANGED load image in same depth and colorness as loaded file.The colorness specifies whether the loaded image is to be converted to 3 channels (CV_LOAD_IMAGE_COLOR), 1 channel (CV_LOAD_IMAGE_GRAYSCALE), or left as it was in the input file (CV_LOAD_IMAGE_ANYCOLOR). Depth specifies whether the loaded image is to be converted to 8 bits per pixel per color channel as was customary in previous versions of OpenCV or left as they were in the input file. If CV_LOAD_IMAGE_ANYDEPTH is passed the pixel format can be 8 bit unsigned, 16 bit unsigned, 32 bit signed or 32 bit floating point.
3. Load as picture. This parameter sets in which picture number file will be loaded.It can be select Picture_0 to Picture_19. This picture number will be use for work with image in test program.
4. Get undistortion chan: If you want to used real word units for get object parameter select undistortion channel for real world unit calculation. If some channel is selected set Size coeficient in the next option. If option None will be set on this option object parameters can be only in pixels unit.
5. Size coefficient: Write size coefficient which will be used for real world unit calculation in object parameters.
   How to find size coeficient:
   - Find object dimmension in pixels
   - Measure real object dimension in real world unit (for example mm)
   - Calculate Size coeficient: Object dimension in pixels / real object dimension

## Error codes

1. Error code -11:File not exist. This error means that file in path selected in first parameter not exist. Check file name and file path.
2. Error code -12:Bad file parameter.This error means error in second parameter. Check test program file if second parameter is select correctlly.
3. Error code -13:Bad picture position number. This error means error in 3.command parameter. Check test program file if 3.parameter is select correctlly
4. Error code -14:Bad undistortion channel was selected (Not from range 0 to 19)
5. Error code -100:OpenCV error: This error is error inside OpenCv function cvLoadImage. Error decription is display in result window.