Reference Guide > R Routines > ROBERTS Function
  

ROBERTS Function
Performs a Roberts edge enhancement of an image.
Usage
result = ROBERTS(image)
Input Parameters
image—A two-dimensional array.
Returned Value
resultA two-dimensional array of integer data type which contains the edge-enhanced image.
Keywords
Col—Computes the column gradient (horizontal line enhancement). (Default: Col = 1)
 
note
For horizontal line enhancement only, you must disable the vertical line enhancement by setting the Row keyword to 0.
Edge—A scalar string indicating how edge effects are handled. (Default: 'zero') Valid strings are:
'zero'—Sets the border of the output image to zero. (Default)
'copy'—Copies the border of the input image to the output image.
No_Clip—If set, the result data type is greater than the image data type so that overflow values in result are not clipped.
 
note
Use the No_Clip keyword to avoid overflow conditions.
Return—A scalar string specifying a mathematical function to apply. Valid strings are 'abs', 'phase', and 'value'. The Return keyword is used with the Row and Col keywords per Table 15-1: Return Values on page 992. (Default: 'abs')
 
Table 15-1: Return Values
 
Return = 'abs'
Return = 'phase'
Return = 'value'
Col = 1,
Row = 0
 
ABS(col grad)
 
Invalid Condition
 
column gradient
Col = 0,
Row = 1
 
ABS(row grad)
 
Invalid Condition
 
row gradient
Col = 1,
Row = 1
 
ABS(row grad)+
ABS(col grad)
ATAN(row grad ÷
col grad),
data type is double
 
Invalid Condition
Col = 0,
Row = 0
 
Invalid Condition
 
Invalid Condition
 
Invalid Condition
Row—Computes the row gradient (vertical line enhancement). (Default: Row = 1)
 
notte
For vertical line enhancement only, you must disable the horizontal line enhancement by setting the Col keyword to 0.
Same_Type—If set, the result is the same data type as image; otherwise, the result image data type is always integer unless No_Clip is set.
Zero_Negatives—If set, all negative values in result are set to zero.
Discussion
The ROBERTS function supports multi-layer band-interleaved images. When image is 3D, it is treated as an array of images array(mnp), where p is the number of m-by-n images. Each image in the input array is then operated on separately and an array of the result images is returned.
The ROBERTS function performs edge sharpening and isolation on image. It returns an approximation to the Roberts edge enhancement operator for images. This approximation is:
GA(j,k) = |Fj,k Fj+1,k+1| + |Fj,k+1 – Fj+1,k|
The resulting image returned by ROBERTS has the same dimensions as the input image.
 
note
Because the result image is saved in integer format, large original data values will cause overflow. Overflow occurs when the absolute value of the result is larger than 32,767. Use the No_Clip keyword to avoid overflow.
Example
This example uses the ROBERTS function to apply the Roberts edge enhancement operator to an aerial image. The final edge enhanced image is the absolute value of the difference between the original image and the image from the ROBERTS function. The results are shown in Original (left) and Roberts Edge Enhanced Image (right).
; Open the file containing the image.
OPENR, unit, FILEPATH('aerial_demo.img', $
   Subdir='demo/gallery3/data'), /Get_Lun
; Create an array large enough to hold the image.
img = BYTARR(512, 512)
; Close the file and free the file unit number.
READU, unit, img
FREE_LUN, unit
; Create a window large enough to hold two 512-by-512 images.
WINDOW, 0, Xsize = 1024, Ysize = 512
; Display the original image in the left-half of the window.
TV, img
HIST_EQUAL_CT, img
; Display absolute value of difference between original image and
; result of ROBERTS function in the right-half of the window.
TV, ABS(img - ROBERTS(img)), 1
 
Figure 15-2: Original (left) and Roberts Edge Enhanced Image (right)
See Also
CONVOL, SHIFT, SOBEL
For background information, see the PV‑WAVE User’s Guide.

Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.