Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #@gmic scale_dcci2x : _edge_threshold>=0
- #@gmic : Double image size using directional cubic convolution interpolation,
- #@gmic : as described in https://en.wikipedia.org/wiki/Directional_Cubic_Convolution_Interpolation.
- #@gmic : Default value: 'edge_threshold=1.15'.
- #@gmic : $ image.jpg --scale_dcci2x ,
- scale_dcci2x : -check "${1=1.15}>=0"
- -e[^-1] "Double image size using directional cubic convolution interpolation."
- -v -
- -r 200%,200%,1,100%,4
- -f "*
- if (!(x%2 && y%2),i,
- d1 = abs(j(-1,-3) - j(-3,-1)) + abs(j(1,-3) - j(-1,-1)) + abs(j(3,-3) - j(1,-1)) +
- abs(j(-1,-1) - j(-3,1)) + abs(j(1,-1) - j(-1,1)) + abs(j(3,-1) - j(1,1)) +
- abs(j(-1,1) - j(-3,3)) + abs(j(1,1) - j(-1,3)) + abs(j(3,1) - j(1,3));
- d2 = abs(j(-3,-3) - j(-1,-1)) + abs(j(-1,-3) - j(1,-1)) + abs(j(1,-3) - j(3,-1)) +
- abs(j(-3,-1) - j(-1,1)) + abs(j(-1,-1) - j(1,1)) + abs(j(1,-1) - j(3,1)) +
- abs(j(-3,1) - j(-1,3)) + abs(j(-1,1) - j(1,3)) + abs(j(1,1) - j(3,3));
- if ((1 + d1)/(1 + d2)>$1,
- (-j(-3,-3) + 9*j(-1,-1) + 9*j(1,1) - j(3,3))/16,
- if ((1 + d2)/(1 + d1)>$1,
- (-j(3,-3) + 9*j(1,-1) + 9*j(-1,1) - j(-3,3))/16,
- (
- w1 = 1/(1 + d1^5);
- w2 = 1/(1 + d2^5);
- weight1 = w1/(w1 + w2);
- weight2 = w2/(w1 + w2);
- DownRightPixel = (-j(-3,-3) + 9*j(-1,-1) + 9*j(1,1) - j(3,3))/16;
- UpRightPixel = (-j(3,-3) + 9*j(1,-1) + 9*j(-1,1) - j(-3,3))/16;
- DownRightPixel*weight1 + UpRightPixel*weight2
- )
- ))
- )
- "
- -f "*
- if ((!(x%2) && !(y%2)) || ((x%2) && (y%2)),i,
- d1 = abs(j(1,-2) - j(-1,-2)) +
- abs(j(2,-1) - j(0,-1)) + abs(j(0,-1) - j(-2,-1)) +
- abs(j(3,0) - j(1,0)) + abs(j(1,0) - j(-1,0)) + abs(j(-1,0) - j(-3,0)) +
- abs(j(2,1) - j(0,1)) + abs(j(0,1) - j(-2,1)) +
- abs(j(1,2) - j(-1,2));
- d2 = abs(j(-2,1) - j(-2,-1)) +
- abs(j(-1,2) - j(-1,0)) + abs(j(-1,0) - j(-1,-2)) +
- abs(j(0,3) - j(0,1)) + abs(j(0,1) - j(0,-1)) + abs(j(0,-1) - j(0,-3)) +
- abs(j(1,2) - j(1,0)) + abs(j(1,0) - j(1,-2)) +
- abs(j(2,1) - j(2,-1));
- if ((1 + d1)/(1 + d2)>$1,
- (-j(0,-3) + 9*j(0,-1) + 9*j(0,1) - j(0,3))/16,
- if ((1 + d2)/(1 + d1)>$1,
- (-j(-3,0) + 9*j(-1,0) + 9*j(1,0) - j(3,0))/16,
- (
- w1 = 1/(1 + d1^5);
- w2 = 1/(1 + d2^5);
- weight1 = w1/(w1 + w2);
- weight2 = w2/(w1 + w2);
- HorizontalPixel = (-j(-3,0) + 9*j(-1,0) + 9*j(1,0) - j(3,0))/16;
- VerticalPixel = (-j(0,-3) + 9*j(0,-1) + 9*j(0,1) - j(0,3))/16;
- VerticalPixel*weight1 + HorizontalPixel*weight2
- )
- ))
- )
- "
- -v +
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement