-
Notifications
You must be signed in to change notification settings - Fork 45
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
DOCS-3196: Update Camera interface for Go Image function and remove Stream/Next #3854
base: main
Are you sure you want to change the base?
DOCS-3196: Update Camera interface for Go Image function and remove Stream/Next #3854
Conversation
sguequierre
commented
Jan 15, 2025
- tested and confirmed with rand that decoded function is what we want to use for the vision service samples
✅ Deploy Preview for viam-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
``` | ||
|
||
If you use this method, be sure to import `"go.viam.com/rdk/utils"` at the beginning of your file. |
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 tripped me up when testing-- imported wrong utils-- so wanted to specify
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. Does this need to be added to an override in order to stay here in the future?
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.
added!
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.
LGTM % comment/question
**Parameters:** | ||
|
||
- `ctx` [(Context)](https://pkg.go.dev/context#Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries. | ||
- `errHandlers` [(...gostream.ErrorHandler)](https://pkg.go.dev/go.viam.com/rdk/gostream#ErrorHandler): A handler for errors allowing for logic based on consecutively retrieved errors. | ||
- `mimeType` [(string)](https://pkg.go.dev/builtin#string): The desired mime type of the image. This does not guarantee output type. |
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.
[nit/oopt] if you care to, update "MIME" upstream to be capitalized, here and elsewhere
``` | ||
|
||
If you use this method, be sure to import `"go.viam.com/rdk/utils"` at the beginning of your file. |
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. Does this need to be added to an override in order to stay here in the future?
You can view a rendered version of the docs from this PR at https://docs-test.viam.dev/3854 |
img, err = camera.DecodeImageFromCamera(context.Background(), utils.MimeTypeJPEG, nil, myCamera) | ||
``` | ||
|
||
If you use this method, be sure to import `"go.viam.com/rdk/utils"` at the beginning of your file. |
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.
I think?
If you use this method, be sure to import `"go.viam.com/rdk/utils"` at the beginning of your file. | |
To use either method, be sure to import `"go.viam.com/rdk/utils"` at the beginning of your file. |
@@ -0,0 +1,8 @@ | |||
You can also directly decode as an `Image.Image` with the camera's `DecodeImageFromCamera` function: |
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.
I just looked at the linked Go SDK doc to see if there was more about why someone would do one versus the other and noticed it says "Or try to directly decode as an image.Image:" The word "try" makes me wonder if there's a reason the DecodeImageFromCamera method would be more likely to fail than the other method. Is there?