Atalasoft MobileImage API Reference
|
An Image object contains an image and associated data. More...
#import <kfxKEDImage.h>
Instance Methods | |
(int) | - imageWriteToFile |
Write the image contained in the UIImage to the file path specified in the object. More... | |
(int) | - imageWriteToFile: |
Write the image contained in the UIImage to the file path specified in the object with file restriction. More... | |
(int) | - imageWriteToFileBuffer |
Write the UIImage object in this kfxKEDImage object to file buffer. More... | |
(int) | - imageWriteToFileBuffer: |
Write the UIImage object in this kfxKEDImage object to file buffer in ANSI X9 tiff format. More... | |
(long) | - getImageSize |
Get the current image size. More... | |
(int) | - imageReadFromFile |
Initialize the imageBitmap property with the image contained in a file. More... | |
(int) | - imageReadFromFileBuffer |
Read an image from the file buffer into the UIImage imageBitmap property. More... | |
(int) | - deleteFile |
Delete the file specified in the file path contained in this object. More... | |
(int) | - specifyImageBitmap: |
Specify a bitmap image for this object. More... | |
(UIImage *) | - getImageBitmap |
Get the current bitmap image. More... | |
(int) | - clearImageBitmap |
Clear the bitmap image. More... | |
(int) | - clearFileBuffer |
Clear the buffered file image. More... | |
(const char *) | - getImageFileBuffer |
Get a reference to the image file buffer. More... | |
(bool) | - isValidDateTime |
Check date time string validity. More... | |
(int) | - specifyImageCreateDateAndtime: |
Specify an image create date and time string. More... | |
(int) | - specifyFilePath: |
Specify a file path for use with the object. More... | |
(NSString *) | - getFilePath |
Get the current file path. More... | |
(NSString *) | - getImageSourceID |
Get the image ID of the input source image. More... | |
(NSString *) | - getImageID |
Get the image ID of the image. More... | |
(NSString *) | - getImageMetaData |
Get the image metadata string. More... | |
(float) | - getImageGPSLat |
Get the GPS latitude associated with this image. More... | |
(float) | - getImageGPSLon |
Get the GPS longitude associated with this image. More... | |
(float) | - getAttitudePitch |
Get the pitch attitude of the camera when the picture was taken. More... | |
(float) | - getAttitudeRoll |
Get the roll attitude of the camera when the picture was taken. More... | |
(kfxKEDQuickAnalysisFeedback *) | - getImageQuickAnalysisFeedback |
Get the quick analysis feedback object from the last quick analysis. More... | |
(kfxKEDBasicSettingsProfile *) | - DEPRECATED_ATTRIBUTE |
Get the basic settings profile used in the last image processing operation. More... | |
(kfxKEDImagePerfectionProfile *) | - DEPRECATED_ATTRIBUTE |
Get the image perfection profile used in the last image processing operation. More... | |
(id) | - init |
Initialize an object allocated for use. More... | |
(id) | - initWithImage: |
Initialize an allocated object with a specific image. More... | |
Class Methods | |
(NSString *) | + simpleDateTimeString: |
Format a simple date/time string. More... | |
(NSDate *) | + dateFromSimpleDateString: |
Initialize a date object from a date string. More... | |
(NSString *) | + ISO8601DateTime |
Generate a compliant date-time string for use in this object. More... | |
(NSString *) | + decodeImageRep: |
Generate a string from the current image representation setting. More... | |
(NSString *) | + decodeMimetype: |
Generate a string from the current image mimetype setting. More... | |
(NSString *) | + decodeFileColor: |
Generate a string from the current output color setting. More... | |
Properties | |
NSString * | imageID |
Uniquely identifies this image using a unique ID. More... | |
NSString * | imageSourceID |
Identifies the source image used to generate this image. More... | |
NSString * | imageMetaData |
Image metadata created by the image processing process. More... | |
NSString * | imageMicrData |
MICR data extracted from the image metadata. More... | |
float | imageGPSLat |
Global latitude of the location where the original photo was taken. More... | |
float | imageGPSLon |
Global longitude of the location where the original photo was taken. More... | |
kfxKEDBasicSettingsProfile *basicSettingsProfileUsed | DEPRECATED_ATTRIBUTE |
Basic settings profile used for image processing. More... | |
kfxKEDImagePerfectionProfile *imagePerfectionProfileUsed | DEPRECATED_ATTRIBUTE |
Image perfection profile used to specify detailed image processing options. More... | |
KEDImageRepresentation | imageRepresentation |
Defines how the image is represented in this object. More... | |
KEDFileRepresentation | fileRepresentation |
Defines how the file is represented. More... | |
int | imageFileBufferSize |
Defines how large the file buffer is in bytes. More... | |
kfxKEDQuickAnalysisFeedback * | imageQuickAnalysisFeedback |
Image Quick Analysis feedback stores quick analysis results. More... | |
int | imageHeight |
Image Height in pixels for the image bitmap. More... | |
int | imageWidth |
Image Width in pixels for the image bitmap. More... | |
float | attitudePitch |
Image Attitude for the pitch when the image was taken. More... | |
float | attitudeRoll |
Image Attitude for the roll when the image was taken. More... | |
NSString * | imageTag |
App defined tag name to associate with this image. More... | |
int | imageDPI |
Image Dots per Inch. More... | |
int | jpegQuality |
jpeg Quality setting More... | |
KEDOutputColor | imageFileOutputColor |
Image File Output Color. More... | |
NSString * | imageCreateDateTime |
Object creation date-time string. More... | |
KEDImageMimeType | imageMimeType |
Indicates the file storage configuration. More... | |
bool | isPositionValid |
Boolean to indicate if the GPS data is valid. More... | |
NSMutableArray * | imageBarCodes |
Array of image barcodes found by processing. More... | |
NSMutableArray *classificationResults | DEPRECATED_ATTRIBUTE |
Image classification results. More... | |
bool | isAttitudeValid |
Boolean to indicate if the attitude is valid. More... | |
CGRect | targetFrame |
Target frame used for taking a picture. More... | |
An Image object contains an image and associated data.
Framework: libKfxEngines
Import suggestion: #import <kfxLibEngines/kfxEngines.h>
An instance of this class represents either an input Image object or an output Image object. An input Image object is normally created by the Image Capture control. The library initializes the input Image object with the attitude delta from the desired orientation, and the GPS data representing the location of the camera when the image was acquired. The input Image object can then be supplied to the image processor to perfect the image using image perfection controls.
The image processor generates an output Image object and it sets other appropriate properties to indicate the results of the image processing. These include the image metadata, the native UIImage Bitmap, the imageRepresentation, imageSourceID, profile used, imageGPSLat, and imageGPSLon, and the image height and width of the newly processed image.
An instance of this class contains an image representation stored in memory, in a file or both. The class includes everything related to this image, including captured image data and metadata associated with an image after it has been processed. It includes reference information for using an Image object with image processing or image capture completes.
The input Image object is also updated appropriately when you call imageReadFromFile. The input Image object is also modified by the doQuickAnalysis operation in the image processor. Quick analysis informs you of conditions such as a blurry, over saturated or undersaturated image. Quick analysis also provides information and a reference image for the boundary of the document in the original picture. The Quick analysis results can then be used for a subsequent image processing operation to crop and deskew the document found in the image, reducing the size of the image and compensating for and removing distortions caused by the camera angle.
The Image object also includes bar code data found in an image as a result of using the barcode capture control. The output image may include one or more barcode results, and one barcode object indicates the type of barcode found, the data from the barcode, and the direction in which it was found.
If both an ImagePerfectionProfile and a BasicSettingsProfile are set in the Image Processor object, the ImagePerfectionProfile takes precedence, while ignoring the basic settings. Therefore, only one of the profiles used properties will be set after an image is processed.
You can set a file path or a bitmap image directly, using unique methods that return error codes for exceptions. The write and read image methods also return errors. Be sure to test all return error codes to be aware of invalid sequences or invalid settings for this object. You can also convert the bitmap to a buffered file, which is normally significantly smaller than the raw bitmap. Once the buffer is created, you can delete the bitmap, and the image representation would be a FILE image representation, and stored as a FILE_STORED file representation. An image can be either stored as a buffered image or written to a file, but not both. If the image representation is specified as FILE or BOTH, then the file representation will be either FILE_STORED or FILE_BUFFERED.
Licensing**
This is a license protected class. Certain methods in this object are protected by a license mechanism. If you attempt to use these methods without setting the license, then you will receive the KMC_IP_LICENSE_INVALID error code. Refer to the method descriptions to determine what methods are license protected. In order to set your license, you need to use the setMobileSDKLicense method on the kfxKUTLicensing object. Example code is provided to show you how to set your license, which can be found in the kfxKUTLicensing class of the kfxUtilities framework.
Serialization**
This class adopts the NSCoding protocol so that this object may be archived and unarchived using the iOS standard [NSKeyedArchiver archiveRootObject:<object> toFile: archiveFileName]; approach. Using keyed archive files, you can save this object for later use. The framework supports backward compatibility, such that as a new version of an app that uses the API in this SDK, includes a newer versions of the SDK libraries that have data model changes, the older archive can still be read by the newer version. However, it is not a design goal to archive and dearchive with forward compatibility, such as decoding an archive on a newer version of the class, using an older library. Archival of this object includes the version of the parent library that is associated with the class. Each archive includes the name of the class as well so that unarchiving can detect errors with improper use, while maintaining backward compatibility.
You can create keyed archives using NSKeyedArchiver objects and decoded by NSKeyedUnarchiver objects. The framework design uses keyed archives, which differ from sequential archives, in that every value encoded in a keyed archive is given a Kofax unique key name. When you decode an archive, the underlying implementation can use values by name, allowing the unarchive delegate to request values in any order or not at all.
Please refer to the Developers Guide using the link in the welcome page under the appropriate development environment (iOS or Android), under the "Docs" folder. Use the Welcome.htm file and the Developers guide link to display the guide, and search for the Serialization and Deserialization topic.
Please refer to the Apple documentation for more information: https://developer.apple.com/library/ios/documentation/cocoa/reference/foundation/Classes/NSCoder_Class/Reference/NSCoder.html
Keyed Archiving** https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSKeyedArchiver_Class/Reference/Reference.html#//apple_ref/occ/cl/NSKeyedArchiver
Archiving an object*
The keyed archiver process in iOS (NSKeyedArchiver) uses the encodeWithCoder delegate method to save this object as a keyed archive for later use. The app developer may use the companion NSKeyedUnarchiver method to restore the object of this type.
Keyed Unarchiving** https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSKeyedUnarchiver_Class/Reference/Reference.html#//apple_ref/occ/instm/NSKeyedUnarchiver
Unarchiving an object*
The keyed unarchiver process in iOS (NSKeyedUnarchiver) uses the initWithCoder delegate method to instantiate the class from a previously saved context created by the NSKeyedArchiver method. The unarchive process can return four exceptions. See below for example unarchive sequence. Therefore, you need to wrap your unarchiver code with a try catch block to handle these conditions:
UnarchiveSuperInitNil | Thrown when the super init for this class returned nil. The state of the object is unknown. |
UnarchiveInsufficientMemory | Thrown when the buffered file image cannot be restored into a buffer because of insufficient memory. |
UnarchiveIllegalClassNameAssociation | Thrown when the archive file used for decoding refers to an unexpected class. |
UnarchiveIllegalClassVersion | Thrown if the version that encoded the archive cannot be unarchived with this version of the library. // Example of deserialization for only this object as the root object. kfxKEDImage * myImageRestored; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString* documentsDirectory = [paths objectAtIndex:0]; NSString * archiveFileName = [documentsDirectory stringByAppendingPathComponent:@"SerialKEDImage.ar"]; @try{ myImageRestored = [NSKeyedUnarchiver unarchiveObjectWithFile:archiveFileName]; }@catch (NSException *anException) { NSString * strException = [NSString stringWithFormat:@"Unarchive Exception: %@",anException.name]; UIAlertView* alert = [[UIAlertView alloc] initWithTitle:strException message: anException.reason delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; } |
- (int) clearFileBuffer |
Clear the buffered file image.
Use this method to clear the buffered file image created by the imageWriteToFileBuffer method. If the current state of the image representation is IMAGE_REP_FILE, then the state changes to unknown (INIT) state. If the image representation is BOTH, then the state changes to IMAGE_REP_BITMAP. This command is only valid in the IMAGE_REP_FILE or IMAGE_REP_BOTH, if the file representation is FILE_BUFFERED.
- (int) clearImageBitmap |
Clear the bitmap image.
Rather than set the bitmap image to nil, you should use this method so that the library can detect errors and to set the image representation value upon normal completion so that it is correct after the image is cleared. The memory associated with the bitmap in this object is deallocated for you.
This method changes the following properties upon successful completion:
+ (NSDate*) dateFromSimpleDateString: | (NSString *) | s |
Initialize a date object from a date string.
Use this method to initialize a date object given a date string in the format MMM DD, YYYY. The time portion of the NSDate object will not be set.
+ (NSString *) decodeFileColor: | (KEDOutputColor) | color |
Generate a string from the current output color setting.
Use this method to generate a string that represents the current setting in the imageFileOutputColor property. This is useful for debugging when you want to display the contents of the kfxKEDImage object.
+ (NSString *) decodeImageRep: | (KEDImageRepresentation) | option |
Generate a string from the current image representation setting.
Use this method to generate a string that represents the current setting in the image representation property. This is useful for debugging when you want to display the contents of the kfxKEDImage object.
+ (NSString *) decodeMimetype: | (KEDImageMimeType) | option |
Generate a string from the current image mimetype setting.
Use this method to generate a string that represents the current setting in the image mimetype property. This is useful for debugging when you want to display the contents of the kfxKEDImage object.
- (int) deleteFile |
Delete the file specified in the file path contained in this object.
Use this method to manage files associated with Image objects. This method deletes the file associated with the Image object by using the file path contained in this object. It sets the imageRepresentation depending on the imageBitmap property. It returns errors for invalid sequences and missing file path, or non-existent file. It also clears the file path specified in the image after deleting the file.
The deleteFile method sets the following kfxKEDImage object properties after successful completion:
- (kfxKEDBasicSettingsProfile *) DEPRECATED_ATTRIBUTE |
Get the basic settings profile used in the last image processing operation.
Use this method to retrieve the basic settings profile used in image processing if you specified using the basic settings profile. It is set to nil, if the image processing was performed using the image perfection profile. This property is set by the image processor when the processImage method completed without error.
- (kfxKEDImagePerfectionProfile *) DEPRECATED_ATTRIBUTE |
Get the image perfection profile used in the last image processing operation.
Use this method to retrieve the perfection profile used in image processing if you specified using it with image processing. It is set to nil if the image processing was performed using a basic settings profile. This property is set by the image processor when the processImage method completed without error. If you specified both a basic settings profile and an image perfection profile, the latter profile is used.
- (float) getAttitudePitch |
Get the pitch attitude of the camera when the picture was taken.
Use this method to retrieve the pitch of the camera offset from the desired orientation in degrees. This property is set by the image capture control when taking a picture.
- (float) getAttitudeRoll |
Get the roll attitude of the camera when the picture was taken.
Use this method to retrieve the roll of the camera offset from the desired orientation in degrees. This property is set by the image capture control when taking a picture.
- (NSString *) getFilePath |
Get the current file path.
Use this method to retrieve the current file path associated with this object. In some cases, the file name may not have been set if the specifyFilePath method returned an error.
- (UIImage*) getImageBitmap |
Get the current bitmap image.
Use this method to get the UIImage object currently associated with this object.
- (const char *) getImageFileBuffer |
Get a reference to the image file buffer.
Use this method to get a pointer to the image file buffer created by the imageWriteToFileBuffer method. Until the buffer is created, this pointer is null. You can access this data in order to inspect the file buffer contents, base64 encode it for submitting to some web service or other read process. As a readonly property, you cannot modify the image.
Default: 0
- (float) getImageGPSLat |
Get the GPS latitude associated with this image.
Use this method to retrieve the GPS location where the original picture was taken.
This property is set by the image capture control when taking a picture.
- (float) getImageGPSLon |
Get the GPS longitude associated with this image.
Use this method to retrieve the GPS location where the original picture was taken.
This property is set by the image capture control when taking a picture.
- (NSString*) getImageID |
Get the image ID of the image.
Use this method to retrieve the Image ID of this original image. It is created when the kfxKEDImage class is instantiated.
- (NSString*) getImageMetaData |
Get the image metadata string.
Use this method to retrieve the metadata from image processing. The image metadata is set by the image processor when an output kfxKEDImage is created by image processing to associate the output image with the processing metadata. This field is also populated by doQuickAnalysis of the image processor in the input image, so that the input image holds the quick analysis results.
- (kfxKEDQuickAnalysisFeedback *) getImageQuickAnalysisFeedback |
Get the quick analysis feedback object from the last quick analysis.
Use this method to retrieve the quick analysis feedback object stored in the input image. The object contains the analysis results. This property is set by the image processor when the doQuickAnalysis completed without error.
- (long) getImageSize |
Get the current image size.
Use this method to get the size of the image associated with this object.
Image Representation: IMAGE_REP_BITMAP - Calculated size for image width and image height IMAGE_REP_BOTH - Calculated size for image width and image height IMAGE_REP_FILE - Size of the file or buffer containing the image
- (NSString*) getImageSourceID |
Get the image ID of the input source image.
Use this method to retrieve the Image ID for the original image. The imageSourceID property is set by the image processor to the image ID of the input kfxKEDImage object. You can use this to help associate an output processed image with the input image given to the image processor.
- (int) imageReadFromFile |
Initialize the imageBitmap property with the image contained in a file.
Use this method to read an image contained in a file into the imageBitmap property. Be sure to release a previously used UIImage to prevent a memory leak, using the clearImageBitmap method. The file path specified in the object specifies where to get the image. The library sets the imageMimetype, based on the type of image read. The library ignores the file extension to determine the type of image read. It sets the bit depth of the image read into this Image object. The library sets the mimetype based on what is found in the image. However, the file path extension should match the actual image mimetype. This method returns errors for invalid sequences, missing file path, actual file missing in the file system, a bitmap already loaded, etc.
This method sets the following kfxKEDImage properties if the image was read from the file without error:
KMC_ED_FILEPATH, for missing file path for the image to read
- (int) imageReadFromFileBuffer |
Read an image from the file buffer into the UIImage imageBitmap property.
Use this method to add a UIImage object to this kfxKEDImage from a previously set buffered file image.
This method is only valid when the Image object is represented by an image representation of IMAGE_REP_FILE and the file representation of FILE_BUFFERED. After the image read completes without error, the library changes the image representation to IMAGE_REP_BOTH, and the file representation stays as FILE_BUFFERED. The image now has both the UIImage bitmap and the buffer that contains the bytes of data that would represent what would be written to a file of that mimetype.
License Required: this is a licensed method. You cannot use this method until you have set a valid SDK license. In order to set your license, you need to use the setMobileSDKLicense method on the kfxKUTLicensing object. You must obtain a valid license from Kofax in order to use licensed methods. An example of setting your license can be found in the licensing class.
- (int) imageWriteToFile |
Write the image contained in the UIImage to the file path specified in the object.
Use this method to write the image contained in the UIImage object to the file path specified in the object, in the storage format specified in the mimetype. This method writes the bitmap in the imageBitmap of the object to a file using the specified mimetype to store the image as a TIFF, JPG or PNG file. The file path extension should match the mimetype. The method returns errors for invalid sequences, mismatched mime types, missing file path, etc.
The following properties should be set before calling the write method:
The imageRepresentation to indicate the object is represented by both the file name and the bitmap image.
The imageWriteToFile and imageWriteToFileBuffer methods ("the imageWrite methods") store three EXIF (Exchangeable Image File ) tags for date and time into the output image file or buffer metadata (JPEG and TIFF only):
If the imageReadFromFile method has been used with this Image object, the imageWrite methods write any JPEG or TIFF date and time stamps from the read image file "as is" into the output file or buffer metadata.
Otherwise, the imageWrite methods write internally generated EXIF metadata into the new JPEG or TIFF file or buffer as follows (all times adjusted to GMT):
The EXIF tag DateTime is generated based on the date and time the image object was created.
EXIF tags DateTimeOriginal and DateTimeDigitized are normally generated the same way as the EXIF tag DateTime, but there is a difference when the given image was created as a result of image processing. In such cases, the imageWrite methods generate the DateTimeOriginal value based on the date/time of the image that was input to image processing. The input image date/time is normally the date/time that image object was created, but could also be derived from JPEG or TIFF image file metadata if the imageReadFromFile method was used with that image object.
The date/time strings are formatted as yyyy:MM:dd HH:mm:ss, as required by the EXIF standard. This format does not accommodate time zones, so the the imageWrite methods use the UTC time that the Image object was created, with the time shifted to compensate for the time zone offset.
However, when the imageReadFromFile method has been used with the Image object, the JPEG or TIFF date/time stamp from the original image file metadata is carried "as is" into the output compressed data stream.
Note: Date/time metadata output is supported only with the default Image Processor File I/O Engine.
License Required: this is a licensed method. You cannot use this method until you have set a valid SDK license. In order to set your license, you need to use the setMobileSDKLicense method on the kfxKUTLicensing object. You must obtain a valid license from Kofax in order to use licensed methods. An example of setting your license can be found in the licensing class.
- (int) imageWriteToFile: | (FILE_RESTRICTION) | restriction |
Write the image contained in the UIImage to the file path specified in the object with file restriction.
Use this method to write the image contained in the UIImage object to the file path specified in the object, in the storage format specified in the mimetype. This method writes the bitmap in the imageBitmap of the object to a file using the specified mimetype to store the image with restriction such as a ANSI X9 TIFF. The file path extension should match the mimetype. The method returns errors for invalid sequences, mismatched mime types, missing file path, etc.
The following properties should be set before calling the write method:
License Required: this is a licensed method. You cannot use this method until you have set a valid SDK license. In order to set your license, you need to use the setMobileSDKLicense method on the kfxKUTLicensing object. You must obtain a valid license from Kofax in order to use licensed methods. An example of setting your license can be found in the licensing class.
- (int) imageWriteToFileBuffer |
Write the UIImage object in this kfxKEDImage object to file buffer.
Use this method to write the image contained in the UIImage object to a buffer included in this object. The buffer resembles the content of an image file, and the buffer is written in the storage format specified by the mimetype property. This method writes the bitmap in the imageBitmap of the object to the buffer using the specified mimetype to store the image as a TIFF, JPG or PNG file buffer representation.
The method returns errors for invalid sequences, illegal mime types, invalid DPI, etc.
The following properties should be set before calling the imageWriteToFileBuffer method:
Also, other image processing detected errors for file write.
The imageWriteToFile and imageWriteToFileBuffer methods ("the imageWrite methods") store three EXIF (Exchangeable Image File ) tags for date and time into the output image file or buffer metadata (JPEG and TIFF only):
If the imageReadFromFile method has been used with this Image object, the imageWrite methods write any JPEG or TIFF date and time stamps from the read image file "as is" into the output file or buffer metadata.
Otherwise, the imageWrite methods write internally generated EXIF metadata into the new JPEG or TIFF file or buffer as follows (all times adjusted to GMT):
The EXIF tag DateTime is generated based on the date and time the image object was created.
EXIF tags DateTimeOriginal and DateTimeDigitized are normally generated the same way as the EXIF tag DateTime, but there is a difference when the given image was created as a result of image processing. In such cases, the imageWrite methods generate the DateTimeOriginal value based on the date/time of the image that was input to image processing. The input image date/time is normally the date/time that image object was created, but could also be derived from JPEG or TIFF image file metadata if the imageReadFromFile method was used with that image object.
The date/time strings are formatted as yyyy:MM:dd HH:mm:ss, as required by the EXIF standard. This format does not accommodate time zones, so the the imageWrite methods use the UTC time that the Image object was created, with the time shifted to compensate for the time zone offset.
However, when the imageReadFromFile method has been used with the Image object, the JPEG or TIFF date/time stamp from the original image file metadata is carried "as is" into the output compressed data stream.
Note: Date/time metadata output is supported only with the default Image Processor File I/O Engine.
License Required: this is a licensed method. You cannot use this method until you have set a valid SDK license. In order to set your license, you need to use the setMobileSDKLicense method on the kfxKUTLicensing object. You must obtain a valid license from Kofax in order to use licensed methods. An example of setting your license can be found in the licensing class.
- (int) imageWriteToFileBuffer: | (FILE_RESTRICTION) | restriction |
Write the UIImage object in this kfxKEDImage object to file buffer in ANSI X9 tiff format.
Use this method to write the image contained in the UIImage object to a buffer included in this object. The buffer resembles the content of an image file, and the buffer is written in the storage format specified by the mimetype property. This method writes the bitmap in the imageBitmap of the object to the buffer using the specified mimetype to store the image as a TIFF, JPG or PNG file buffer representation.
The method returns errors for invalid sequences, illegal mime types, invalid DPI, etc.
The following properties should be set before calling the imageWriteToFileBuffer method:
Note: Date/time metadata output is supported only with the default Image Processor File I/O Engine.
License Required: this is a licensed method. You cannot use this method until you have set a valid SDK license. In order to set your license, you need to use the setMobileSDKLicense method on the kfxKUTLicensing object. You must obtain a valid license from Kofax in order to use licensed methods. An example of setting your license can be found in the licensing class.
- (id) init |
Initialize an object allocated for use.
Use this method to initialize an allocated object. It sets all the default settings for the object and prepares it for use.
- (id) initWithImage: | (UIImage *) | image |
Initialize an allocated object with a specific image.
Use this method to initialize an allocated object with an input image. It sets all the default settings for the object and prepares it for use.
+ (NSString*) ISO8601DateTime |
Generate a compliant date-time string for use in this object.
Use this method to generate a string appropriate for setting into the imageCreateDateTime property. When an instance of this class is created, the library initializes the imageCreateDateTime for you. If you need to change it to a different date and time, you can use this method to create a new string.
- (bool) isValidDateTime |
Check date time string validity.
Use the isValidDate method after you set the date string to ensure that it is valid. Once it is marked as invalid then the Image object cannot be used with other methods.
+ (NSString*) simpleDateTimeString: | (NSDate *) | date |
Format a simple date/time string.
Use this method to format a date and time in a simple, short format, such as mm/dd/yy, hh:mm.
- (int) specifyFilePath: | (NSString *) | fullFilePath |
Specify a file path for use with the object.
Use this method to associate the Image object with a file in the file system, assuming the file exists. If the previous representation was unknown, and the file path points to an existing file by name, then the Image object is represented by this file name, and the image representation is set to File. If the file does not exist, then you may follow this, for example, with a set bitmap, and then imageWriteToFile, in order to write it to a file. This specifyFilePath method returns errors when the call violates the contract of this object with your application. For instance, if the image representation already indicates IMAGE_REP_BOTH, then you cannot set a new file path to a non-existent file. In some cases, the file name will not be set if the specifyFilePath method returns an error.
Valid file path extensions are: jpg, jpeg, tif, tiff, png and upper-case equivalents.
If the file name extension is valid, then the library sets up the imageMimetype setting for you.
- (int) specifyImageBitmap: | (UIImage *) | image |
Specify a bitmap image for this object.
Use this method to specify the image you want this object to represent. Because the image bitmap is not accessible via standard set or get methods, use this method so that the library can return errors for invalid sequences. If you have already specified an image, then the memory is deallocated, and the library sets the new image for later use.
Note on image orientation: When you specify a bitmap, the libraries need to use kfxKEDImage objects throughout the system with iOS image orientation 0, so that all images are rendered the same as the bitmap representation. Therefore, this method will rotate the image as needed to set the image orientation to 0, whereby you can render the new image in the kfxKEDImage object and it will look the same as the original, when rendered on a Mac or on an iOS device. However, the new image stored in the kfxKEDImage object is different than the original. Therefore, you should use the method getImageBitmap to obtain the new UIImage. This provision guarantees that auto-orientation and image rotation will always be rendered correctly by a UIView controller.
When this method completes successfully, the method changes the following properties:
- (int) specifyImageCreateDateAndtime: | (NSString *) | dateString |
Specify an image create date and time string.
Use this method to set an ISO 8601 compliant date time string property and return an error code if the string is invalid. The library verifies that it complies with the standard, and then sets the string property only if it is valid, and returns an error code if not valid. You can use a class method to generate one based on the current date and time.
Note that the standard setting for this property also verifies that it is correct, and does not set the value if it is invalid. Therefore you can use the isValidDateTime afterwards to determine if the string is valid.
|
readatomicassign |
Image Attitude for the pitch when the image was taken.
These two pitch and roll properties are used to store the attitude of the camera at the time the image was taken by the device's camera. They are only valid when the image was taken with the Custom ImageCapture UI object. Pitch is the camera pitch in degrees, and roll is the roll in degrees. The library converts to degrees from the native values. The roll and pitch values are always between 0-90 degrees positive or negative. Horizontal pitch is 0 when level, and 90 degrees when vertical. After you increase pitch beyond straight up, the pitch starts to decrease back to 0. Horizontal roll is set to 0 when level, and increases positive as you roll right, and negative as you roll left.
This value is not retained after the image is written to a file, and then later read back in from a file. It is provided for reference purposes after an image was obtained from the Image Capture screen.
Note: These values are the delta from the declination setting that specifies what constitutes a level surface for taking pictures.
Default: 0.0
|
readatomicassign |
Image Attitude for the roll when the image was taken.
The attitude roll property is used with pitch to indicate the attitude of the camera at the time the image was taken by the device's camera. It is only valid when the image was taken with the Custom ImageCapture UI object. Pitch is the camera pitch in degrees, and roll is the roll value in degrees. The library converts to degrees from the native value. The roll and pitch values are always between 0-90 degrees positive or negative. Horizontal pitch is 0 when level, and 90 degrees when vertical. After you increase pitch beyond straight up, the pitch starts to decrease back to 0. Horizontal roll is set to 0 when level, and increases positive as you roll right, and negative as you roll left.
This value is not retained after the image is written to a file, and then later read back in from a file. It is provided for reference purposes after an image was obtained from the Image Capture screen.
Note: These values are the delta from the declination setting that specifies what constitutes a level surface for taking pictures.
Default: 0.0
|
readatomicassign |
Basic settings profile used for image processing.
An instance of this class contains the simple image processing options that the image processor used to produce this image. It is set by the image processing engine in the output image it produces. The profile defines the standard crop, deskew, desired rotation and other options. Deskew option applies to image with skew angle less or equal to 15 degrees.
Default: nil
|
readatomicassign |
Image perfection profile used to specify detailed image processing options.
An instance of this class contains the advanced image processing options that the image processor used to produce this image. It is set by the image processing engine in the output image it produces. These settings are a superset of what is possible with basic settings profiles.
Default: nil
|
readwritenonatomicretain |
Image classification results.
This array holds one or more image classification results after this Image object is classified by the classifier library. The classification results array is ordered such that the most probable classification is the highest rank, indicating the most probable image match from the model.
Default: an empty array ready for use.
|
readatomicassign |
Defines how the file is represented.
When the image representation is IMAGE_REP_FILE or IMAGE_REP_BOTH, this enumeration defines how the file image is stored, either as a buffered image or a stored as a file.
This is a readonly property.
Default: FILE_REP_UNKNOWN
|
readwritenonatomicretain |
Array of image barcodes found by processing.
The barcode UI control returns barcode information when the barcode is detected. This array is also used by the barcode engine where multiple barcodes may be found. The library adds a kfxKEDBarcodeResult object for each barcode found.
Default: an empty array ready for use.
|
readwriteatomicstrong |
Object creation date-time string.
The library generates this date and time string when the object is instantiated, not necessarily when it is written to a file or read from a file. The date format is ISO 8601. You can change it later on, if you desire. A typical example date time string is: 2013-08-12T17:07:18-0700.
If you set your own date, the library validates your setting. If it is not valid, then the date string is not stored, and the old setting remains. You must then set a valid date for the object to be used with other methods. Use the method isValidDate to check to see if the date you tried to set is valid. If it is not valid, then the library generates an error for several API methods, so that the object validity is maintained. You can use the class method ISO8601DateTime to create a valid string.
Default: today's date and time when the object is created.
|
readwriteatomicassign |
Image Dots per Inch.
This property indicates the image resolution as determined by the image processor. It is valid only after the Image object is created by some image creation or image processing task. When the image is read from a file, the library updates this to the actual image DPI.
If you initialize the object using the initWithImage or call specifyImageBitmap, the library sets the DPI to 72 by default. You can change the default DPI before writing if needed.
Default: 0
|
readatomicassign |
Defines how large the file buffer is in bytes.
When the file representation is FILE_BUFFERED, then this property indicates how big the buffer is in bytes.
This is a readonly property.
|
readwriteatomicassign |
Image File Output Color.
This property indicates the bit depth of the image to be written to a file by the writeImageToFile. The valid settings are 1=bitonal, 8=grayscale, 24=color. The library checks for valid settings When you call the writeImageToFile method. When the image is read from a file, the library updates this with the actual color setting of the image in the file.
Default: KED_BITDEPTH_COLOR
|
readatomicassign |
Global latitude of the location where the original photo was taken.
This float value contains the latitude where the photo was taken. The library initializes this global position data from the original input image taken by the device's camera. The latitude and longitude values return the global position such as these follows:
Latitude: 33.670502
Longitude: -117.762001
For Kofax, Irvine.
Default: 0.0
|
readatomicassign |
Global longitude of the location where the original photo was taken.
This float value contains the longitude where the photo was taken. The library initializes this global position data from the original input image taken by the device's camera. The latitude and longitude values return the global position such as these follows:
Latitude: 33.670502
Longitude: -117.762001
For Kofax, Irvine.
Default: 0.0
|
readwriteatomicassign |
Image Height in pixels for the image bitmap.
The library sets this property when an image is read from a file, or when you specify an image bitmap.
When this object is output by image processing, this represents the height of the processed image.
You cannot modify the height and width and expect that an imageFileWrite will change the image to these height and width values. Instead, they are provided for reference purposes only.
Default: 0
|
readatomicassign |
Uniquely identifies this image using a unique ID.
If this object is for an output image that is a processed version of the original input image, then the library copies this imageID to the imageSourceID so that you can associate the original image with the processed image. This ID is generated by the library when the object is created, and remains true for the life of that object.
Default: A unique UUID string
|
readatomicassign |
Image metadata created by the image processing process.
This metadata is formatted so that it can be both readable, and formatted for JSON parsing if needed. The image processing process generates this string while the image is being processed. It includes tetragon corner data, bar code data. It also indicates if the image is blurry, over or under-saturated, and includes other information about the results of the operations specified. It is output by the image processing engine after an image is processed. This is a readonly property. Use the following code snippet example to read the metadata.
Default: nil
|
readwritenonatomicstrong |
MICR data extracted from the image metadata.
When MICR reading is requested during image processing, the detected MICR string is stored in this property. When no MICR string is detected or present, this property is set to nil.
Default: nil
|
readwriteatomicassign |
Indicates the file storage configuration.
This indicates the file format of the image File Path (that you specify with the specifyFilePath method) when it contains a valid path, and the imageRepresentation indicates the File stored. The library verifies this setting when you call the write method. If the mimetype does not match the file extension, then it returns an error for a mismatch mimetype.
The library sets this property for you if you use the specifyFilePath method and use a standard file extension recognized by the library.
Default: MIMETYPE_UNKNOWN
|
readatomicassign |
Image Quick Analysis feedback stores quick analysis results.
An instance of this class contains all the data that results from a quick analysis of an image. The Image Processing (IP) Engine takes an unknown raw input image and produces metadata. The IP Engine parses the metadata, and populates this object with what it finds. The library generates a quick analysis feedback object and saves it in the input Image object to make it available for subsequent image processing. The feedback object also includes a reference UIImage that includes a superimposed green border around what the library determines to be the document edges. These edges may not be straight but curved edges attributed to the original not being flat on the surface used to take the picture. The edge curve data is stored in the image metadata.
Default: nil
|
readatomicassign |
Defines how the image is represented in this object.
An image may be in memory, in a file or both. The library sets this appropriately when the object is created, and when it is saved to a file. Therefore, it indicates the ways in which the image data is represented in this object. The imageMimeType property defines the file storage type. The library takes care of setting this property based on normal sequences such as setting a file name, clearing a bitmap image, reading an image from a file and so on. When the image is read from a file, the library sets this to IMAGE_REP_BITMAP.
This is a readonly property. Use the following approach to read the current setting.
Default: IMAGE_REP_NONE
|
readatomicassign |
Identifies the source image used to generate this image.
The image processing engine sets this value after image processing using an input Image object. The IP engine sets the imageSourceID to the imageID of the input Image object, so that you can associate the original image with the processed image.
Default: nil
|
readwriteatomicretain |
App defined tag name to associate with this image.
Use this string to specify the current definition of this image, such as "Raw", "Processed", or "Image Ready", or whatever you want. Use it for your own management purposes.
Default: nil
|
readwriteatomicassign |
Image Width in pixels for the image bitmap.
The library sets this property when an image is read from a file, or when you specify an image bitmap.
When this object is output by image processing, this represents the width of the processed image.
You cannot modify the width and expect that an imageFileWrite will change the image to these height and width values. Instead, they are provided for reference purposes only.
Default: 0
|
readwriteatomic |
Boolean to indicate if the attitude is valid.
These two pitch and roll properties are initialized to 0, and this bool is false to indicate that the values are not valid. They become valid when the internal library sets valid values.
Default: false
|
readwriteatomic |
Boolean to indicate if the GPS data is valid.
The two latitude and longitude properties are initialized to 0, and this bool is false to indicate that the values are not valid. They become valid when the internal library sets valid values.
Default: false
|
readwriteatomicassign |
jpeg Quality setting
This property indicates the desired level of quality for writing a JPEG image using writeImageToFile, and must be set to a range between 1 to 100. The higher the number the less compression is used, the higher the quality and the larger the output file size in bytes. A low setting would highly compress the output image, and some quality is sacrificed, but the file size is smaller. Valid for color output file format only, and ignored for others.
Default: 80
|
readwritenonatomicassign |
Target frame used for taking a picture.
The target frame is a rectangular area confined within the bounds of the image, and represents the ideal area that should be covered by a document. This property will be initialized when image is captured using ImageCaptureControl along with one of the Capture Experience.
Default: CGRectZero.