Importe imagens não tratadas usando uma biblioteca C
LibRaw (http://www.libraw.org) é uma biblioteca para leitura de arquivos RAW obtidos a partir de câmeras fotográficas digitais (CRW/CR2, NEF, RAF, DNG, entre outras). Importe imagens raw para a Wolfram Language usando libraw.
A função read_raw_image mostrada abaixo toma um caminho para um arquivo e retorna uma expressão de imagem. Veja o exemplo completo aqui.
EXTERN_C DLLEXPORT int read_raw_image(WolframLibraryData libData, mint Argc,
MArgument *Args, MArgument res) { ... WolframImageLibrary_Functions imgFuns = libData->imageLibraryFunctions; ... file = MArgument_getUTF8String(Args[0]); libraw_open_file(iprc, file); libraw_unpack(iprc); iprc->params.output_bps = 8; ... img = libraw_dcraw_make_mem_image(iprc, &check); ... if (img->bits == 16) { raw_t_ubit16 * raw_data = (raw_t_ubit16*)img->data; imgFuns->MImage_new2D( img->width, img->height, 3, MImage_Type_Bit16, MImage_CS_RGB, 1, &out); memcpy(imgFuns->MImage_getBit16Data(out), raw_data, img->width * img->height * 3 * sizeof(raw_t_ubit16)); } else { ... } MArgument_setMImage(res, out); ... }
Carregue a função e use-a para importar um arquivo raw.
In[1]:= | ![]() X |
Out[1]= | ![]() |
In[2]:= | ![]() X |
Out[2]= | ![]() |
In[3]:= | ![]() X |
Out[3]= | ![]() |