Is it possible to use MathML to describe data tables? - java

I'm using JEuclid library for rendering MathML script. I want to display data tables using MathML.
I googled it but all the results describe mtable with examples showing describing matrices.
So, I'm puzzled whether it is possible. In our current framework, it's not possible to use any other resources except graphics object of JPanel or MathML script.
So, please point me in the right direction. Any links to examples would be highly appreciated.

mtable is not specifically for matrices (in particular it does not add parenthesis around the data) It is used for all vertical alignment layouts such as tables and aligned equations.

Related

Using Java & BoofCV to detect shapes in an image file

I've not found anything here or on google. I'm looking for a way to identify shapes (circle, square, triangle and various other shapes) from a image file. Some examples:
You get the general idea. Not sure if BoofCV is the best choice here but it looks like it should be straightforward enough to use, but again I know nothing about it. I've looked at some of the examples and I though before I get in over my head (which is not hard to do some days), I thought I would ask if there is any info out there.
I'm taking a class on Knowledge Based AI solving Ravens Progressive Matrix problems and the final assignment will use strictly visual based images instead of the text files with attributes. We are not being graded on the visual since we only have a few weeks to work on this section of the project and we are encouraged to share this information. SOF has always been my go to source for information and I'm hoping someone out there might have some ideas on where to start with this...
Essentially what I want to do is detect the shapes (?? convert them into 2D geometry) and then make some assumptions about attributes such as size, fill, placement etc, create a text file with these attributes and then using that, send it through my existing code based that I wrote for my other projects to solve the problems.
Any suggestions????
There are a lot of ways you can do it. One way is to find the contour of the shape then fit a polygon to it or a oval. If you git a polygon to it and there are 4 sides with almost equal length then its a square. The contour can be found with binary blobs (my recommendation for the above images) or canny edge.
http://boofcv.org/index.php?title=Example_Fit_Polygon
http://boofcv.org/index.php?title=Example_Fit_Ellipse

How to recognize/identify different types of objects (textfields, labels, buttons etc) on screen/ from screenshots?

I would like to make something that is able to recognize different objects on the screen. Lets say I take a screenshot on a window with textfields, labels and buttons. I would like to pass in the image and it should be able to distinguish one from the other. In other words, it should put the name 'textfield' on top of the position where the textfields are located, 'button' on top of buttons and 'label' on top of labels.
Here is a sample image from the internet, to visualize a 'registration window': http://kb.parallels.com/Attachments/12828/Images/registration1.jpg
I would like to do this in Java, but I'm unsure if this is even possible. Does anyone have any ideas where I should start looking? Edge detection? Feature detection? OCR/ICR?
Does this already exist? Anyone ever come across something like this before?
Could someone please point me to the right direction? I would highly appreciate it.
Thank you! :)
This is how I would work on it:
A) Identification/Segmentation. Without knowing your data, you might be fine with something like "Find a rectangle (or something close to it, since edges are rounded) of less than half of your windows' area" (depends on your data..).
B) Classification. Personally, I'd scale every object you found to size 100*100 (or, whatever) and compare it with sample data (yes, you can scale a mini checkbox to that size. It won't look pretty, but it doesn't matter how it looks like..). Either "brute force" (which is why I scaled) or some nice classification algorithm. (Don't use neural networks, go SVM or nearest neighbour). For classification, I'd mostly look at histograms and shape factors/moments inside the rectangle. If the text confuses the data, get rid of it with some morphology before classification.
Textfields are a bit tricky, but for that, I'd use some OCR library and look at the entire picture. (Personally, I've done well with IMAQ, but it's commercial). If the text is outside a box, you've got yourself a label.
You should probably look into OpenCV.

SVG constructive area geometry?

Are there SVG functions that perform CAG operations similar to those that Area provides in Java (http://docs.oracle.com/javase/6/docs/api/java/awt/geom/Area.html)?
I would like to perform those operations directly using an SVG library (e.g. Batik), not through the Batik Graphics2D class that does SVG export (since I would rather use the SVG API than Java2D).
Cheers
SVG doesn't have any functions built into them, its mearly a graphics drawing spec..(with the exception of some animation functionality)
I would preprocess the vector values your app is using and then apply them to the rendering of the SVG.
Without knowing your platform, or your application of the SVG...its hard to help any further. SVG can be used in a lot of ways and places! :)
The references to Java allow me to assume that your using it as your interface engine? but thats about it..if you want to know the area of the circle, you would have to find the circle in the DOM tree, extrude the attributes from the the node, and just push them into a standard CAG class to do the math for you.

iText/Swing: Breaking text in a box

I am using iText to generate some PDF documents. It is quite easy to draw a colored rectangle. But I would like to add some text fitting into that box. Actually the main problem is to know where to break the text. Actually it will be the equivalent problem in Swing.
With a monotype font it will be quite easy, but without? Are there any well known algorithms or other ways?
See the ColumnText class.
This sort of thing is covered extensively (along with a million other things) in the iText in Action book - I highly recommend picking up a copy.

Advice needed: A programmatic way for creating vector graphics with heavy usage of text

I need a way for render a tree-like structures, similar to flowcharts.
Surprisingly, I can't find(or I'm doing wrong) a suitable tool.
First, I looked at SVG. But I couldn't find a way to draw a bounding box around the text
without using ECMAScript: I tried to do a simple thing drawing two text surrounded by boxes and linked by a line, centered by sides(some thing like O-O, where O is a box with text).And when you use ECMAScript, you heavily limit the tools that can be used for SVG rendering(for example you can't convert corrently such SVG to png or pdf with ImageMagick).
Second, I tried Asymptote, but it is quite heavy when you start manipulating with text(you need an LaTeX system installed and configured).
I look for a tool in which you can:
Programmatically access to font properties: baseline, ascent, descent, height
Computing height/width of a string(or the bounding box)
basic vector graphics functionality like drawing lines, shapes etc.
I don't think that's a hard stuff. For example, all such functionality exists for example in Java2D. Sure, I can use it as last resort and get raster graphics, but may be there is something handy to use?
Have you looked at GraphViz (http://www.graphviz.org/)? It does not really match your requirements since you give up some control and instead let the tool do the layout and rendering based on a declarative a description of a graph or tree, but I have found it to be the easiest way to generate tree-like output.
Not sure if it should be free?
Here's a commercial solution with an extensive API
http://www-01.ibm.com/software/integration/visualization/java/

Categories

Resources