You need to reshape numpy array to (height X width X numberOfChannels):
import cv2
import numpy as np
chunk = PhotoScan.app.document.chunk
camera = chunk.cameras[0]
image = camera.photo.image()
img = np.fromstring(image.tostring(), dtype=np.uint8)
assert (len(img) == image.height * image.width * image.cn)
img = img.reshape(image.height, image.width, image.cn)
# Please, note that OpenCV assume that image is BGR, while PhotoScan provides RGB, you can fix this with numpy:
# img = img[:, :, ::-1]
# Or with OpenCV:
# img = cv2.cvtColor(img, cv2.COLOR_RGB2BGR)
# You can show image in window with OpenCV:
# cv2.imshow("window with img", img)
# cv2.destroyWindow("window with img")