Comments (4)
Thanks, i will test it again the patch it in the next update.
from augraphy.
I merged PR #57 which seems to work fine and not throw bugs 1 and 2 above, but also we now only test with images larger than 30x30.
However , we are still getting an error in some runs of Folding.
from augraphy.
I merged PR #57 which seems to work fine and not throw bugs 1 and 2 above, but also we now only test with images larger than 30x30.
However , we are still getting an error in some runs of Folding.
Thanks for testing it out . I couldn't get a similar error but I'm getting a different error instead. Could you try again to replace the apply_folding
function with this and check whether you facing error with image size < 30 and >1?
# Apply perspective transform 2 times and get single folding effect
def apply_folding(self, img, ysize, xsize, gradient_width, gradient_height, fold_noise):
min_fold_x = min(np.ceil(gradient_width[0] * xsize),xsize).astype('int')
max_fold_x = min(np.ceil(gradient_width[1] * xsize),xsize).astype('int')
fold_width_one_side = int(random.randint(min_fold_x, max_fold_x)/2) # folding width from left to center of folding, or from right to center of folding
# test for valid folding center line
if (xsize-fold_width_one_side-1) < (fold_width_one_side+1):
print("Folding augmentation is not applied, please increase image size")
return img
fold_x = random.randint(fold_width_one_side+1, xsize-fold_width_one_side-1) # center of folding
fold_y_shift_min = min(np.ceil(gradient_height[0] * ysize),ysize).astype('int')
fold_y_shift_max = min(np.ceil(gradient_height[1] * ysize),ysize).astype('int')
fold_y_shift = random.randint(fold_y_shift_min, fold_y_shift_max) # y distortion in folding (support positive y value for now)
# test for valid folding width and folding distortion
if (fold_width_one_side != 0) and (fold_y_shift !=0) :
img_fold_l = self.warp_fold_left_side(img, ysize, fold_noise, fold_x, fold_width_one_side, fold_y_shift)
img_fold_r = self.warp_fold_right_side(img_fold_l, ysize, fold_noise, fold_x, fold_width_one_side, fold_y_shift)
return img_fold_r
else:
if (fold_width_one_side != 0):
print("Folding augmentation is not applied, please increase gradient width or image size")
else:
print("Folding augmentation is not applied, please increase gradient height or image size")
return img
from augraphy.
Fixed with PR #59
from augraphy.
Related Issues (20)
- Callable pipeline HOT 2
- Develop Augmentations that Simulate Images Taken by Camera Phone HOT 1
- Add Pattern-based Distortion Generator HOT 6
- Add `InkShifter` Augmentation to Shift Ink Pixels Randomly and Follow Background Shadows
- Add Wrinkled, Crumpled Paper Augmentation HOT 1
- Create Utility Function for Exposing Underlying Pixel Colors
- Empty Pipeline lowers image quality HOT 12
- Add Augmentation for Shadows Cast onto Camera-Sourced Document Images HOT 1
- Create Baseline Performance Benchmark; Apply Initial Optimizations Using Numba HOT 2
- Create Example Using Dataloader for PyTorch and TensorFlow HOT 1
- Add Python 3.11 Support, Drop Python 3.7 HOT 2
- Images Broken in PyPI Listing HOT 2
- Reflected Light from Camera Flash or other Bright Sources HOT 1
- Add Color Shifting / 3D Blur Effect HOT 4
- Improve PageBorder effect HOT 1
- Add support for bounding box, keypoints and mask. HOT 1
- Add `InkColorSwap` to Replace the Color Used for Lettering in a Document HOT 1
- Add `InkMottling` Augmentation to Ensure Ink is Non-Uniform HOT 1
- Add support for image with alpha layer. HOT 1
- Color range in InkBleed is not working HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from augraphy.