how to charge images in pgm format in R? - r

Hello I'm using the CMU Face Images Data Set https://archive.ics.uci.edu/ml/datasets/CMU+Face+Images to build a model that allows me to recognize subjects who wear sunglasses, these images are in pgm format, I'm very new in machine learning and I do not know how to read the images in R.
Does anyone know in what way I can do it? and if you have any recommendation for the construction of the model, I would appreciate it very much.

You can try using this to read a pgm image.
x=read.pnm(file = "Aaron_Guiel_0001.pgm")

Related

R Social Network Analysis/Data Manipulation Question: Reading in .edges, .circles, .egofeat, .feat, and .featnames files

So I'm working with a network dataset from Stanford's SNAP Datasets and "SNAP" has wrappers for Python and C++ but not R - however, the data is still usable since I believe it's a mix of CSV files.
I can actually read in the .edges file and form an igraph object but want to read in the other files, get the attributes & add those attributes to the igraph object for analysis. I'm just confused on how to work with the .circles, .egofeat, .feat, and .featnames files since the documentation on the dataset is very scarce. Hoping someone has worked with the dataset in R or even another language and has any pointers to get started.
Thank you!

Write exif data back to jpeg in R

All,
I am using R and exifr to read in a jpeg with a ton of exif data entries (~150 different tags). I use a bunch of those to convert/change the values in the jpeg. After that, I would like to save the new values (in matrix form now) with the same exif data back to a jpeg. So, ideally, I would have two jpegs with different values, but everything else is the same. Is there a way to use exifr to write exif data back to a file? That is, read in a jpeg, manipulate it, and then save it back as jpeg with the exact same metadata?
I have thought about different approaches, but haven't really gotten far in either.
Maybe using the raster package and then exporting it as a geoTIFF, but that would obviously mean a change in file format.
The jpeg package loses the metadata while reading in the image.
Thanks y'all!
PS: There is a similar question about writing metadata, but it's almost 2 years old and only refers to GPS tags.

Exporting R to vector-based designed charts

I'm looking for ways to visualize data in vector-based images through R. Here are links to some examples of something I'm having designed:
https://dribbble.com/shots/2195053-The-Truth-About-B-zier-Graphs/attachments/405731
https://dribbble.com/shots/1728095-Line-Chart/attachments/278191
I understand there are some R libraries for SVG and other file types that permit export to higher quality designs, but haven't seen any tutorials or tools. Any direction is appreciated. I'm not even sure what steps would be necessary to dynamically generate charts like that through R.
Thank you.

R: Help reading a particular .mat file into R

So I've been trying to read this particular .mat file into R. I don't know too much about matlab, but I know enough that the R.matlab package can only read uncompressed data into R, and to save it as uncompressed I need to save it as such in matlab by using
save new.mat -v6.
Okay, so I did that, but when I used readMat("new.mat") in R, it just got stuck loading that forever. I also tried using package hdf5 via:
> hdf5load("new.mat", load=FALSE)->g
Error in hdf5load("new.mat", load = FALSE) :
can't handle hdf type 201331051
I'm not sure what this problem could be, but if anyone wants to try to figure this out the file is located at http://dibernardo.tigem.it/MANTRA/MANTRA_online/Matlab_Code%26Data.html and is called inventory.mat (the first file).
Thanks for your help!
This particular file has one object, inventory, which is a struct object, with a lot of different things inside of it. Some are cell arrays, others are vectors of doubles or logicals, and a couple are matrices of doubles. It looks like R.matlab does not like cells arrays within structs, but I'm not sure what's causing issues for R to load this. For reasons like this, I'd generally recommend avoiding mapping structs in Matlab to objects in R. It is similar to a list, and this one can be transformed to a list, but it's not always a good idea.
I recommend creating a new file, one for each object, e.g. ids = inventory.instance_ids and save each object to either a separate .mat file, or save all of them, except for the inventory object, into 1 file. Even better is to go to text, e.g via csvwrite, so that you can see what's being created.
I realize that's going around use of a Matlab to R reader, but having things in a common, universal format is much more useful for reproducibility than to acquire a bunch of different readers for a proprietary format.
Alternatively, you can pass objects in memory via R.matlab, or this set of functions + the R/DCOM interface (on Windows).
Although this doesn't address how to use R.matlab, I've done a lot of transferring of data between R and Matlab, in both directions, and I find that it's best to avoid .mat files (and, similarly, .rdat files). I like to pass objects in memory, so that I can inspect them on each side, or via standard text files. Dealing with application specific file formats, especially those that change quite a bit and are inefficient (I'm looking at you MathWorks), is not a good use of time. I appreciate the folks who work on readers, but having a lot more control over the data structures used in the target language is very much worth the space overhead of using a simple output file format. In-memory data transfer is very nice because you can interface programs, but that may be a distraction if your only goal is to move data.
Have you run the examples in http://cran.r-project.org/web/packages/R.matlab/R.matlab.pdf on pages 22 to 24? That will test your ability to read from versions 4 and 5. I'm not sure that R cannot read compressed files. There is an Rcompresssion package in Omegahat.

Best 3D model file format to load animaton

I am a bigginer in game programming and now I write 3D game with DirectX 10 which can be free downloaded from website. I need some animation 3D models for game personals. What is the best format for models?
Thanks.
As you have asked this question, I'd go with obj file format.
Very simple, and recommended for your first model format.
See this for more information.

Resources