java jni transfer coordinates from c to java [closed] - java

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
i will get straight to question. I have facedetection done in c with .dll libraries using jni. I send stream array from java to c. I am successful on getting coordinates of the face (4 points), how do I transfer those coordinates from C back to java? These coordinates are constantly updated, and I need to use those 4points to draw a rectangle in java around the face. At the moment in c I can only print out the points. I tryed writing themto .txt the reading in java from it but there is such a huge delay,so I abandoned this attempt.

With JNI you can:
Access Java fields from C.
Call Java methods from C.
If performance matters to you, you might want to have a data structure for these 4 points, pass a reference to that data structure to C, and in C update the fields of that data structure. (data structure = class that primarily holds data but doesn't offer a lot of operations)

Related

browsing through big amount of images with slider approach [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I have 1000 images, each of them signifies a state at the time step. I would like to create an application that allows us to use a slider move through time steps, eventually being able also to see some information about what is going on in the image (like region size ect). I created the algorithm which creates generates and analyzes images in Python and I guess I will try to create UI in Java. Any recommendations on how to approach it? ( I am not very proficient in Java but I understand the basics). I attached the general view of what I want it to be below:
Try Tkinter, it is a very easy to use UI creator in python.
https://docs.python.org/3/library/tkinter.html

passing structure from java to C code and vice versa using JNI [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I want to pass a structure from java to C code and return a structure from C to Java code using JNI. I haven't find something useful regarding structures and JNI on net.
Can someone please provide a simple code snippet for the same?
This is a very broad area and you need to do more research online ( it's ell covered out there ). However, briefly ...
If you simply want to keep a blob of data and pass it between java methods without changing it you can store it in a Java byte array.
You could also malloc() the struct on the C side and then pass Java a pointer ( stored ideally in a byte array for reasons I won;t go into ). Again, Java can't mess with the data, but can at least pass a reference to it around.
If you actually need a data structure on both sides that you can access by fields and change, then you need to create wrapper functions that convert between the two ( C struct and Java class ). One way to automate this is to use SWIG , which is a code generator that can generate JNI wrapper code for you from C include files.

read Java doubles from binary file into Python [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I have several matrices in Java that I would like to transfer to Python as efficiently as possible, without requiring anything but standard libraries on both the Java and Python sides.
Currently I serialize them to file using the writeDouble function to write the entries out one by one, and writeInt to write the dimensions of the matrices. Now I would like to read these matrices back into Python. I can get the integers using struct.unpack, but Java's serialization of doubles does not correspond to an algorithm that struct.unpack can implement.
How can I decode a Java double in the binary format that writeDouble uses? I have trouble even finding a specification for the encoding that writeDouble uses.
You're overengineering it; DataOutputStream.writeDouble() and related methods are for manually serializing a Java Object, so it can be re-read as a Java Object. If all you need is to transfer data, you can simply write them out as text (or bytes), then read them back in. Common formats are CSV, JSON, XML, and ProtoBuf.
If all you're doing is trying to transfer a list of doubles, you can even just write them out one per line, and read them right back in with Python.

how to implement a variable whose value is not lost after every run? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I wish to implement a variable (in Java) whose value is either stored somewhere or is not reset every time I run the program.
It's related to a "Booking reference Number" for a flight program. I know database connectivity but make a new data base for one variable is pretty pointless. Any ideas as to what I should/can do?
Also I don't want the numbers to be random I want them in order like if the first booking ID is 100 then the next one should be 101 and so on.
Organize your data in a structure and then serialize it.When you re-run your program, look for that serialized version in the file system, if there is any, read it. Viola.!
You should write the variable to a file and then read it from the file the next time you run the program.

The best way to implement a web based data browser? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
Here is my problem:
I have a bunch of 2D points in a data file on the web server, I would like to transfer the points from the server to the client browser and displayed on his browser. The user needs to have options to zoom(in/out), pan(drag) and select regions of the points on the 2d data canvas.
W.R.T. the scenario above, what is the best way to implement? Can I use javascript + ajax or use java applet? Can I improve the performance by transforming the data points into images and then do the image manipulation instead?
Thanks!
Shumin
I'd use HTML5 and canvas or just a good JavaScript graphing library.
Java applets are 1995 technology. Who cares about dancing teapots anymore?
There are lists of data visualization tools at http://datavisualization.ch/tools/ and https://en.wikipedia.org/wiki/Data_visualization . If you are interested in data visualization and charts, http://reddit.com/r/visualization, http://flowingdata.com/ , and http://visual.ly/ are great resources. Edward Tufte. http://dygraphs.com/ and http://square.github.com/cubism/ [ http://d3js.org/ ] look great. There are a lot of cool data visualizations listed in the D3JS Gallery: https://github.com/mbostock/d3/wiki/Gallery . For example, the http://mbostock.github.com/d3/talk/20111116/iris-splom.html example shows 2D data with extra categorical dimensions.

Categories

Resources