mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Changelog plus tidy of code/docs for convolve operation
This commit is contained in:
@@ -215,8 +215,10 @@ namespace sharp {
|
||||
/*
|
||||
* Convolution with a kernel.
|
||||
*/
|
||||
VImage Convolve(VImage image, int width, int height, double scale, double offset,
|
||||
const std::unique_ptr<double[]> &kernel_v) {
|
||||
VImage Convolve(VImage image, int const width, int const height,
|
||||
double const scale, double const offset,
|
||||
std::unique_ptr<double[]> const &kernel_v
|
||||
) {
|
||||
VImage kernel = VImage::new_from_memory(
|
||||
kernel_v.get(),
|
||||
width * height * sizeof(double),
|
||||
|
||||
@@ -38,8 +38,8 @@ namespace sharp {
|
||||
/*
|
||||
* Convolution with a kernel.
|
||||
*/
|
||||
VImage Convolve(VImage image, int width, int height, double scale, double offset,
|
||||
const std::unique_ptr<double[]> &kernel_v);
|
||||
VImage Convolve(VImage image, int const width, int const height,
|
||||
double const scale, double const offset, std::unique_ptr<double[]> const &kernel_v);
|
||||
|
||||
/*
|
||||
* Sharpen flat and jagged areas. Use sigma of -1.0 for fast sharpen.
|
||||
|
||||
@@ -640,9 +640,10 @@ class PipelineWorker : public AsyncWorker {
|
||||
// Convolve
|
||||
if (shouldConv) {
|
||||
image = Convolve(image,
|
||||
baton->convKernelWidth, baton->convKernelHeight,
|
||||
baton->convKernelScale, baton->convKernelOffset,
|
||||
baton->convKernel);
|
||||
baton->convKernelWidth, baton->convKernelHeight,
|
||||
baton->convKernelScale, baton->convKernelOffset,
|
||||
baton->convKernel
|
||||
);
|
||||
}
|
||||
|
||||
// Sharpen
|
||||
@@ -1165,13 +1166,12 @@ NAN_METHOD(pipeline) {
|
||||
// Convolution Kernel
|
||||
if(Has(options, New("convKernel").ToLocalChecked()).FromJust()) {
|
||||
Local<Object> kernel = Get(options, New("convKernel").ToLocalChecked()).ToLocalChecked().As<Object>();
|
||||
baton->convKernelWidth = attrAs<int32_t>(kernel, "width");
|
||||
baton->convKernelHeight = attrAs<int32_t>(kernel, "height");
|
||||
baton->convKernelWidth = attrAs<uint32_t>(kernel, "width");
|
||||
baton->convKernelHeight = attrAs<uint32_t>(kernel, "height");
|
||||
baton->convKernelScale = attrAs<double>(kernel, "scale");
|
||||
baton->convKernelOffset = attrAs<double>(kernel, "offset");
|
||||
|
||||
size_t kernelSize = baton->convKernelWidth * baton->convKernelHeight;
|
||||
|
||||
size_t const kernelSize = static_cast<size_t>(baton->convKernelWidth * baton->convKernelHeight);
|
||||
baton->convKernel = std::unique_ptr<double[]>(new double[kernelSize]);
|
||||
Local<Array> kdata = Get(kernel, New("kernel").ToLocalChecked()).ToLocalChecked().As<Array>();
|
||||
for(unsigned int i = 0; i < kernelSize; i++) {
|
||||
|
||||
Reference in New Issue
Block a user