Comments (5)
Got it. I guess this issue can occur in any of the augmentation type mismatch. There should be a away to restrict this
from augraphy.
gemma
Sorry but do you mean gamma? Gamma correction with Power Law transformation should be useful in adjusting the image intensity and hence giving a better visualization.
from augraphy.
Yes Gamma. Sorry for typos. I will work on my next PR to add this feature in repo
from augraphy.
I went ahead and merged this in since it looks pretty straightforward. I'll hold off on publishing to PyPI until someone else has had a chance to test it out.
from augraphy.
I tested it and looks fine, but one thing to take note is this augmentation is only working at post phase, and we will getting error if we put it in paper or ink phase, so it is better to add some notes and code to avoid the error if user put it at ink or paper phase. For example, adding evaluation of post data:
class GammaAugmentation(Augmentation):
def __init__(self, range=(0.5, 1.5), probability=0.5):
super().__init__(probability=probability)
self.range = range
def __repr__(self):
return f"GammaAugmentation(range={self.range}, probability={self.probability})"
def __call__(self, data,force=False):
if data['post']:
img = data['post'][-1].result
img = img.astype(np.uint8)
value = random.uniform(self.range[0], self.range[1])
invGamma = 1.0 / value
table = np.array([((i / 255.0) ** invGamma) * 255
for i in np.arange(0, 256)]).astype("uint8")
print(table.shape,img.shape)
frame= cv2.LUT(img, table)
data['post'].append(AugmentationResult(self, frame))
Example with gamma of 0.5 amd 2:
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.