Java BufferedImage: one image or many? [closed] - java

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 8 years ago.
Improve this question
I'm working on a game, and I am using various tilesets. Suppose for example that my tileset is 25x25 (meaning each image is 25px wide by 25px high), and I have 16 images. I can either use one 100x100 image and use the BufferedImage#getSubimage method, or I can create 16 25x25 .png files. The first answer would save on time since I wouldn't need to create the 16 files required, but the second method would be clearer since I can name each of my files something obvious.
I'm mostly worried about performance; is it better to keep several small images in memory, or one large file?
Has anyone tried both methods? If so, which did you find worked best?

People generally go with spritesheets/tilesets as this cuts down on size and it's not really much a performance hit to just grab the image you need based on its position and size. For a 2D game with pixel graphics, performance isn't generally much of a concern anyway.

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

How to find the path in a floor plan image using java? Help me on how to implement diijistrak or A star algorithm for this [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 6 years ago.
Improve this question
I am new to the image processing discipline, currently I am working on an activity to find the path in a given floor plan image using java. I could understand & implement a plain Dijkstra or A star algorithm in java to find the shortest path between nodes that can work on hard coded values for nodes & edges. But I have no idea on how to do the same with image file as input.
I could not find any much detailed or comprehensive solution for this on web surfing. Any idea on how to achieve this. Kindly help.
If the walls on your plan are black, and the space is white, then use the white pixels as the space in which you can search using your algorithms.
be aware that:
The plan images could need some preprocessing, like adjusting brightness/contrast and/or converting into lower resolution picture.
If the plans are more complicated than that, ie. you need to take into account some special signs or structures on them then you need to do more complicated conversion/preprocessing and/or image recognition, using some special tools, maybe even some AI.

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.

Does any one know how to make alternative to Google recently start page in java swing? [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 9 years ago.
Improve this question
Has anyone idea how to make recently Google Search page in java swing?
Please take a look at http://www.google.com.
Nice effect :-)
If you wanted to do this in Swing, I would take the following approach:
Render the original screen to an offscreen BufferedImage
Render the new screen to an offcreen BufferedImage
Do an animated transition between the two by drawing the new screen then painting over it with the correct portions of the old screen, twisted and rotated to the right location (you can use the Java2D AffineTransformation for the rotating/twisting)
The tricky bit will be getting the position to change over time in a way that looks visually appealing and doesn't cause any nasty visual artefacts. This will take some maths and quite a bit of trial and error!

Data Structure for Spatial Agent Based Modeling [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 8 years ago.
Improve this question
What are some good data structures for keeping track of agents in a two-dimensional, spatial simulation?
I've seen some references to quadtrees (which I understand) and kd-trees (which I don't understand very well).
I'm looking for something through which an agent can efficiently say, "I know my location, and I would like to know which agents are near me (within a certain radius of myself)."
Examples (pseudo-code is fine) would be greatly appreciated.
I'm working in Java.
Well, I'm not sure exactly how it is implemented, but the MASON toolkit uses a discretization algorithm that places agents that are close to one another in the same "bucket" of a hash table. It makes for very fast lookups, as only a few of these buckets have to be checked for each query.
The best thing for you is probably to take a look at the source code here:
http://code.google.com/p/mason/source/browse/trunk/mason/sim/field/continuous/Continuous2D.java?r=529
I have found something called a Bucket PR Quadtree.

Categories

Resources