Reading .RAW images in R

I would like to read .RAW images in R. I can open those images in ImageJ software using following parameters -

Image Type: 16-bit Unsigned
Width: XXXX pixels
Height: XXXX pixels
Offset to first image: 0 bytes
Number of Images: 1
Gap between Images: 0 bytes

unchecked - White is zero
checked - Little-endian byte order
unchecked - Open all files in folder
unchecked - Use virtual stack

image

Just for curiosity, which camera manufaturer uses .raw format? I'm not familiar with that particular RAW format but, all RAW formats are very lightly compressed or not compressed at all and take a lot of space so, you would be better exporting those images to a more compressed file format, unless you have an enormous amount of RAM memory for training your model..

Hi andresrcs,

Thanks for your response! It is an instrument taken picture and then cropped to reduce size. Python reads them without any problem but I do not how to read into R.

Any help in this regard would be appreciated.

Thanks,

If a python library can read the file then you can use it within your R workflow using the reticulate package for importing the python library into R, for example I use this python library for generating 1D barcodes and later I render this images in html tables using rmarkdown.

library(reticulate)
use_python("/usr/bin/python3.5")

barcode <- import("barcode")
name  <- barcode$generate('EAN14', '77751493001181', output='barcode_img')

Definitely can do this with GDAL's generic virtual format VRT, then read with raster/gdal, stars or vapour. I can put together an example.

1 Like

Hi mdsumner,

Would you please provide an example? I really appreciate your help.

Thanks

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.