Capture CameraX preview frame to Bitmap - image-capture

I am trying to have a workaround with Google's Camera API - CameraX, because older devices do not support multiple use cases (ImageCapture and VideoCapture).
So i want to take a picture capturing the preview frame and convert it to bitmap without using use cases ImageCapture or ImageAnalysis.

Related

Can I use an SVG image as an button icon?

Is this possible at all? I call Image.createSVG(...) and receive an Image object without any errors. I then call Button.setIcon(). But there's no icon on the button.
You need to check Image.isSVGSupported() which currently will always return false.
Back in the day J2ME supported SVG thru one of the JSR's. No platform since has supported SVG natively with the exception of the web so this doesn't work on any of the modern platforms and we didn't bother implementing this even for the JavaScript port.
In the future we'd like to have a more efficient/portable way of supporting SVG e.g.: https://github.com/codenameone/CodenameOne/issues/1890

How to display still 360 images in full screen like YouTube

I have to display 360 still images in my Android app. I want the exact same feature like YouTube's 360 video but for still images.
I am essentially lookin for the same functionality of full screen 360 and when clicked on cardboard button switch to cardboard view.
I want to use this in both modes as it will enable the user to choose whether to use the cardboard or not but still be able to move around and view everything.
I want the same features when you open YouTube 360 example
I started reading from getting started for cardboard sdk for Android from here. It talks about using opengl and functionality of selection and updating the UI dynamically using opengl. I don't need those features, I only need to display static 360 images.
Please point me in the right direction.
You can use VrPanoramaView
https://developers.google.com/vr/android/samples/vrview
For the fullscreen, use setDisplayMode
panoWidgetView.setDisplayMode(VrVideoView.DisplayMode.FULLSCREEN_STEREO);
It's really simple to load a panorama image using the cardboard SDK. You need to just include a VrPanoramaView like this in your layout
<com.google.vrtoolkit.cardboard.widgets.pano.VrPanoramaView
android:id="#+id/pano_view"
android:layout_margin="5dip"
android:layout_width="match_parent"
android:scrollbars="#null"
android:layout_height="250dip" />
Inside the Activity, the primary method is
VrPanoramaView.loadImageFromBitmap(). It is given a standard Android
Bitmap object and an optional VrPanoramaView.Options object. The
latter is used to configure the format of the image. The Activity also
implements a VrPanoramaEventListener which receives events when the
load operation succeeds or fails.
Quoted from the Getting Started here.

Can not assigned a bitmap object to QR code image returning from encoder

I installed Xamarin studio and trying to use System.Drawing frame work but it is not working. The reason I want this framework is to be able to define a Bitmap object. This bitmap object is assigned to a qr code image. Can anyone help me on how i can assigned an image to bitmap since i can not use bitmap in xamarin studio framework.
What i wanna do is as follows:
//create a qr code
QRCodeEncoder encoder = new QRCodeEncoder();
// Assign a bitmap image to the encoder since the encoder.encode returns bitmap image
Bitmap img = encoder.Encode("http://www.monkeywow.com");
// save the image in to images folder
img.save("www.monkeywow.com/images/imp.jpg", ImageFormat.jpg);
The problem is I can not use Bitmap img since i can not import System.Drawing into Xamarin.
I tried that and did not work. Since the encoder returns bitmap, i do not know how to obtain the image so i can save it where ever i want.
To display an image on screen, use UIImage. For working with low level bitmaps, use the CoreImage framework.
http://docs.xamarin.com/guides/ios/application_fundamentals/working_with_images/
http://docs.xamarin.com/recipes/ios/media/coreimage/
Xamarin.iOS includes a few System.Drawing types, e.g. Rectangle[F], Point[F] and Size[F], inside monotouch.dll to ease code sharing between (cross platform) projects.
However the System.Drawing.dll assembly itself is not part of the mobile profile that ships with Xamarin.iOS.
Like #Jason mentioned are several, native, ways you can do graphics on iOS (OpenGL would be another one).
Another option is to use the code from https://github.com/mono/sysdrawing-coregraphics which offers a partial System.Drawing API on top of CoreGraphics.

Can I Capture phone screenshot using j2me app?

I am trying to develop a wireless phone projector, wherein I will be showing phone screen on projector using a projector connected PC.
I am bit confused on how to capture screenshot of any running application in j2me.
Can you help?
Just want to capture screenshot in j2me
I'm not really sure of what you wanted to do but if you are thinking of a way for your app to get a screenshot of its screen then what I can say is that you can and cannot do it. Why you cannot do it? Say your using a canvas in creating your screen. I think there isn't a way of converting the Canvas to an Image. The Canvas is limited to just drawing itself on the phone screen. But, like what I have said earlier, you can also create a screenshot of your app screen. What you need to have is an Image object over your Canvas. Why Image? It is because the Image object can be converted to an image file. And the image file will be your screenshot. But, of course, there should be something that dynamically creates the image source for the image object on the canvas.
Image myScreen = Image.createImage(createScreen());
A method that creates the screen:
InputStream createScreen(){
//dynamically creates the source of the screen
}
You can have a screenshot using myScreen. The drawback here is that rendering is quite slow. This is possible but I think this is kind of difficult to implement.
With this snippet code you can take a "screenshot" of the Canvases in your app:
public Image getScreenShot() {
Image screenshot = Image.createImage(getWidth(), getHeight());
Graphics g = screenshot.getGraphics();
paint(g);
return Image.createImage(screenshot);
}
Add getScreenShot() to any canvas that you want "screenshot" of it.Then you can get it's RGB and convert to byte[] and pass it on the network.
References:
developer.nokia

Custom image size from flickr api?

is there a way how to get images from flickr api with custom width/height? I found only standard function flickr.photos.getSizes, but this functions returns only predefined sizes. Thank's
As far as I know it's not possible to have flickr resize the photos for you (except for the default options) Depending on the system you are building there are a couple of options:
use one of the flickr provided sizes ... ;-)
If you are using HTML: resize the image in the browser by setting the width and the height of the image (make sure you enable the right settings in IE for maximum viewing pleasure: http://code.flickr.com/blog/2008/11/12/on-ui-quality-the-little-things-client-side-image-resizing/)
If you are using flash resizing the image should not be a big issue
If you have a php or java (or any other language really) backend you can use that to scale the image.
Also: check http://www.flickr.com/groups/api and http://tech.groups.yahoo.com/group/yws-flickr/

Resources