Understanding the Android Visualizer class - java

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)

Related

Combine Line and Scatter charts in JavaFX for multiple number of series

I have an app where the user is given plenty of options, and depending on user selection anything from 1 up to 20 scatter plots will be displayed dynamically in the same scatter chart.
I want to add a checkbox to show best fits for each of these samples, same color as the original scatter points, but then using lines.
Even though I like the answer provided here, it solves the problem "statically", i.e. for small and fix number of series.
Is there a way to automate this solution for a large and dynamically changing number of series?
I'd rather not use superimposed charts and setting transparency, unless I really have to.
As you pointed out about this here , if you want to create a Scatter chart with line regression ( linear or polynomial ) have a look to my own implementation of a Multi-Axis-Scatter-Chart maybe you will take some ideas about your problem. I am not sure about what you need cause do be honest I didn't understand your question at 100%. I hope my own implementation might help you somehow.

Convert image to sketch and then cartoonify?

My aim is to let the user take a selfie from my app and then apply different image processing algorithms to convert it in a cartoon type image. I followed the algo written here, and then also used the method written just below the chosen answer to convert black and white sketch to colored image that should look like cartoon. Every thing is ok except that after applying Gaussian Blur , the image becomes too hazy and unclear. Here is the image output:
Any advice how I can make it more clear? Like shown in this link. I know they used Photoshop , but I want to achieve it with Java and Android.
PS: I found all the image processing methods from here. Plus the method mentioned here (the one below the chosen answer), what could be the ideal values in the arguments?
cartoonifying image
If you have a basic knowledge of C++, you can port this app for your need.
This application works real time. If you want to non-real time,than you can use bilateral filter against two medianBlurs at the bottom of function. That will give better results, but bad performance. But you need to use OpenCV in your application. If you want to make application with more functions, I will suggest you to do it.

Java Bot get values from window/screen

ok this is my first time ever posting. Sorry if i am not specific enough.
i am trying to make a bot using java coding, using eclipse. the game i am playing(dark summoner) does not have status bars but, fractions such as 23/47 energy 240/300 battle points. i can't find a way to get the values from the top or the screen into my code. also to make this easier i thought i could get my code to focus on the window opened with the game in it, and can not find a way to do that.
the idea behind the bot so far is to have it attack when i reach enough battle points. when this is achieved i plan on making it usable on any or most energy based games like mafia wars age of baymont millions to list
so in short my question is how do i get values from a specific area of an image, to my code using java
oh yeah i am a noob
You cannot get the number from the image, but you can assign number to the image. After displaying proper image, you will know what number is connected with it. Divide whole number into digits and display each digit alone, composing the whole number.
If the only aim of the application is to get text from a image, you can think about image processing and some algorithms, but it time consuming.

Creating a horizontal histogram in java

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.

What's the best way to analyse the colours in an image (Java)?

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.

Categories