R/oregonThreshold.R

Defines functions oregonThreshold

oregonThreshold <-
function(imgG){
	rPixelValues=as.vector(imgG)
	thrsh=mean(rPixelValues)/2
	removed=TRUE
	while(removed==TRUE){
		pixelSmaller=which(rPixelValues<thrsh)
		if(length(pixelSmaller)==0){
			removed==FALSE
			break
		}else{	
			rPixelValues=rPixelValues[-pixelSmaller]
			thrsh=mean(rPixelValues)/2
		}
	}
	thrsh
}

Try the CRImage package in your browser

Any scripts or data that you put into this service are public.

CRImage documentation built on Nov. 8, 2020, 8:01 p.m.