I have the following image from which I need to extract the text.
The text that needs to be extracted is the following as shown in the following image
I have tried the following code to extract the text but surprisingly tesseract using the following code but I am unable to get full text as it is unable to detect the header and other text areas
import pytesseract
import matplotlib.pyplot as plt
from PIL import Image
import numpy as np
pytesseract.pytesseract.tesseract_cmd = r'C:Program FilesTesseract-OCRtesseract.exe'
img = Image.open(r"C:UsersAsad MajeedDownloadstest_examplestest_examplescard_fusion.jpeg")
# read text
text = pytesseract.image_to_string(img, config='--psm 6')
plt.imshow(img, cmap='gray')
plt.axis('off')
plt.show()
print(text)
Output:
Ss Bi Bigg ccna im oT ri DARK : Bs
<( fis Fag Su
Ao. ¥ MLNS cANN SoM : F
i Lg p g AY % Rae een 0
ies OS aN SF S ie : SRA S aa
Ly = See et
qk : 2 : oes
os avagieeesae 3: ae es
[MACHINE/ FUSION / EFFECT] j ES oe ie
5 “Cyberdark” Effect Monsters Soe SHE Geers
Must first be Fusion Summoned. If this card is Special Summoned: You can GSgesnk
equip 1 Dragon or Machine monster from your GY to this card. Gains ATK equal ‘ Gok
to the original ATK of the monster equipped to it by this effect. When your sp tae ya eee ea eae
| Opponent activates a card or effect (Quick Effect): You can send 1 Equip Card we eee
| you control to the GY; negate the activation, and if you do, destroy that card. - ee ea
4 ATK/2000 DEF/2000) Sty pence Sn S80
How to fix and detect the text from the region of interest?