How to change contrast and brightness of an image with Python (Specifically OpenMV)?
Go to solution
Solved by Mr.Meerkat,
8 hours ago, Azgoth 2 said:
How does OpenMV deal with images? Does it use something like a 2d array of pixel values? If so you could use some of the tools from probably the Numpy or Scipy libraries to clip your pixel values at a certain level (you'd probably need to play with the level a bit to find a good one). Or, if you could use the PIL library:
from PIL import Image, ImageEnhance im = Image.Image("/path/to/saved/image") contrast = ImageEnhance.Contrast(im) contrast = contrast.enhance(FACTOR) # set FACTOR > 1 to enhance contrast, < 1 to decrease # either save the image... contrast.save("/path/to/new/location") # or cast to a numpy array import numpy as np im_array = np.array(contrast.getdata())
you can't import libraries in OpenMV
Read a different section of the OpenMV docs and realised that I could just control the actual sensor instead (rather than editing the image afterwards)
However, found out it doesn't work as it still struggles detecting the correct thing and it did not increase the detection range )
Thanks anyway
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now