I would like to do a vuforia android application including some image processing operations.
I can do what I want by showing processed current image in ImageView. But it is too slow. I have tried to resize current image but it is not good like showing image in GLSurfaceView.
So, I thought that if I do manipulation on current image then show it in GLSurfaceView, it will be faster.
I wonder that if it is possible. If so, how can I do this? Could someone help me about this problem? Thanks in advance.
Related
I am using kmagick for resizing gif images in android. It works fine for static but gives incorretc output for gif or animated webp files.
Magick.initialize().use {
val wand = MagickWand()
// getting image
wand.readImage(src)
// resizing image
wand.resizeImage(512,512,FilterType.UndefinedFilter)
// Saving image
wand.writeImage(dst)
promise.resolve("Done at ${dst}")
}
Input: (animated gif having multiple frames)
Output: I think its single frame and that also messed up but resizes according to input for height width.
Whats happening here. How to fix it?
Just want to reference for future, this was already answered in
https://github.com/cherryleafroad/kmagick/issues/3#issuecomment-1068044815
Anyways, to sum up what's going on,
Gifs are able to save the difference between frames to save space.
It's due to the way gif images work. Because the cli uses the api in a certain way, and kmagick bindings are only direct bindings to the c api, if you want to achieve the same results that the cli does, you have to use the api in the same way. (kmagick isn't doing anything to the image, it's imagemagick that's doing it; so it's more relevant to check imagemagick api docs / ask them so you can do it in the same way and get the same results).
I'm not sure what imagemagick api they're using off the top of my head however to achieve those results, but I think that doing something like extracting each frame individually then resizing them one by one would solve it.
i am a beginner on android.
My question is simple, i need to capture a video frame from my device but i need to capture just a part of the entire camera view. For example, if my camera view display my frame on the entire screen i need to cut half frame to display.
I did this with opencv through image processing (image cropping) but i wanna know if this is possible also specifing the layout parameters. I need know if this is possible because i working with a video frame not with simple image and i need to ease the entire processing.
Thank you for all advices.
I want to make a small part of the image glow whenever the activity is loaded. Do I need to take the exact coordinates of the image part?
I recommend using a GIF. It can be loaded as an image and won't require any changes in your code. A smallish tutorial can be found in this Youtube video.
i am using SurfaceView for play video and i want to get image from running video, i have tried with getDrawingCache() but i am getting blank image or Black screen but when i draw image of any other layout which dont have video then this is working fine,
so please anybody can solve this issue that How to get bitmap images from video or surfaceView. Thanks in advance please answer my question if you know.
I have used this code but not getting result.
mVideo.setDrawingCacheEnabled(true);
mVideo.buildDrawingCache();
Bitmap b = mVideo.getDrawingCache();
This won't work because the video content is not "exposed" to the normal view layers.
If you are using API Level >= 10 you can use MediaMetadataRetriever getFrameAtTime. It's described here.
Even this may not return the exact frame as it is fairly hardware dependent.
The most sure way to do this is to use something like FFMPEG to access the stream yourself.
so im trying to make a game with just a simple static background at the moment, but when i draw it to the screen (no scaling being done as the resolution of the image is the same as the screen) it draws the bottom portion of the image incorrectly where the bottom few hundred pixels of the image are exactly the same going down the image. Sorry it's so difficult to explain but being new here i cant actually post an image of what is going wrong.
Now im just using a simple sprite to render this background image. Here is the code being used:
// background layer: another image
background = CCSprite.sprite("WaterBackground.png");
// change the transform anchor point (optional)
background.setPosition(CGPoint.make(GAME_WIDTH/2, GAME_HEIGHT/2));
addChild(background);
am i doing something wrong here? Does Cocos2D not support such large images for sprites? (resolution of 800*1280)
Any help would be greatly appreciated!
Since i am now able to upload images, here are visuals of what is going wrong:
And the problem in my game:
As you can see, the problem is hard to describe. The problem only exists with this larger image; i scaled it down manually in GIMP and then scaled it up for the game and it looked fine (except for being a lower resolution). I also tried scaling down this larger image which still resulted in the same problem. Hopefully you guys can help me as I have no clue what could possibly cause this error. Especially since i read that Cocos2D's max supported image size is 2048*2048 and my image is well within that.
Thanks for any help you guys can provide!
This is due to limitations on the size of textures. Coсos2d-android supports images with a maximum size of 1024 x 1024 pixels.
I faced the same problem and looking for a way to solve it.
EDIT
I found the solution
In cocos2d project open file CCTexture2d.java in org.cocos2d.opengl package and change kMaxTextureSize from 1024 to 2048
I'm not certain, as from your code and looking at the cocos2d code I can't see a definite reason why this would be happening, but given the number of sprites you've got on the screen, i'd definitely take a look at my answer to this question as you may well be hitting one of cocos2d's quirky little rendering faults around multiple sprites. can't hurt to try spritesheets, and it's certainly the correct way to actually do sprites in cocos.
also, definitely create yourself a helper utility to determine the scaling ratio of a device compared to your original image sizes, as unlike on iphone, android does have a pretty much unlimited variation of screen resolutions, and a simple bit of "scale as you load" utility code now will save you lots of time in the future if you want to use this on any other device.
you should try to make one method for adding background,i am doing this this like this way try this hope it will help full for you...here addBackGroundScene is my method and i am adding my background with this method,scrXScaleFactor is maintaining scaling part of my screen try this...
private void addBackGroundScene() {
CCSprite bgForLevel1 = addBackgroundAtOrigin("prelevel1/bgMenu.jpg");
bgForLevel1 .setScaleX(scrXScaleFactor);
bgForLevel1 .setAnchorPoint(0, 0);
addChild(bgForLevel1 );
}