Hallo
Der folgende Code wird trotz Optimierungsversuchen mit "Compile[]" nicht
beschleunigt...
ShearX = Compile[{{img, _Integer, 2}, {shear, _Real}, {width, _Integer}, {height, _Integer}},
tmp = img;
Do[
skew = shear*(y + 0.5);
skewi = Floor[skew];
skewf = FractionalPart[skew];
oleft = 0;
Do[
pixel = tmp[[y + 1, (width - x) + 1]];
left = Round[(1 - skewf)*pixel];
pixel = pixel - left + oleft;
tmp[[y + 1, (width - x + skewi) + 1]] = pixel;
oleft = left,
{x, 0, width - 1}
];
tmp[[y + 1, skewi + 1]] = oleft,
{y, 0, height - 1}
];
tmp,
{{skew, _Real}, {skewi, _Integer}, {skewf, _Real},
{oleft, _Integer}, {pixel, _Integer},
{left, _Integer}, {tmp, _Integer, 2}}
];
(Scherung eines Rasterbildes nach Paeth)
ImageShearX[img_, shear_, width_, height_] := Module[{nc, nr},
ImageDimensions[img];
{nr, nc} = ImageDimensions[img];
tmp = PlanarImageData[img];
MeshedImageData[
ImageData[
Developer`ToPackedArray[ShearX[N[#], shear, width, height] & /@ tmp[[1]]],
PixelInterleave -> False,
ColorFunction -> {RGBColor[#1, 0, 0] &, RGBColor[0, #1, 0] &, RGBColor[0, 0, #1] &}
]
]
];
Was kann ich tun?
Gruss, Thomas