Read a dng file as a 2d array of pixels in android - android

I have a DNG file that my camera2 application generates. I want to read that file as a part of another android application and process the values at a pixel level. I haven't found a way to read the same. Are there any approaches I can use?

There's no built-in API in Android to read in full-resolution DNG files (As of Android N, you can read in DNG thumbnails via some new APIs).
Your primary options are to use Adobe's DNG SDK, or use one of the open-source libraries such as libraw. I don't know if any of these have a Java interface.

Related

What's the correct way to use JSON files in a library?

I am currently creating an android library that uses json commands for communication with another library. I would like to extract these commands from code and save them in separate files for better readability.
Where do I save those files when there is no asset directory and how do I read them?
Edit: I have found an answer to my question:
how to access resources in a android library project
Have a look at Internal Storage. The files saved here are only available to your app. It uses the Java File API to read an write using the FileInputStream and FileOutputStream
UPDATE:
As per the discussion in the comments, OP was looking for a method to ship a JSON file with the library. In light of that:
I'm not sure if library modules support raw resources. If they do, you might want to use that but it will increase the size significantly. You could also fetch the file from a server the first time you're the library is used, keeping track of that using a SharedPreference entry.

Unity3D Android - Download assets from an API and import on device?

Questions are first then some description which helps explain the questions:
Questions:
Will Unity be able to easily import downloaded assets from our API if we save them in a specified directory with our core Android app?
Can we pre-serialize the 3d model assets before uploading them to our API so that they do not need to be serialized by Unity on device? This is so that they load faster
Description
I'm not a Unity/3D developer or an Android developer so apologies if this question doesn't meet community guidelines (I built the API in this scenario). This is also probably very long for what should be simple questions.
We've built an API which serves 3D model files in Collada 1.4 (.dae) format to iOS and Android client applications. File sizes can be quite large (upwards of 80-90mb in some instances) although the majority are in the 4-15mb region.
On iOS we've been having the application download the models from the API and then render them onto the screen via SceneKit which has been relatively simple to achieve. We put the Collada files through a preprocessing step before serving them which converts them into a proprietary format used by SceneKit.
In Android we've encountered any number of problems. We initially experimented with converting models to OBJ instead of Collada and using Rajawali, jPCT and a few other loaders for Open GL ES2.0 but due to our file sizes the time to read and load the models was far too long. We've now decided Unity is probably where we need to go on Android as a rendering engine.
The Android app will consist of two parts, a core app which has an interface for viewing images of the models and downloading the model files and a Unity app which is loaded via an activity from the core Android app to actually render the models.

Read & write shapefiles in android or java (.shp)

Read & Write shapefiles in android or java
How can i read and write shapefiles in Android or java?
.shp .shx and etc
i much searched but nothing
I want read file and edit information and write in same file or new file.
This is important i can write to file. i can read file but this isn't my problem
Thanks
Take Gdal for Android for a try.
Gdal
A translator library for raster and vector geospatial data formats that is released under an X/MIT style Open Source license by the Open Source Geospatial Foundation. As a library, it presents a single raster abstract data model and single vector abstract data model to the calling application for all supported formats. It also comes with a variety of useful command line utilities for data translation and processing. The NEWS page describes the January 2017 GDAL/OGR 2.1.3 release.
Read/Write API Tutorial
Building for Android on Linux
Either, Google for pre-compiled package

The size of Graph file(.pb) from Tensorflow is too large for android Usage, how to reduce it?

I try to build a network implementing the Yolo Object detection using tensorflow, and I want it could be used on Android. After building the structure, I use the tf.train.write_graph to get the graph file and want to replace the original file in android demo.
But the pb file is too large (1.1G) which is not usable on Android. So, how could I reduce the size?
I would suggest you to first try quantizing your graph, for that you'll only need an official TensorFlow script. Here's a great tutorial by Pete Warden:
https://petewarden.com/2016/05/03/how-to-quantize-neural-networks-with-tensorflow/
In theory if you used 32 bit floats your model is going to end up ~4 times (~250Mb) smaller since the values in the graph will be converted to 8 bit integers (For inference it has no significant effect on the performance). Note that this comes into play when you compress the Protocol Buffer file.

pbf files in android application

I'm developing an offline routing application for android.
I'm working with osmdroid library. and I downloaded the pbf file for the region where I want to do the offline navigation but I'm not sure how to be able to convert the binary representation of the maps in the pbf files into a normal text.
You don't have to use the PBF format, at the moment the OSM XML format is still widely in use. But if you do, then you will probably have to implement a PBF reader for Android. See osmosis which serves as the reference implementation for PBF and can also convert between those two file formats.
You can take a look at the Android page in the OSM wiki where lots of OSM-related Android application are listed. Maybe there is already an Android application supporting PBF. But most of them will just display tiles and the rather popular OsmAnd uses its own file format instead.
Note that PBF has various advantages compared to XML. It is smaller and it is faster to read and write than compressed XML. It also supports random access which can become very handy for a routing engine.

Categories

Resources