0
0
Computer Visionml~10 mins

Text recognition pipeline in Computer Vision - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to load an image for text recognition.

Computer Vision
from PIL import Image
image = Image.open([1])
Drag options to blanks, or click blank then click option'
Aopen('text_image.jpg')
Btext_image.jpg
CImage('text_image.jpg')
D'text_image.jpg'
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting quotes around the filename.
Passing an Image object instead of a filename string.
2fill in blank
medium

Complete the code to convert the image to grayscale before text recognition.

Computer Vision
gray_image = image.convert([1])
Drag options to blanks, or click blank then click option'
A'CMYK'
B'RGBA'
C'L'
D'RGB'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'RGB' instead of 'L' for grayscale conversion.
Using modes that keep color channels.
3fill in blank
hard

Fix the error in the code to extract text from the image using pytesseract.

Computer Vision
import pytesseract
text = pytesseract.image_to_string([1])
Drag options to blanks, or click blank then click option'
Agray_image
Bimage_path
Cimage
Dopen('text_image.jpg')
Attempts:
3 left
💡 Hint
Common Mistakes
Passing a file path string instead of an image object.
Passing a file object instead of an image.
4fill in blank
hard

Fill both blanks to create a dictionary of word lengths for words longer than 3 characters.

Computer Vision
words = text.split()
lengths = {word: [1] for word in words if len(word) [2] 3}
Drag options to blanks, or click blank then click option'
Alen(word)
B>
C<
Dword
Attempts:
3 left
💡 Hint
Common Mistakes
Using word instead of len(word) for length.
Using '<' instead of '>' for filtering.
5fill in blank
hard

Fill all three blanks to create a dictionary of uppercase words and their lengths for words longer than 4 characters.

Computer Vision
words = text.split()
result = { [1]: [2] for w in words if len(w) [3] 4}
Drag options to blanks, or click blank then click option'
Aw.upper()
Blen(w)
C>
Dw
Attempts:
3 left
💡 Hint
Common Mistakes
Using w instead of w.upper() for keys.
Using '<' instead of '>' for filtering.