Hi Julien, you've posed a really interesting problem, and the bulk of which
I'd argue might not be best solved using R but I'll be very interested to
hear other people's opinions on it. A large portion of your project is
going to rely on good image processing, so the raster and jpeg packages
will almost certainly come in handy. R has packages that tie into external
utilities that have better analytical capabilities than many native R
packages provide, however.  A good example of this is ImageJ and the R glue
package RImageJ. You'll likely need to develop a workflow that does what
you want using one of these types of external packages in terms of image
pre-/processing and then end up automating it in R to some degree.

Though I'm more of a remote sensing specialist I've found some of the best
image analysis packages in R coming from the medical research community.
The next place I'd point you is to the Medical Imaging task view,as much of
what you're trying to do might be accomplished using packages there:

http://cran.r-project.org/web/views/MedicalImaging.html

For example, to identify patches of color, and likely do the major task of
separating "animal" from "background" you will likely want to use a process
called segmentation.  The dpmixsim package is one R package I found that
does this using modern techniques, though it looks like it might be
stagnant. There may be others I'm unaware of. I'm afraid I rely on other
commercial tools (ENVI/IDL and eCognition for segmentation) so I might not
be of much use there.

This blog post is a much more basic approach to image segmentation that
might get you on the road to a solution using only the jpeg package:

http://alandgraf.blogspot.com/2012/02/unsupervised-image-segmentation-with.html

Anyway, the rest of your stated research problem in terms of automating a
dorsal vs. ventral orientation can be solved in a range of ways from the
simple (assuming you have pre-processed the image to a horizontal
orientation, identify "animal" pixels from "background" pixels, identify
centroid location within animal pixels/outline polygon using the rgeos
package, draw a horizontal line through it, etc.) to something much more
complex.

Anyway, hopefully that's food for thought.

Sincerely,
Forrest

--
Forrest R. Stevens
Ph.D. Candidate, QSE3 IGERT Fellow
Department of Geography
Land Use and Environmental Change Institute
University of Florida
www.clas.ufl.edu/users/forrest


On Mon, May 19, 2014 at 9:03 AM, Julien Renoult <jurenoult@gmail.com> wrote:

> Dear R-user
> I have a series of spatial analyses to run with R, but I have no idea of
> which packages to use. Actually, these are not spatial analyses sensu
> stricto, but the principle should be the same.
> I would like to analyse animal colour patterns from pictures. I have
> pictures of many species, and I would like to test wether colour A is more
> associated (ie spatially close to)  with colour B than expected by chance.
> I thus need to :
> - open my pictures in R (currently in jpeg)
> - delineate body contours, colour patches A and colour patches B
> - extract coordinates for the three shapes
> - perform some spatial statistics
> Also, I would like to test wether colour A is located more on the dorsal
> than on the ventral side. I thus need to define a line (mid-body) and
> calculate the area of colour A above and below this line.
>
> Please, could anyone indicate me which package(s) to use for these tasks? I
> read the CRAN task view page for spatial data, but there are so many
> packages !!
> In advance, thank you very much.
> Best regards, Julien
>
>
> *Julien Renoult*
> *Chargé de Recherche CNRS*
> *Ph.D Evolutionary Biology - Dr. Vet. Med.*
>
> *UMR8218*
> *Art Création Théorie & Esthétique*
> *49 rue des Bergers*
> *75015 Paris*
> *+33615265240*
>
>         [[alternative HTML version deleted]]
>
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>

	[[alternative HTML version deleted]]

