How to extract background image and text from a image - python-3.x

I have an image and am trying to separate the background image and text.
For text I have used pytesseract and it gives me all the data. Now my aim is to translate this text and place it back on the image.
For that I need the background image and the position of the text where I need to put the text back.
I need some help or pointers as I have been trying to use OpenCV for same but no luck yet.
Thanks
-Megha

Related

Image to text conversion python

i am trying to extract only the highlighted text from an image using pytesseract module in python.
Issue is that i am unable to extract the highlighted part and the whole image is getting converted to text, and i have no idea how to extract specific part based on the background colour.
The best way to achieve it is by crop and send just the part you need from the image, it will also improve the performance.
There is a related discussion that may help -> Select part of text that was extracted using the Tesseract OCR

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

How to make changes on an image that is being processed after using optical character recognition using python?

I have decided to use OCR to search for printed text in my black and white image. If I were to find this text in the image and then replace it with something else, how would I go about writing a python script for this?
For example, I have a black and white image where I have detected the a block of text. I would like to know if its possible to replace the letters that I have detected with some other letters?

Create an Image either using Magick Wand or ImageMagick on Python 3

There's not enough information on Internet about imagemagick and magick wand on Python 3. I need to create a lot of images using Python 3, creating the images with a background color or a background image.
When I get the image with the background I want, then I need to add text with a font of my preference on It, I think I can solve the problem of the font, but how to add the "string" in the image?
After that, I want to save the image with a "name".
I have installed Magick wand and Image Magick on Python 3, but the documentation is in a language that I really don't understand. Do I need to install something else?
If you're able to help me, it would be great. Thank you!
You can achieve these using Wand.
Creating the images with a background color or a background image
Add text with a font
Save the image with a “name”

converting rgb image to gray image in vc++ using opencv

i created gui application in vc++2010 express, i loaded image folder to list box and by selecting listbox item the image is displaying in picturebox1, using browse button.
Now i want to access the picturebox1 image and convert to gray scale image and converted grey scale must be displayed in picturebox2, using grey convert button. plzz help me frnds
thanq
karuna
Get the image in opencv Mat. Then use cvtColor function to convert the image. CV_BGR2GRAY code is used to convert from RGB to grayscale. Then show the grayscale image back to wherever you want to display it.

Resources