So I have a data file with points to make a histogram. I have no idea how I would do this. I in a first year java course and am supposed to make 'bins' and count how many of each point fall into each bin. Thanks
I'm unclear what your real objective is. Do you have to write a graphical histogram, or a text-based histogram (easy for a horizontal histogram), or make use of an existing library.
You can use the open-source JFreechart to create a histogram.
Related
I have a table with the following structure:
[relation, variable1, variable2]
I would like to visualize those relation over a triangular matrix, something like this but with any number of variables and not only 4. Is there any free java library to do so? any ideas on how to visualize it by my own?
I don't have any code yet, Just thinking about the idea and process of how doing it.
much appreciation to all :)
I suggest you use a Swing framework that is natively provided by Java so you don't have to import any external library for this task.
I think painting this matrix (as in your link) is not difficult using Swing.
I find this discussion very useful for your case How to draw grid using swing class Java and detect mouse position when click and drag
Because it provides an example of painting a matrix.
I'm new to Android development (though I know a decent amount of java) and I'm trying to make a very simple plugin that can pass some variables to tasker. The end goal is that I want to use them for a sort of bar visualizer for music in klwp. I want to use the Visualizer class for this, but I am having trouble making heads or tails of how to use it by looking at the official documentation and various questions on here and some example code.
Say the bar visualizer, like in the link above, has 64 bars. Essentially all I want to do is get an array of 64 integers with a relative value of say 1-100 based on the FFT data? of the playing audio and then update them a few times a second. So for example, cut the frequency band into 64 "slices" and then take the average intensity of each one to get essentially the height of the corresponding bar on the visualizer. I don't even need to draw them in java, I just need the integers.
I don't know if I am going about it all wrong but I am having serious trouble figuring out how to implement that using Visualizer, I was wondering if someone could give me an example of how to implement it or explain how I would go about it.
Thanks!
You can use these third party library for audio visualization:
1)https://android-arsenal.com/details/1/4892 ( SIRIWaveView)
2)https://android-arsenal.com/details/1/4622 (Audiogarm)
i'm currently working on a personal project and i need to save short ints in a tridimensional array (cube) that allows me to "rotate" the cube and change its orientation (of course i just mean the values inside the matrix). Also i would need to make displacements (translations) of all the values towards one of the axis. Is there a premade way to do this? If it's a java or as3 solution approach it would be nice since i feel more comfortable on one of those technologies.
Thank you in advance for your time!
There is a Vector3D and Matrix3D classes in AS3. Use what you need :)
I'm currently trying to think of a way to plot a graph in Java.
The basic way my program is meant to work is it finds a users .csv file and in there will be some sort of habit and the date. So like drove 5 miles on 24.10.13.
So I need to be able to extract the 5 and the 24.10.13 and take those as my Y and X co-ordinates respectively as other things are measured against date and it makes sense to have that as the X value.
So is there a library I can import or a Function I'm not aware of and could you give a simple example on how to use it?
NOTE - I've done my GUI in JavaFX as I'm not that great in JFrame and I know nothing of Swing
JavaFX has built-in charts. You may check it out. That way, you won't need any external libraries.
How about using JFreeChart to plot your data? You can see some samples here. JGraph seems to be geared towards visualizing graphs, not for plotting functions.
I don't have much experience doing image analysis so I thought I'd ask more enlightened individuals :)
Basically what I want to do is analyse an image and work out what the most common colours are (these will be averages obviously).
Does anybody know of an effective way to do this? If at all possible I'd like to avoid using any third party libraries, but everything will be considered at least.
Like I said, I don't have much experience with image analysis so please be patient with me if I don't understand your answers properly!
I've tried Google but there doesn't seem to be anything resembling what I'm after. Maybe my Google-Fu just isn't good enough today.
I'd really appreciate any pointers you guys could give!
Thanks,
Tom
A rough idea of how you might be able to do this:
You could use java.awt.image.PixelGrabber to grab a 2D array of RGB ints from the image, pixel by pixel.
When you have this array populated, you can go through and sort however you want (sounds like it would be memory-intensive), and perform simple functions to order them, count them, etc.
Then you could look at java.awt.Color and, using the Color(int, int, int) constructor, create boxes with those colors (as visual placeholders) with the number of occurrences appearing below it.
To get the hex values for the color, you can use a String like so:
String rgb = Integer.toHexString(color.getRGB());
rgb = rgb.substring(2, rgb.length());
(substring is necessary, otherwise you'd get 8 characters)
Hopefully this gets you on the right track!
Resources: Color Class, Image Class
Consider a "color cube" with RGB instead of XYZ. Split the cube into subcubes, but make them all overlap. Ensure they are all the same size. An easy to remember/calculate cube-pattern would be one that goes from 0-127, 64-191, 128-255 in all directions, making for a total of 27 cubes. For each cube, find what colors in the image fall into them.
As you make the cubes smaller and smaller, the results will change less and less and begin to converge on the most popular color ranges. Once you have that convergence, take the average of the range to get the "actual color".
That's about as much detail as I can go into with my boss hovering around the cubefarm :-)
I know your trying to avoid third party libraries, but do take a look at OpenCV. They have some good stuff w.r.t image manipulation and analysis. Maybe that can work for you.