mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Expose gaussian_sharpen()
This commit is contained in:
parent
69938d20df
commit
939a7ef1fb
@ -266,7 +266,7 @@ int default_convolve_matrix_size(const float radius, const float sigma, const bo
|
||||
|
||||
// }}}
|
||||
|
||||
QImage gaussian_sharpen(const QImage &img, const float radius, const float sigma, const bool high_quality=true) {
|
||||
QImage gaussian_sharpen(const QImage &img, const float radius, const float sigma, const bool high_quality) {
|
||||
int matrix_size = default_convolve_matrix_size(radius, sigma, high_quality);
|
||||
int len = matrix_size*matrix_size;
|
||||
float alpha, *matrix = new float[len];
|
||||
|
@ -12,4 +12,5 @@
|
||||
|
||||
QImage remove_borders(const QImage &image, double fuzz);
|
||||
QImage grayscale(const QImage &image);
|
||||
QImage gaussian_sharpen(const QImage &img, const float radius, const float sigma, const bool high_quality=true);
|
||||
|
||||
|
@ -31,3 +31,10 @@ QImage* grayscale(const QImage &image);
|
||||
ans = grayscale(*a0);
|
||||
IMAGEOPS_SUFFIX
|
||||
%End
|
||||
|
||||
QImage gaussian_sharpen(const QImage &img, const float radius, const float sigma, const bool high_quality=true);
|
||||
%MethodCode
|
||||
IMAGEOPS_PREFIX
|
||||
ans = gaussian_sharpen(*a0, a1, a2, a3);
|
||||
IMAGEOPS_SUFFIX
|
||||
%End
|
||||
|
@ -217,6 +217,11 @@ def remove_borders(img, fuzz=None):
|
||||
ans = imageops.remove_borders(image_from_data(img), max(0, fuzz))
|
||||
return ans if ans.size() != img.size() else img
|
||||
|
||||
def gaussian_sharpen(img, radius=0, sigma=3, high_quality=True):
|
||||
if imageops is None:
|
||||
raise RuntimeError(imageops_err)
|
||||
return imageops.gaussian_sharpen(image_from_data(img), max(0, radius), sigma, high_quality)
|
||||
|
||||
def run_optimizer(file_path, cmd, as_filter=False, input_data=None):
|
||||
file_path = os.path.abspath(file_path)
|
||||
cwd = os.path.dirname(file_path)
|
||||
|
Loading…
x
Reference in New Issue
Block a user