Guessing the extract ratio in Tesseract-OCR - tesseract

I'm trying to use Tesseract-OCR, and I need to know the % of text that's been extracted. Is there a way to know this?
Thanks!

Check out the API method: int Recognize(ETEXT_DESC* monitor); Tesseract updates monitor with the progress in some way.
https://code.google.com/p/tesseract-ocr/source/browse/trunk/api/baseapi.h?spec=svn1050&r=1046
http://tesseract-ocr.repairfaq.org/structETEXT__DESC.html
https://groups.google.com/forum/#!topic/tesseract-ocr/W9J_3oe8le8

Related

thumbor // url syntax to crop and apply filter at the same time

For the ones that uses it, if it is ever possible
Looking though the docs, can't find a clue about building an url that would crop the image and apply a filter at the same time
Thanks for the help
Sure thing, the syntax would be like this:
http://<your_thumbor_server>/unsafe/<crop>/filters:<some_filter>/<image_source_url>
Which might look something like this:
http://thumborhost.com/unsafe/200x0:600x800/filters:format(webp)/http://imagehost.com/path/to/source.jpg
The full url syntax as stated by the Thumbor docs is:
http://thumbor-server/hmac/trim/AxB:CxD/fit-in/-Ex-F/HALIGN/VALIGN/smart/filters:FILTERNAME(ARGUMENT):FILTERNAME(ARGUMENT)/image-uri
Docs: http://thumbor.readthedocs.org/en/latest/usage.html

How to Convert IPicture to Image - .NET 4.5 TagLib Sharp

I am wanting to display the album artwork of a song (accessed via the taglib-sharp library) within a Windows Forms picture box. The problem I'm running into is that the taglib-library returns an image of type TagLib.IPicture whereas the picture box requires an object of type System.Drawing.Image.
I have scoured the internet for many hours now, looking for a way to convert from an IPicture to Image, but to no avail. The best lead I have is this: http://msdn.microsoft.com/en-us/library/system.windows.forms.axhost.getpicturefromipicture.aspx, but I have yet to see a successful example of how to implement this.
Any help as to how to convert between these two types would be much appreciated. Note: IPicture is not analogous to IPictureDisp in this case.
I've done the opposite before - turning an existing .jpg into an IPicture for embedding in an .mp3 file. I just tried reversing that operation and, after tweaking and testing, came up with this:
TagLib.File tagFile = TagLib.File.Create(mp3FilePath);
MemoryStream ms = new MemoryStream(tagFile.Tag.Pictures[0].Data.Data);
System.Drawing.Image image = System.Drawing.Image.FromStream(ms);
Thanks for the question - I already know how I'm going to use this myself!
Update: Here's the other way (.jpg to IPicture that I've done before):
tagFile.Tag.Pictures = new TagLib.IPicture[]
{
new TagLib.Picture(new TagLib.ByteVector((byte[])new System.Drawing.ImageConverter().ConvertTo(System.Drawing.Image.FromFile(jpgFilePath), typeof(byte[]))))
};

Dicominfo not giving all metadata

I have a dicom from a GE MRI scanner and there are a few pieces of information in the header I require (namely the relative position of the scan). I tried using info = dicominfo(filename) but, for some reason, this piece of information does not show up. I know that this information is saved, however. It might be a private data, but I'm not completely sure. If anyone has any information on how to resolve this issue that would be greatly appreciated.
Try using the dicomread function instead, it should be more versatile than dicominfo and it reads the information files too. If this doesn't work then it means that the information you are trying to obtain is not made available by GE.
Or use gdcm to dump the private GE header:
$ gdcmdump --pdb input.dcm

BIRT: Getting started with the Chart API

So I need a few simple pointers with the BIRT chart API.
I am trying to draw a simple line chart of a numeric value over time. I have a vector of (Date,Double) pairs as input. I have read through the examples in org.eclipse.birt.chart.examples but not yet gained enough traction with the API to start making use of it. Just composing a org.eclipse.birt.chart.model.impl.ChartWithAxesImpl has me stumped.
The eventual destination is an Eclipse editor, and that I can do. Is there a tutorial or book anyone can recommend that might get me going with the BIRT chart side?
I should be very grateful
M.
Well. There is this example: http://www.eclipse.org/articles/article.php?file=Article-BIRTChartEngine/index.html
But I am having some problems actually getting it to work myself. All I end up with is an exception like this:
java.lang.NullPointerException
at org.eclipse.birt.chart.device.swt.SwtTextMetrics.getHeight(SwtTextMetrics.java:178)
at org.eclipse.birt.chart.computation.Methods.computeFontHeight(Methods.java:1272)
at org.eclipse.birt.chart.computation.BIRTChartComputation.computeFontHeight(BIRTChartComputation.java:30)
at org.eclipse.birt.chart.computation.EllipsisHelper$SimpleTester.<init>(EllipsisHelper.java:213)
at org.eclipse.birt.chart.computation.EllipsisHelper.createSimpleTester(EllipsisHelper.java:176)
at org.eclipse.birt.chart.computation.EllipsisHelper.simpleInstance(EllipsisHelper.java:183)
at org.eclipse.birt.chart.computation.LabelLimiter.limitLabelSize(LabelLimiter.java:256)
at org.eclipse.birt.chart.computation.LabelLimiter.limitLabelSize(LabelLimiter.java:211)
at org.eclipse.birt.chart.model.layout.impl.TitleBlockImpl.computeBox(TitleBlockImpl.java:288)
at org.eclipse.birt.chart.model.layout.impl.LabelBlockImpl.getPreferredSize(LabelBlockImpl.java:266)
at org.eclipse.birt.chart.internal.layout.LayoutManager$ChartLayout.<init>(LayoutManager.java:111)
at org.eclipse.birt.chart.internal.layout.LayoutManager.doLayout_tmp(LayoutManager.java:1145)
at org.eclipse.birt.chart.internal.layout.LayoutManager.doLayout(LayoutManager.java:1310)
at org.eclipse.birt.chart.factory.Generator.build(Generator.java:1092)
I had the same trouble with the examples from org.eclipse.birt.chart.examples. There are some good java code snippets, but you do not see to what they correspond. This is why I decided to generate all the examples and put them on a web site: BIRT Charts Gallery.

iOS UIAutomation: is it possible to compare screenshots to reference images?

The title explains it already. I'm looking for a solution to compare screenshots taken with target.captureScreenWithName in a UIAutomation script to some reference images. This would be really nice to test some custom views.
Try to use free ImageMagicK for Mac. Starting from iOS 5 there is a new UIAHost.performTaskWithPathArgumentsTimeout(path, args, timeout) that allows you to run external task right from your tests. Simply running ImageMagic script using this functions with parameters you will be able to get image comparison results right from your test.
var result = UIAHost.performTaskWithPathArgumentsTimeout(path, args, timeout)
path - string to the image comparison script;
args - an array of parameters and its values for ImageMagicK utility like:
var args = ['param1', 'param1Value', 'param2', 'param2value'....];
More details for ImageMagicK:
http://www.imagemagick.org/script/index.php
UIAHost reference:
http://developer.apple.com/library/ios/#documentation/UIAutomation/Reference/UIAHostClassReference/UIAHost/UIAHost.html
It is impossible to do it directly from UIA, at least I didn't find any way to do this. All the screenshots are saved to the test result folder. You can then process them by any tool you like.
Check out Zucchini Framework. It wraps UIAutomation API nicely and lets you have screenshots as test assertions.