Skip to content

Received image by base64 can not be decode by opencv #115

Description

@Wangxinhui-bot

Description

I send an image at 640480 from ros, then recieved the image using code from roslibpy tutorial, though I successfully decode the data into numpy array with size 921600(which is 640480*3), I used opencv to decode and get none return.
To Reproduce
My callback function is

def receive_image(msg):
# log.info('Received image seq=%d', msg['header']['seq'])
base64_bytes = msg['data'].encode('ascii')
image_data = base64.b64decode(base64_bytes)
img_array = np.fromstring(image_data, np.uint8)
img = cv2.imdecode(img_array, cv2.COLOR_RGB2BGR)
cv2.imshow('image', img)
cv2.waitKey(0)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions