Giter Site home page Giter Site logo

Comments (21)

shaheryar1 avatar shaheryar1 commented on May 30, 2024 2

I have changed it in a way that the content of first page is always aligned with the borders.

download (7)
download (2)

from augraphy.

shaheryar1 avatar shaheryar1 commented on May 30, 2024 1

Here are some examples with some noise and offset added to the border

download (10)

download (11)

download (12)

from augraphy.

shaheryar1 avatar shaheryar1 commented on May 30, 2024 1

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.

jboarman avatar jboarman commented on May 30, 2024 1

@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.

kwcckw avatar kwcckw commented on May 30, 2024

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:

image

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.

jboarman avatar jboarman commented on May 30, 2024
  • 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.

shaheryar1 avatar shaheryar1 commented on May 30, 2024

@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.

jboarman avatar jboarman commented on May 30, 2024

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.

shaheryar1 avatar shaheryar1 commented on May 30, 2024

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.

download (4)
download (5)
download

from augraphy.

kwcckw avatar kwcckw commented on May 30, 2024

i think the effect looks good , and could you show an example with more than 1 border side?

from augraphy.

shaheryar1 avatar shaheryar1 commented on May 30, 2024

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

download (7)
download (9)

from augraphy.

proofconstruction avatar proofconstruction commented on May 30, 2024

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.

jboarman avatar jboarman commented on May 30, 2024

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?

image

from augraphy.

kwcckw avatar kwcckw commented on May 30, 2024

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.

jboarman avatar jboarman commented on May 30, 2024

These look great!

from augraphy.

shaheryar1 avatar shaheryar1 commented on May 30, 2024

I'll go ahead and make a PR for this tomorrow.

from augraphy.

shaheryar1 avatar shaheryar1 commented on May 30, 2024

Here is the notebook where you can see the progress.
https://colab.research.google.com/drive/104dKLjXmG0qg15naxcnF1YgpIHjM9Jh-?usp=sharing

from augraphy.

kwcckw avatar kwcckw commented on May 30, 2024

@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

image

from augraphy.

proofconstruction avatar proofconstruction commented on May 30, 2024

@shaheryar1 Can you submit a pull request with this augmentation?

from augraphy.

shaheryar1 avatar shaheryar1 commented on May 30, 2024

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.

proofconstruction avatar proofconstruction commented on May 30, 2024

Merged PR #42

from augraphy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.