Compartir a través de


ImageExtractor (U-SQL)

Summary

The ImageExtractor function from the ImageCommon assembly is used to extract data from images that will be consumed by other cognitive functions. The current maximum size of a row is 4 MB so you will need to use images less than 4 MB in size when using ImageExtractor.

Examples

Load images to a rowset variable

REFERENCE ASSEMBLY ImageCommon;   

@images =
    EXTRACT FileName string, 
            ImgData byte[]
    FROM @"/Samples/Images/{FileName}.jpg"
    USING new Cognition.Vision.ImageExtractor();

@result = 
    SELECT FileName FROM @images;

OUTPUT @result 
TO "/ReferenceGuide/Cognition/Vision/ImageExtractor_rv.txt" 
USING Outputters.Tsv();

Load images to a table
This table will be referenced in various cognitive examples

REFERENCE ASSEMBLY ImageCommon;   

DROP TABLE IF EXISTS dbo.myImages;
CREATE TABLE dbo.myImages (
       INDEX clx_FileName CLUSTERED(FileName ASC) 
       DISTRIBUTED BY HASH (FileName)
) AS EXTRACT FileName   string,
            ImgData     byte[]
    FROM @"/Samples/Images/{FileName}.jpg"
    USING new Cognition.Vision.ImageExtractor();

See Also