Skip to content
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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

sguequierre
Copy link
Collaborator

  • tested and confirmed with rand that decoded function is what we want to use for the vision service samples

@viambot viambot added the safe to build This pull request is marked safe to build from a trusted zone label Jan 15, 2025
Copy link

netlify bot commented Jan 15, 2025

Deploy Preview for viam-docs ready!

Name Link
🔨 Latest commit c58e519
🔍 Latest deploy log https://app.netlify.com/sites/viam-docs/deploys/678ac57b9bc62c000727e820
😎 Deploy Preview https://deploy-preview-3854--viam-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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.
Copy link
Collaborator Author

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

Copy link
Collaborator

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?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added!

Copy link
Collaborator

@JessamyT JessamyT left a 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.
Copy link
Collaborator

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.
Copy link
Collaborator

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?

@viambot
Copy link
Member

viambot commented Jan 17, 2025

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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think?

Suggested change
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:
Copy link
Collaborator

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
safe to build This pull request is marked safe to build from a trusted zone
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants