How can I use transparent webm for Android? - android

I am trying to use some video resources. And I wanna get rid of the background and change the color as I want.
I used VideoView for easy implementation. However, it gave black background. I don't want that. So, I am trying to use TextureVideoView.
implementation 'com.sprylab.android.texturevideoview:texturevideoview:1.2.1'
However, when I play the webm files, it seems it's not transparency.
What's the reason???
It's weird because I also exported and played a few clips to Webm with alpha channel. And it gives white or broken color background. (VideoView also gives gray background like this.)
Source Video:
https://simpl.info/videoalpha/video/dancer1.webm,
https://simpl.info/videoalpha/video/soccer1.webm
(It's totally fine here: https://simpl.info/videoalpha/)

Related

How to import png without background android studio

I want to be able to use external images in my android app,but i don't know how to deal with them,in the best case scenario they have a grey background:
How do i remove the grey background or any background to have a clean icon like the clip art that already exists in android studio(I already tried with apps and it's still drawing the background)
Please make sure the image is .svg vector and not png and follow this to import. stackoverflow.com/a/67056210/7093155
I think the problem with the png you are using is that the background is not entirely transparent. If you are certain it is, then setting the background with android:background="#android:color/transparent"

Unity VideoPlayer not rendering Video correctly to Texture

I'm trying to use a VideoPlayer component, with a URL source and a RenderTexture as the target, to show a video in my Unity mobile game. The video is loaded and starts playing, however the resulting texture is only 1 color. The color does change every frame to something matching what the video would look like that frame, but it's just the 1 color. Audio is working fine. On the VideoPlayer component, the Aspect Ratio is set to "Fit Inside", but I have tried all options here with the same result. As for the RenderTexture, it's set to the same resolution as the input video, and the Color Format is set to RGB565 (which both Android and iOS should support according to SystemInfo.SupportRenderTextureFormat()). I'm all out of ideas, any help would be appreciated.
EDIT: A workaround could be using "material override" instead of rendering to a texture. This doesn't work though if you want to use the texture specifically instead of only showing the video on a material, plus the fact that Material Override doesn't support objects with multiple renderers/materials. Not really a fix, but a workaround for those who find this question before a solution has been found.
I just had this myself and fixed it.
In the Raw Image, search UV Rect and set its W and H to 1. I had changed that, which made it only sample 1 pixel.

Android RenderScript to blur video in VideoView

I know that I can use RenderScript on Android to blur images, but does anybody know if I can apply the same to video views so that my complete video is gaussian blurred?
VideoView, which extends SurfaceView, does not utilize the drawing cache due to being hardware accelerated. This means you won't be able to get stills. I was forced to scrap the design I had using the paused video still.
Check out: VideoView getDrawingCache is returning black
Edit: As I look into this more, there might be a way through https://github.com/google/grafika, but I haven't seen anyone verify it as a performant workaround.
You should use a thumbnail of the video in front of it. You can then, blur the image using this lib: https://github.com/jrvansuita/GaussianBlur

image noise reduction in android

I've written a camera app which allow users to capture image of paper bills, send to server where it'll be printed.
Problem:
when I print the image, the background is blackish due to noise in captured image. All I want is a clean white background. I've tried Bitmap's compress method to save the image in JPEG/PNG format on different scales (1-100) but not much helpful. I've seen camscanner app doing this fantastically but have no clue how.
Any pointer to achieve this will be helpful.
thanks.
If the issue is some random noise, there are some noise removing filters out there you can use (i.e. median filter or a bilateral filter).
Is the image already binarized (converted to strictly black and white pixels)? You'd want to do the filtering before this.
EDIT(after clarification on dark gray): Since the background is a dark gray I'm guessing the problem is just that it is a low contrast and since it will be a natural image, there will be variation on how bad the contrast is. I suggest using Sauvola binarization for this which will separate out the black and the dark gray to black and white. Here is some detail and example results of Sauvola: http://www.leptonica.com/binarization.html. To run some tests to see which binarization algorithm would be best you can find a library here
Changing compress ratio cannot give any help to this question. A strong filter will help you reduce the noise.
Try to have a look at this Link

A basic animation question

I want to have a cartoonish stork fly across my screen (slowly flapping his wings) and land on a post. I have an artist that can draw it for me and said it could be a gif file. I'm guessing that means it would be like a cartoon movie. Is this easy to put in my app or do I need to do something entirely different? My only experience with any graphics in android is displaying a picture using ImageView.
Thanks for any help.
Android does not deal with animated GIFs well. You apparently can play one back using VideoView, but I have not tried that. You can also set up an AnimationDrawable resource (an XML container for the frames of your animation).
This seems to do what you want:
http://www.androlib.com/android.application.com-ideal-imageviewer-EzCz.aspx

Categories

Resources