Android - Make camera preview semi-transparent - android

I want to make my camera preview see through. I saw this following post:
how to make surfaceview transparent
About making a surface view transparent but the problem is that I am extending surface view for more control over the camera and they say that extending the surface view will make this solution invalid and don't explain why/propose another solution.
What can I do to achieve this?
EDIT:
Yes, I have tried what is in the Linked Post.
THIS IS WHAT I WANT TO ACHIEVE
TOP
=================================
SEMI-TRANSPARENT CAMERA PREVIEW
[FULLSCREEN]
=================================
IMAGES AND TEXT
=================================
BOTTOM

Place another view over your Preview view and make that view semi-transparent. To make view semi-transparent you have to give alpha value with color to the background
ex:
<View
android:background=#88000000/>

Related

Change camera preview shape in android

What I want to do is "simply" get the camera preview (which is already working) and then put it inside a roundish shape for example, so that instead of appearing on a rectangle shape it would appear, on a round one, for example in the top corner.This camera preview is inside a custom view. Also, there is another custom view that runs behind the camera preview, which is a video, as the image: (black -> camera preview, green -> video)
What I want is something like this:
Is this possible?
After searching a while for solutions to this problem I did not come to any conclusion that works.
Thanks in advance
try using corner radius of the shape. it can be useful

Use VRPanoramaView with camera view in background

Is it possible to set camera view as VRPanoramaView background (I use a transparent 360 degrees image) to use as simple augmented reality?
I achieved to set the VrPanoramaView background transparent and placed it in front of the camera preview. That worked. The problem is, that in a transparent panorama picture transparency is always shown black instead of transparent. A GVR collaborator told me today, that transparency is beyond the design of the widgets. So it seems there is no solution to your idea.

How to create a smooth transition with a view moving to overlay above an activity?

I'm investigating how the author of "inflickr"
https://play.google.com/store/apps/details?id=kr.infli
created the smooth transitions to bring his 'picture info' views above the picture itself. What method did the author use to create this effect?
Regarding Inflikr, there is only one activity involved.
The custom view (in black here) have a gesture detector and on a scroll up it will pull a details's view placed at the bottom (red frame).
The detail's view is transparent, when sliding up it increase alpha on a black shader on the custom view so the white text become readable even on a bright photo.
ps: rendered on device using scalpel
Thanks

Cropping the Android camera

I'm developing an Android app that uses ZBar as a QR code library, and things are going sweet. Now, however, I'm building the interface for the app, and it requires that I show only a certain portion of the camera's feed at the bottom of the screen, something like this:
The camera view below should be full-sized, i.e. a cropped view and not a resized one. However setting the width and height of the FrameLayout has caused it to resize and squash the entire image into the tiny frame.
Is there a way to crop it? I know I could probably place an overlay over the original image, but how does one create a transparent square in the middle to display what I need?Besides, the QR reader would catch anything the camera captures, so if the user brought the QR code in front of the camera and it captured it "off screen" (by the part that's actually covered by the overlay), it would be extremely confusing.
So I guess what I'm saying is, I can't use an overlay to "crop" the picture. Is there any other way to do it?
As far my knowledge one cannot crop camera view but what you can do is re-size the frame and then capture the image.
Still i would suggest to refer this post
The first thought that comes to mind is to put your CameraPreview in a view inside a FrameLayout. Then add more views on top of the CameraPreview view to hide the parts that you do not want to be visible.
Or Perhaps just one view super-imposing the camera preview view with a PNG which covers everything with "cropped" area set as transparent.

SurfaceView transparency problem

I have this problem: i added two view instances in a framelayout. First view is a VideoView which plays in loop a video. Second view is placed above the videoview and is a surfaceview. The surfaceview draws some .png's an a white rectangle which needs a small part of the screen. The part that is not needed must be transparent. in order to do that i used the next code lines (surfaceview implemnts SurfaceHolder.Callback):
setZOrderOnTop(true);
getHolder().setFormat(PixelFormat.Transparent);
The problem is that i want to make the white rectangle semitransparent in order to see the movie played by the videoview. The transparency effect works fine on the non used part of the surfaceview but the rectangle does not became semitransparent(if a i draw a background to surfaceview the effect becomes visible.) I wait a solution from u guys.Thx
Maybe the SurfaceHolder doesn't allow alpha. Have you checked the result of PixelFormat.formatHasAlpha()? Or have you tried explicitly setting PixelFormat.RGBA_4444, RGBA_5551 or RGBA_8888 to see what happens?
mVideoView.setZOrderOnTop( true );
getHolder().setFormat( PixelFormat.RGBA_8888 );
Worked for me.

Categories

Resources