-
Notifications
You must be signed in to change notification settings - Fork 64
RSDK-3050 - Add get_images #358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Warning your change may break code samples. If your change modifies any of the following functions please contact @viamrobotics/fleet-management. Thanks!
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default encoding of PIL images to JPEG makes sense, just two things:
- need to add the viam raw depth format "image/vnd.viam.dep" to the python ENUM so that it can be matched to the format of FORMAT_RAW_DEPTH.
source_name
needs to be added to the server and client for each of the the returned images in the list
Returns: | ||
Tuple[List[Union[Image, RawImage]], datetime]: | ||
- List[Union[Image, RawImage]]: | ||
The list of images returned from the camera system. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is missing the "source_name" associated with the image, which is a string stating the sensor's name that produced the image
request = GetImagesRequest(name=self.name) | ||
response: GetImagesResponse = await self.client.GetImages(request, timeout=timeout) | ||
imgs = [] | ||
for img_data in response.images: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you'll need to store the returned name of the source somewhere
mimetype, _ = CameraMimeType.from_lazy(img.mime_type) | ||
fmt = mimetype.to_proto() | ||
img_bytes = mimetype.encode_image(img) | ||
img_bytes_lst.append(Image(source_name=name, format=fmt, image=img_bytes)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the source_name might not be the camera name- it should be whatever string the server associated with the image.
src/viam/media/video.py
Outdated
Format.FORMAT_RAW_RGBA: CameraMimeType.VIAM_RGBA, | ||
Format.FORMAT_JPEG: CameraMimeType.JPEG, | ||
Format.FORMAT_PNG: CameraMimeType.PNG, | ||
Format.FORMAT_RAW_DEPTH: CameraMimeType.PCD, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FORMAT_RAW_DEPTH is actually the MIME type "image/vnd.viam.dep", it is not the PCD format "pointcloud/pcd".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
I added 2 new types:
Because switching to
I also changed the return type of the NB. I accidentally sorted all the imports in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
generally looks good, but a questions for bijan
…9587244c71e044d54b004be2d9c77
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work with the lazy encoding/decoding, makes it easier to deal with all of the different kinds of file types we have, and makes for faster transfer
can't approve but LGTM too, if tests with the intel realsense pass |
On server side, tries to encode all PIL images to jpgs, was that what you were suggesting? @bhaney
otherwise pretty similar to get_image