Detect the width and height of images in a stream