Skip to content

Add camera preview#81

Merged
Myzel394 merged 3 commits intoMyzel394:feat/0.5.0from
wueeh:master
Mar 23, 2024
Merged

Add camera preview#81
Myzel394 merged 3 commits intoMyzel394:feat/0.5.0from
wueeh:master

Conversation

@wueeh
Copy link
Copy Markdown
Contributor

@wueeh wueeh commented Feb 24, 2024

This pr adds camera preview for the selected facing camera.
Landscape ui for it needs some improvement, but this feature is good to go.

@wueeh
Copy link
Copy Markdown
Contributor Author

wueeh commented Feb 24, 2024

The controls could be drawn on top of the camera preview to improve uix

@Myzel394
Copy link
Copy Markdown
Owner

Looks good on first sight! Originally, I wanted to add both a preview plus a dark blurred background that would cover the whole background of the app. Do you know if this is possible, or would you even be down to implementing this? :D

@Myzel394
Copy link
Copy Markdown
Owner

oh and btw

Landscape ui for it needs some improvement

No worries, I'll take over the landscape part :)

@wueeh
Copy link
Copy Markdown
Contributor Author

wueeh commented Feb 26, 2024

Looks good on first sight! Originally, I wanted to add both a preview plus a dark blurred background that would cover the whole background of the app. Do you know if this is possible, or would you even be down to implementing this? :D

It is easily possible, although I was thinking of moving the preview entirely to the background, and just darken the areas which the controls and info cover, for contrast. Like OSD in video cameras. I'll draw a figma sketch and link it here to showcase.

@Myzel394
Copy link
Copy Markdown
Owner

It is easily possible

Is it? I'd love to see this implemented. :D When I tried working on this, I almost went crazy because I couldn't find out a proper way to do this. :C So if you know how to do this, I'd be very happy to include this in Alibi!

I was thinking about creating such a design:

image

@Myzel394
Copy link
Copy Markdown
Owner

Myzel394 commented Mar 4, 2024

Just tested it out, looks good! Can't believe I forgot to add the binding camera instance, otherwise this feature could have been available so much earlier! ^^ If we could blur the image, that would be the cherry on the top! Do you know how to do that?

@wueeh
Copy link
Copy Markdown
Contributor Author

wueeh commented Mar 4, 2024

I actually tried the compose way, but it doesn't work on the preview, the other way is to manipulate the video preview itself. But that comes with a performance cost.

@Myzel394
Copy link
Copy Markdown
Owner

Myzel394 commented Mar 4, 2024

I actually tried the compose way, but it doesn't work on the preview, the other way is to manipulate the video preview itself. But that comes with a performance cost.

That's also what I faced when I tried to implement this. Performance shouldn't be a big problem if we quickly blur it and even if, it's a blurred preview, so the most up-to-date image isn't that important :D

What I've found out about manually changing the preview is that this doesn't seem to be easily doable. Although I could be mistaken of course. If you know a relatively easy way to do so, please tell me so! :D If there's none / you don't know one, we'll fallback to a plain preview then

@wueeh
Copy link
Copy Markdown
Contributor Author

wueeh commented Mar 15, 2024

I was wrong, it's not that easy to blur the preview, there's 2 options to use off-the-shelf blurring library or to implement a fragment shader in opengl which having to go down to that level it's a good learning experience but it might take a while

@Myzel394 Myzel394 changed the base branch from master to feat/0.5.0 March 23, 2024 11:03
@Myzel394
Copy link
Copy Markdown
Owner

Myzel394 commented Mar 23, 2024

Okay so for now let's just add a fully visible preview. You can toggle between this preview and the current look. If you figure out how to blur the preview, feel free to open a PR. I'll also take a look again - though it really seems to be quite difficult :/

I'll take care of implementing the rest, thanks for your contribution! :)

@Myzel394 Myzel394 merged commit 2492866 into Myzel394:feat/0.5.0 Mar 23, 2024
@Myzel394
Copy link
Copy Markdown
Owner

Hey I got bad news: It looks like the video batches itself are completely empty (0 bytes) when using the camera preview :/ I have no idea why this is the case, I think CameraX is not really mature yet. Anyways, I'll remove the CameraPreview feature for now. I won't remove your code, I'll just remove the component out of the rendering. If you know how to fix that or why this is happening, I'd be happy to know :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants