How to apply a change of concentration and brightness of image - python-3.x

I want to apply a modification of the concentration and the brightness of an image and I found this example in opencv and python ,but it dont supported with my version of opencv , i want to get this result
using opencv 3 and python3 can any one help me

Related

Extract small regions from a PIL image python

enter image description here
I have a PIL image in python as shown and I want to extract each of the small red regions separately into a jpeg format. So from this file, I'm expecting file1.jpg, file2.jpg, etc.
How can I obtain each sub-regions in each different file?
PIL doesn't really excel at that. I would consider using:
OpenCV findContours(), or
scikit-image regionprops(), or
ImageMagick Connected Components, or
Python wand bindings to ImageMagick as above

How to remove non-text or back print noises from image?

I'm trying to detect text from in image using pytesseract and openCV. After applying adaptive gaussian threshold i got the following as an output:
Adaptive
I also tried OTSU and got the following result :
OTSU
My guess is I should use the adaptive image and remove the noises. But I don't know how to remove the noises. Or should i use the OTSU one?

How to change a part of the color of the background, which is black, to white?

I have been working on PyTesseract OCR and converting PDF to JPEG inorder to OCR the image. A part of the image has a black background and white text, which Tesseract is unable to identify, whereas all other parts of my image are being read perfectly well. Is there a way to change a part of the image that has black background? I tried a few SO resources, but doesn't seem to help.
I am using Python 3, Open CV version 4 and PyTesseract
opencv has a bitwise not function wich correctly reverses the image
you can put a mask / freeze on the rest of the image (the part that is correct already) and use something like this:
imageWithMask = cv2.bitwise_not(imageWithMask)
alternatively you can also perform the operation on a copy of the image and only copy over parts / pixels / regions you need....

Landmasking in SAR geotiff image

I am trying to mask the land in a satellite (SAR) grayscale geotiff image. The functionality is available in rsgislib, but it works on Linux and I am working on conda python 3.5 (Windows) and not able to find a possible way out.
Kindly guide as to how the land can be masked out in an image.
I found the way out :
First we have to download an appropriate shapefile of the region we wish to mask,
then there is a beautiful functionality available in gdal called as gdalwarp. We need to just open the anaconda prompt and from there just type in :`
gdalwarp -cutline shapefile_name.shp original_image.tif output_filename.tif
Now, the image with borderlines of the land will get saved in the file output_filename.tif
This is the file which contains the land portion and the ocean is masked out.
Then the procedure becomes fairly simple mask out the land by subtracting the output_filename.tif image from original image.
We will get the image of the ocean part with land portion in black, after that we can make the land portion as NaN.

octave plot over image: image disappears when scrolling or zooming (gnuplot)

I can successfully plot over an image but then as soon as I scroll or zoom, the image disappears (the plot stays displayed).
I have tried plotting images by using the exact code here. I Also tried using by using imread/imshow,or imagesc instead of imshow, the behavior remains the same (image disapearing).
Not sure whether this is related or not but when using imread I get the following warning "|warning: your version of GraphicsMagick limits images to 8 bits per pixel"
I am using octave 3.8.2 and gnuplot (5.0 patchlevel 1) on os X 10.11.1
Any suggestion on how to keep image displayed while scrolling or zooming?

Resources