Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
np array tolist and back
#1
Hi everyone,

I am pretty new to Python and I am seeking some help and guidance.

I use OpenCV to grab frames from video cap:

ret, frame = self.cap.read()
frame.shape here is (480,640,3)

For subsequent processing, I need to serialize the value in order to pass it on to remote consumers:

data = np.fromstring(frame, np.uint8)
message = data.tolist()
On the other end, I am trying to reverse that:

frame = np.array(incoming_message, dtype=np.uint8)
cv2.imwrite('debug.jpg', frame)
but clearly, it is not the right way to do it.
How should I proceed to obtain the original nparray so that I can save it as an image?

Please, advise.

Thanks in advance!
Cheers,
G
Reply


Messages In This Thread
np array tolist and back - by anthares - Jun-13-2020, 06:17 AM
RE: np array tolist and back - by buran - Jun-13-2020, 06:47 AM
RE: np array tolist and back - by anthares - Jun-13-2020, 06:58 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  variable call back into an array yamifm0f 3 2,505 Jun-07-2019, 02:44 PM
Last Post: heiner55

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020