Learn R Programming

PET (version 0.5.1)

hough: Hough Transformation

Description

The function implements a Hough transformation for an image.

Usage

hough(oData, mode=1, XYSamples=nrow(oData), DeltaXY=1.0, 
      XYmin=-0.5*DeltaXY*(XYSamples-1), ThetaSamples=181, 
      RhoSamples=2*round(sqrt(sum((dim(oData))^2))/2)+1, ThetaMin=0,
      RhoMin=-0.5*((2*round(sqrt(sum((dim(oData))^2))/2)+1)-1),
      DeltaTheta=pi/ThetaSamples, DeltaRho=(2*abs(RhoMin)+1)/RhoSamples,       
      DebugLevel = "Normal")

Arguments

oData

(matrix) A matrix that contains the image (for the Hough transformation).

mode

(integer) The optimization strategy for the Hough transformation. Default is mode=1 for no optimization. Also implemented are mode=2 for 'vector mapping', mode=3 for 'avoid limit check and use vector mapping' and mode=4 for 'avoid limit check and use matrix mapping'.

XYSamples

(integer) Specifies the number of samples on the x-axis (rows) and y-axis (columns) of oData. Defaults to XYSamples=nrow(oData).

DeltaXY

(double) Specifies the sampling distance of both axes in the image. Defaults to DeltaXY=1.

XYmin

(double) Specifies the minimum sample position in the image on the first and second axis. If not given, the image is centered around the middle. Defaults to XYmin=-0.5*DeltaXY*(XYSamples-1).

ThetaSamples

(integer) Specifies the number of samples in the angular parameter \(\theta\) in the Hough transformation image. It is sampled linearly from \(0\) to (approximately) \(\pi\) radians. Defaults to ThetaSamples=181.

RhoSamples

Specifies the number of samples in the distance parameter \(\rho\) in the Hough transformation image. Defaults to RhoSamples=2*round(sqrt(sum((dim(oData))^2))/2)+1.

ThetaMin

(double) Specifies the minimum sample position in the Hough transformation image on the first axis. Defaults to ThetaMin=0.

RhoMin

(double) Specifies the minimum sample position in the Hough transformation image on the second axis. Defaults to RhoMin=-0.5*((2*round(sqrt(sum((dim(oData))^2))/2)+1)-1).

DeltaTheta

(double) Angular sampling distance. Defaults to DeltaTheta=pi/ThetaSamples.

DeltaRho

(double) Specifies the sampling distance in \(\rho\). The program will center the sampling points around \(0\). Defaults to DeltaRho=(2*abs(RhoMin)+1)/RhoSamples

DebugLevel

(character) This parameter controls the level of output. Defaults to DebugLevel="Normal" for a standard level output. Alternative implementations are "Detail" if it is desirable to show almost all output on screen or "HardCore" for no information at all.

Value

hData

A matrix, that contains the Hough transformation of oData.

Header

A list of following values:

SignalDim

The dimension of the hData.

XYmin

The minimum x- and y-position in hData.

DeltaXY

Sampling distance on the x- and y-axis in hData.

call

Arguments of the call to hough.

Details

It is shown in the paper of P.Toft that the Hough transformation can be defined in a way that gives exactly the same discrete parameter domain as found with the nearest neighbour approximation of the discrete Radon transformation. The Hough transformation does not have the same property. It is also shown that the Hough transformation behaves very differently when changing the sampling intervals in the discrete parameter domain, compared to the discrete Radon transformation. Furthermore different optimization schemes for the Hough transformation are described there.

References

Toft, Peter, Ph.D. Thesis, The Radon Transform - Theory and Implementation, Department of Mathematical Modelling Section for Digital Signal Processing, Technical University of Denmark, 1996. http://eivind.imm.dtu.dk/staff/ptoft/ptoft_papers.html

See Also

radon, markPoisson

Examples

Run this code
# NOT RUN {
P <- phantom()
hP <- hough(P)
viewData(list(P, hP$hData), list("Phantom", "Hough transformed phantom"))
rm(P,hP)
# }

Run the code above in your browser using DataLab