X

Help Articles are product support tips and information straight from the NV5 Geospatial Technical Support team developed to help you use our products to their fullest potential.



3808 Rate this article:
No rating

Color Density Contrasting in an Image using the IDL Radon Transform

This example uses the Radon transform to provide more contrast within an image based on its color density. The image comes from the endocell.jpg file found in the examples/data sub-directory under your IDL directory. 

The image is a photomicrograph of cultured endothelial cells. The edges (outlines) within the image are defined by the Roberts filter. The Radon transform is applied to the filtered image. The high intensity values within the triangle of the center of the transform represent high color density within the filtered and original image. The transform is scaled to only include the values above the mean of the transform. The scaled results are backprojected by the Radon transform. The resulting backprojection is used as a mask on the original image. The final resulting image shows more color contrast bounded by the edges of the filtered image.

Code Example:

PRO contrastingCells

    ; Determine path to file.
    file = FILEPATH('endocell.jpg', $
     SUBDIRECTORY = ['examples', 'data'])

    ; Import image within file into IDL.
    READ_JPEG, file, endocellImage
    HELP, endocellImage

    ; Determine image's size, but divide it by 4 to reduce
    ; the image.
    imageSize = SIZE(endocellImage, /DIMENSIONS)/4

    ; Resize image to half its original length and width.
    endocellImage = CONGRID(endocellImage, $
     imageSize[0], imageSize[1])

    ; If you are on a truecolor display, set the DECOMPOSED
    ; keyword to the DEVICE command to zero before using
    ; any color table related routines.
    DEVICE, DECOMPOSED = 0

    ; Load in the STD GAMMA-II color table.
    LOADCT, 5

    ; Display original image.
    WINDOW, 0, XSIZE = imageSize[0], YSIZE = imageSize[1], $
     TITLE = 'Endocells'
    TV, endocellImage

    ; Filter original image to clarify the edges of the
    ; cells.
    image = ROBERTS(endocellImage)

    ; Display filtered image.
    WINDOW, 1, XSIZE = imageSize[0], YSIZE = imageSize[1], $
     TITLE = 'Filtered'
    TVSCL, image

    ; Transform the filtered image.
    transform = RADON(image, RHO = rho, THETA = theta)

    ; Display transform of image.
    transformSize = SIZE(transform, /DIMENSIONS)
    WINDOW, 2, TITLE = 'Transform of Image', $
     XSIZE = transformSize[0], YSIZE = transformSize[1]
    TVSCL, transform

    ; Scale the transform to include only the density
    ; values above the mean of the transform.
    scaledTransform = transform > MEAN(transform)

    ; Display scaled transform.
    WINDOW, 3, TITLE = 'Scaled Transform of Image', $
     XSIZE = transformSize[0], YSIZE = transformSize[1]
    TVSCL, scaledTransform

    ; Backproject the scaled transform.
    backprojection = RADON(scaledTransform, /BACKPROJECT, $
     RHO = rho, THETA=theta, NX = imageSize[0], $
     NY = imageSize[1])

    ; Display backprojection.
    WINDOW, 4, XSIZE = imageSize[0], YSIZE = imageSize[1], $
     TITLE = 'Backprojection'
    TVSCL, backprojection

    ; Use the backprojection as a mask to provide
    ; a color density contrast of the original image.
    constrastingImage = endocellImage*backprojection

    ; Display resulting contrast image.
    WINDOW, 5, XSIZE = imageSize[0], YSIZE = imageSize[1], $
     TITLE = 'Constrast'
    TVSCL, endocellImage*backprojection


END

_________________________________________________

Reviewed by BC on 09/05/2014

Please login or register to post comments.
Featured

End-of-Life Policy Enforcement for ENVI 5.3 / IDL 8.5 and Earlier Versions

5/6/2024

April 1, 2024 Dear ENVI/IDL Customer,  We are reaching out to notify you of our supported... more »

How to Upgrade licenses to ENVI 6.x / IDL 9.x

12/5/2023

What is the new Upgrade function? Starting with ENVI 6.0 and IDL 9.0, we have implemented an... more »

What to do if the 'License Administrator - License Server' for the Next-Generation License Server does not start?

6/13/2023

Background: With the release of ENVI 5.7 & IDL 8.9 and the corresponding Next-Generation licensing... more »

Next-Generation Licensing FAQ

4/28/2023

  NV5 Geospatial has adopted a new licensing technology for all future releases of our ENVI, IDL... more »

The IDL Virtual Machine

6/6/2013

What is the IDL Virtual Machine? An IDL Virtual Machine is a runtime version of IDL that can... more »