May be this work for rectangular image.
   
  require(rimage)
  img<-read.jpeg("file.jpg")
image(rgb2grey(img))
  nsamples<-1000
  coordinates<-NULL
for (i in 1:nsamples) {
 coordinates<-rbind(
  coordinates,
  cbind(x=as.integer(nrow(img)*runif(1)),
  y=as.integer(ncol(img)*runif(1))))
 }
  
 
  But I sugest you give a look at "adehabitat" and "rimage" packages.
   
  Best,
   
  Miltinho

ronggui <[EMAIL PROTECTED]> escreveu:
  I have a map of a district (which is JPG format), and I want to do a
sptial sampling based on the map. So is there any function to do
spatial sampling of this type?

Thanks!

-- 
Ronggui Huang
Department of Sociology
Fudan University, Shanghai, China
»ÆÈÙ¹ó
¸´µ©´óѧÉç»áѧϵ

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


                
---------------------------------
 
        [[alternative HTML version deleted]]

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to