Comments (21)
I have changed it in a way that the content of first page is always aligned with the borders.
from augraphy.
Here are some examples with some noise and offset added to the border
from augraphy.
To achieve this effect, perhaps a white or black border could be added to the page content as each side page is added and extends the canvas of the image to accommodate the additional page line? In other words, we extend outward instead of creeping inward on the page?
Great suggestion. Currently I was using the page itself to draw these borders but I guess the appropriate way would be adding an external border. Moreover, let me try the outside extension, it may give us more realistic effects.
from augraphy.
@shaheryar1 Thanks for sharing that NB ... this is definitely the way we should approach testing out new ideas and sharing them with the team. I ran into an error when I played the notebook using "Run All", but maybe that was just a temporary issue.
from augraphy.
I think this could be done by adding some small angle rotation, and heavy dusty ink augmentation at the edges of the image. This is the initial trial without edges based augmentation:
To improve the visualization , adding edges based dusty ink and white noise should be helpful. I will post again with updated results later.
from augraphy.
- Random Noise -- I agree that there is a certain level of random noise that appears around the edges. That noise tends to be associated depth caused by additional pages being included in the scan. That noise needs to be limited to the edge work (not the center of the page) and should vary since it's not always present..
- Background -- So far, in the examples that I was able to locate, the background does not seem to have much noise and appears to universally be black within these samples. In my own experience, however, I'm certain that I've seen the background as white, with only the edge of the paper being visible as somewhat straight lines representing the edges of the page. So, I'm thinking that the background could be randomly black or what, so long as the page edge is always visible. I think the times when it is black is again caused by depth, such as copying from a book on a copy machine, which causes the copy machine cover to be raised and out of focus for the scanner.
- Page Edges -- As noted above, for pages on a white background, we'll need semi-straight lines that represent the edges of the page. So, we'll need to start with a thin border created around the perfectly straight lines (created from the edge of the image prior to rotation) and slightly degrade those edges in a natural-looking manner and possibly with semi-rounded corners.
- Extra Pages -- Often, there are additional lines or pages represented which are similarly rotated and offset from the main page.
- Page Curl Effect -- I think we may need to address page curl in a separate issue as it may be too complicated to address in this issue. The effect is that whatever content that may be present at the edges (such as the side of the page that bends inward towards the book's binding) gets out of focus and may accumulate additional noise. That noise can turn into solid black after a threshold of noise in that bend is reached.
- Black & White -- It is nice that color can be retained from source images and from template page background images. However, if we are trying to replicate common copy machines, faxes and office-oriented scanning, then we will need to have a functional pipeline or augmentation that reproduces that effect, regardless of color being present in source images. So, perhaps we need a separate Augmentation that does B/W and Greyscaling of images (which seems silly on it's own b/c it's perhaps too simple). I raise that here to invite conversation for how we might create a new feature request around this need (augmentation vs predefined functional pipeline). For the purpose of this issue, we should experiment with only B/W images to make it easier to compare to sample images.
from augraphy.
@jboarman you can assign this card to me , I am pretty confident that I can implementation this augmentation (except for Page Curl Effect part).
from augraphy.
I agree ... we should leave the Page Curl effect to another issue to implement later, probably after #21 (page fold effect) since we can take some parts of that to apply to the page curl logic.
from augraphy.
There are some results that I got from initial experiments. I am planning to add ink bleed effect in the perpendicular direction to lines and also some random noise around the edges of semi-straight lines. Obviously it can be followed by random rotation too.
The random parameters I am thinking about
border_side = [top,left,right,bottom]
- can select multiple randomly
diminishing_effect=True/False
- will cause the lines to be diminished at the end of page
pages=[2,3,4,5,6]
- randomly selected. represents the width of the border
Suggestions are appreciated.
from augraphy.
i think the effect looks good , and could you show an example with more than 1 border side?
from augraphy.
Sure here it is. I also smoothened out the border which makes it more realistic. Also make sure you view the images with github "light theme" to clearly see the borders
from augraphy.
These look good, especially the last 3. In the last one, I think it would look better if the border effect continued down until it went off the page, because right now it looks a bit like part of the paper is missing, or maybe something is overlapping the paper a bit.
from augraphy.
The orientation of the side pages probably could rotate such that they align with the page content.
To achieve this effect, perhaps a white or black border could be added to the page content as each side page is added and extends the canvas of the image to accommodate the additional page line? In other words, we extend outward instead of creeping inward on the page?
from augraphy.
Here are some examples with some noise and offset added to the border
I like the effect where you added those noises to the border, it looks more real.
from augraphy.
These look great!
from augraphy.
I'll go ahead and make a PR for this tomorrow.
from augraphy.
Here is the notebook where you can see the progress.
https://colab.research.google.com/drive/104dKLjXmG0qg15naxcnF1YgpIHjM9Jh-?usp=sharing
from augraphy.
@shaheryar1 Thanks for sharing that NB ... this is definitely the way we should approach testing out new ideas and sharing them with the team. I ran into an error when I played the notebook using "Run All", but maybe that was just a temporary issue.
There's some error in the code due to ksize
is not parsed into add_corner_noise
. I re-edited the code a bit and here's the working version:
https://colab.research.google.com/drive/1PXLmnhc4T6rS7cw6x6bX9Ur62NBdpB9w?usp=sharing
from augraphy.
@shaheryar1 Can you submit a pull request with this augmentation?
from augraphy.
The pull request #42 has been created for this. I think it might contain some bugs related to image dimensions. Do share your feedback after testing.
from augraphy.
Merged PR #42
from augraphy.
Related Issues (20)
- 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
- Update to Paper Factory HOT 1
- Confusion on `Geometric` Augmentation HOT 2
- Memory leak in AugmentationSequence HOT 4
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.