0
0
Computer Visionml~10 mins

Image properties (shape, dtype, size) 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 get the shape of the image array.

Computer Vision
image_shape = image.[1]
Drag options to blanks, or click blank then click option'
Adtype
Bshape
Csize
Dlen
Attempts:
3 left
💡 Hint
Common Mistakes
Using dtype instead of shape, which gives data type not dimensions.
Using size, which gives total number of elements, not the shape.
2fill in blank
medium

Complete the code to find the data type of the image pixels.

Computer Vision
image_type = image.[1]
Drag options to blanks, or click blank then click option'
Ashape
Bsize
Cdtype
Dtype
Attempts:
3 left
💡 Hint
Common Mistakes
Using shape instead of dtype, which gives dimensions not data type.
Using type(), which returns the Python type of the object, not the array data type.
3fill in blank
hard

Fix the error in the code to get the total number of pixels in the image.

Computer Vision
total_pixels = image.[1]
Drag options to blanks, or click blank then click option'
Asize
Bshape
Cdtype
Dlen
Attempts:
3 left
💡 Hint
Common Mistakes
Using shape, which returns a tuple of dimensions, not a single number.
Using len, which only returns the size of the first dimension.
4fill in blank
hard

Fill both blanks to create a dictionary with image shape and data type.

Computer Vision
image_info = {'shape': image.[1], 'dtype': image.[2]
Drag options to blanks, or click blank then click option'
Ashape
Bdtype
Csize
Dtype
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping shape and dtype properties.
Using size or type instead of dtype.
5fill in blank
hard

Fill all three blanks to create a summary string with image shape, data type, and total pixels.

Computer Vision
summary = f"Shape: {image.[1], Type: {image.[2], Pixels: {image.[3]"
Drag options to blanks, or click blank then click option'
Ashape
Bdtype
Csize
Dtype
Attempts:
3 left
💡 Hint
Common Mistakes
Using type() instead of dtype.
Mixing up size and shape.