ramp

From DavinciWiki
Jump to: navigation, search


Description

Same as thm.ramp

Calculates a 0 - 1 float ramp between two overlapping pictures

Arguments and Return Values

Arguments: Two numeric array of identical dimension, a stop and ignore value

Return Value: A numeric array the same dimension as the inputs

Usage

Syntax: ramp(pic1 = VAL, pic2 = VAL [, stop = INT] [, ignore = VAL])

'pic1' - may be any 2-d array - float, int, short, etc.

'pic2' - may be any 2-d array - float, int, short, etc.

'stop' - maximum number of pixels away from edge to search. Default is 100000.

'ignore' - the non-data pixel values. Default is 0.

ramp() creates a map of the overlapping section of both images. Pixels that have image data in one picture but are ignore values in the other are left out of the ramp calculation. Each pixel of the map is filled in with it's integer distance (in pixels) away from the edge of the image. Pixels on the edge of the image (next to an ignore value) are given a value of 1. The next farthest away are given a value of 2, etc. When the distance maps are completed, the ramp is the ratio of pic2:(sum of both distance maps).

When specified, the 'stop' value will halt the stop the counting of the distance map. For example, a 'stop &#61' 5' command will count up to 5 pixels away from the edge of the data and then fill in the rest of the overlapping pixels in the distance map with the distance value of 5. This makes for a very steep, narrow ramp. Generally, in most THEMIS images, a 'stop' value of 100 is sufficient for a smooth looking ramp and is indistinguishable from allowing the distance count to continue until finished. Designating a smaller distance count also speeds up ramp calculation linearly.

In the case of total overlap of the images in the array (i.e. there are no ignore values), the ramp will be calculated to give a 0 - 50% blend of pic2. This allows the user to put a new image on top of a region that has already been filled with data.


NOTES:

  • Multiply ramp*pic2 and (1-ramp)*pic1 to achieve the proper blending of the images.
  • The ramp is only found for OVERLAPPING regions.
  • Non-overlapping regions from pic1 and pic2 need to be added to make a full blend. The source code of blend demonstrates how this is done.
  • You can speed up ramp calculation by setting 'stop'. 100 works well.

Examples

dv> pic1
400x300x3 array of byte, bip format [360,000 bytes]

dv> pic2
400x300x3 array of byte, bip format [360,000 bytes]

dv> ramp = ramp(pic1,pic2,ignore = 0)
400x300x1 array of float, bsq format [480,000 bytes]

Images

Images in order are: Image 1, Image 2 and the ramp

thmramp1.png thmramp2.png thmramp3.png

DavinciWiki Mini-Nav Bar

Contents


Contact Developers

  • davinci-dev [AT] mars.asu.edu

All other topics

  • See navigation on the left

Related Functions

Recent Core Changes

Modified On: 01-12-2008

Personal tools