02.08.2013 Views

Image and Video Processing Libraries in Ptolemy II by ... - CiteSeerX

Image and Video Processing Libraries in Ptolemy II by ... - CiteSeerX

Image and Video Processing Libraries in Ptolemy II by ... - CiteSeerX

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

For example, an image that is scaled <strong>by</strong> 1.7 <strong>in</strong> the x direction, <strong>and</strong> 1.4 <strong>in</strong> the y<br />

direction, will have values at (0,0), (1.4,0), (0,1.7), (1.4,1.7), (2.8,1.7), (1.4,3.4),<br />

(2.8,3.4). However, we need po<strong>in</strong>ts at (0,0), (1,0), (0,1), (1,1), etc.<br />

The JAIScale actor provides four different <strong>in</strong>terpolation methods to figure<br />

out the values of the po<strong>in</strong>ts. All but nearest neighbor <strong>in</strong>terpolation makes use of<br />

the SubSampleBits Parameter which <strong>in</strong>dicates how many bits to use to estimate<br />

po<strong>in</strong>ts.<br />

Nearest Neighbor<br />

Nearest Neighbor <strong>in</strong>terpolation simply takes the value of the po<strong>in</strong>t that is nearest.<br />

For example, the value of (1,0) <strong>in</strong> the new image corresponds to a po<strong>in</strong>t<br />

(5/7, 0) <strong>in</strong> the old image, <strong>and</strong> thus would correspond to (1, 0) <strong>in</strong> the old image.<br />

While this method is computationally <strong>in</strong>expensive, it tends to leave artifacts.<br />

Bil<strong>in</strong>ear<br />

Bil<strong>in</strong>ear <strong>in</strong>terpolation takes the four closest po<strong>in</strong>ts <strong>in</strong> the source image <strong>and</strong><br />

computes the value of the dest<strong>in</strong>ation pixel. If the subsample value is given <strong>by</strong><br />

(u, v), <strong>and</strong> the 4 po<strong>in</strong>ts (go<strong>in</strong>g left to right, top to bottom) are p00, p01, p10, p11,<br />

the output is def<strong>in</strong>ed to be:<br />

(1 − v) ∗ [(1 − u) ∗ p00 + u ∗ p01] + v ∗ [(1 − u) ∗ p10 + u ∗ p11]<br />

While the results are usually better then nearest neighbor <strong>in</strong>terpolation, artifacts<br />

may still rema<strong>in</strong>.<br />

Bicubic<br />

Bicubic <strong>in</strong>terpolation takes the 16 closes po<strong>in</strong>ts <strong>and</strong> uses a bicubic waveforms <strong>in</strong>stead<br />

of the l<strong>in</strong>ear waveforms used <strong>in</strong> bil<strong>in</strong>ear <strong>in</strong>terpolation. It uses the follow<strong>in</strong>g<br />

function to <strong>in</strong>terpolate po<strong>in</strong>ts.<br />

Bicubic2<br />

r(x) = 3<br />

2 |x|2 + 1, 0 ≤ x < 1<br />

r(x) = −1<br />

2 |x|3 + 5<br />

2 |x|2 − 4|x| + 2, 1 ≤ x < 2<br />

r(x) = 0, otherwise<br />

2 |x|3 − 5<br />

Bicubic2 <strong>in</strong>terpolation uses a different polynomial.<br />

r(x) = |x| 3 − 2|x| 2 + 1, 0 ≤ x < 1<br />

r(x) = −|x| 3 + 5|x| 2 − 8|x| + 4, 1 ≤ x < 2<br />

r(x) = 0, otherwise<br />

The Bicubic <strong>and</strong> Bicubic2 <strong>in</strong>terpolations tend to perform better than the bil<strong>in</strong>ear<br />

<strong>in</strong>terpolation at the expense of extra computation time. In fact, most of the<br />

32

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!