How to integrate .traineddata from trainyourtesseract.com? - ios

I have successfully trained my tesseract using Anyline's trainyourtesseract and got a .traineddata file in my email. I might be asking a dumb question here but do you simply drag this to your tessdata folder and cross your fingers and hopefully it works. The are no directions to integrate it. I have seen tutorials that integrate two different languages with a code line like this.
G8Tesseract *operation = [[G8Tesseract alloc] init];
operation.language = #"eng+fra";
So I tried to do the following code but it gave me an cube error.
G8Tesseract *operation = [[G8Tesseract alloc] init];
operation.language = #"eng+arial";
The name of the .traineddata file that I got was arial.traineddata.
Running the code above I tried to implement throws an error
"Cube ERROR (CubeRecoContext::Load): unable to read cube language model params from /var/containers/Bundle/Application/98165164-BA09-40FE-AF82-7CAAE9B77F45/ExWU.app/tessdata/arial.cube.lm
Cube ERROR (CubeRecoContext::Create): unable to init CubeRecoContext object"
Any help would be greatly appreciated!

You could try to initialize G8Tesseract in G8OCREngineModeTesseractOnly and see if this works.
__block G8Tesseract * operation = [[G8Tesseract alloc]initWithLanguage:#"eng+arial" engineMode:G8OCREngineModeTesseractOnly];

Related

GPUImage failed to init ACVFile with data:(null)

First of all, I must say that GPUImage is an excellent framework. However, when loading an ACV file that I export from Photoshop CS6, it gives me an error saying that: failed to init ACVFile with data:(null). The thing is though, that the same code works for some other ACV files, and the file definitely has data, 64 bites of it in fact.
Here is how I am trying to load it:
GPUImageToneCurveFilter *stillImageFilter2 = [[GPUImageToneCurveFilter alloc] initWithACV:#"test"];
UIImage *quickFilteredImage = [stillImageFilter2 imageByFilteringImage:baseImage];
photoImage.image = quickFilteredImage;
If I change test to another ACV file, it works perfectly. Not sure what is wrong.
Thanks
MehtaiPhoneApps
just add the extension of tone curve file test.acv and you are good to go
=> updated code
GPUImageToneCurveFilter *stillImageFilter2 = [[GPUImageToneCurveFilter alloc] initWithACV:#"test.acv"];
UIImage *quickFilteredImage = [stillImageFilter2 imageByFilteringImage:baseImage];
photoImage.image = quickFilteredImage;

adding GPUImage framework to IOS project

The hours are turning into days trying to add the GPUImage framework into an IOS project. Now I've got it working I'm trying the sample filtering live video code from Sunset Lake Software page. The app fails to build with the following red error: ' Use of undeclared 'thresholdfFilter'
GPUImageVideoCamera *videoCamera = [[GPUImageVideoCamera alloc] initWithSessionPreset:AVCaptureSessionPreset640x480 cameraPosition:AVCaptureDevicePositionBack];
GPUImageFilter *customFilter = [[GPUImageFilter alloc] initWithFragmentShaderFromFile:#"CustomShader"];
GPUImageView *filteredVideoView = [[GPUImageView alloc] initWithFrame:CGRectMake(0.0, 0.0, 768, 1024)];
// problem here
[videoCamera addTarget:thresholdFilter];
[customFilter addTarget:filteredVideoView];
[videoCamera startCameraCapture];
Using Xcode 6.0.1 and testing app on iPad2 with IOS 8.0.2 - If required, I can post screen shots of how I emdedded the framework.
First, the code written in my initial blog post announcing the framework should not be copied to use with the modern version of the framework. That initial post was written over two years ago, and does not reflect the current state of the API. In fact, I've just deleted all of that code from the original post and directed folks to the instructions on the GitHub page which are kept up to date. Thanks for the reminder.
Second, the problem you're describing above is that you're attempting to use a variable called thresholdFilter without ever defining such a variable. That's not a problem with the framework, the compiler has no idea what you're referring to.
Third, the above code won't work for another reason: you're not holding on to your camera instance. You're defining it locally, instead of assigning it to an instance variable of your encapsulating class. This will lead to ARC deallocating that camera as soon as your above setup method is complete, leading to a black screen or to a crash. You need to create an instance variable or property and assign your camera to that, so that a strong reference is made to it.

OData4ObjC without using proxyclasses

I am using OData4ObjC, want to know is there a way to add/update/delete an entry in a table without using proxy classes. Just similar way the OData4j for Android does
e.g.,
OEntity havinaCola = c.getEntity("Products", 3).execute();
I am currently using proxy classes for the same as mentioned below,
proxy = [[serviceEntities alloc] initWithUri:#"sampleservices/producer.svc/" credential:nil];
QueryOperationResponse *response = [proxy execute:#"customers"];
NSMutableArray *array = [response getResult];
Thanks.
I have found one way to do the same i.e., as mentioned in the book written by Author 'Matthew Baxter-Reynolds' 'Multimobile Development (Building applications for the iPhone and Android Platform)' suggests method how to GET/UPDATE/DELETE/ADD entries.
Hope this is useful.
Thanks

iOS AWS DynamoDB can't run a request

I've been struggling with connecting to the AWS DynamoDB with my iOS app. I am frustrated with the lack of tutorials/documentation on the DynamoDB (I guess it is still fairly new). But I ahve been trying to follow Amazon's User Preference Tutorial I am trying to just connect to the database and read something or write something but I am getting an exception thrown.
AmazonCredentials *creds;
creds = [creds initWithAccessKey:MY_ACCESS_KEY withSecretKey:MY_SECRET_KEY];
AmazonDynamoDBClient *ddb = [[AmazonDynamoDBClient alloc] initWithCredentials:creds];
DynamoDBGetItemRequest *request = [[DynamoDBGetItemRequest alloc]
initWithTableName:#"Users" andKey:[[DynamoDBKey alloc] initWithHashKeyElement:
[[DynamoDBAttributeValue alloc] initWithS:#"Chase"]]];
DynamoDBGetItemResponse *response = [ddb getItem:request]; //THROWING THE EXCEPTION HERE!
NSMutableDictionary *user = response.item;
NSLog(#"%#",user);
The output reads:
Terminating app due to uncaught exception 'AmazonServiceException', reason: ''
The only thing that I changed from what the tutorial has done is the way I set up my user credentials and the line that throws the exception, the tutorial has:
DynamoDBCreateTableResponse *response = [[AmazonClientManager ddb] getItem:request];
I couldn't find any AmazonClientManager class anywhere, but the AmazonDynamoDBClient class seems to have the same method, so I am assuming that it should work (this could very well be the assumption that is breaking my code). I don't know if Amazon still supports that class because I can't find it in any documentation either.
Also, before I get yelled at, I know that I shouldn't be handing out my own credentials in the app. I will change this later. I am just trying to get to a sanity state for now.
You need to change these lines
AmazonCredentials *creds;
creds = [creds initWithAccessKey:MY_ACCESS_KEY withSecretKey:MY_SECRET_KEY];
to this
AmazonCredentials *creds = [[AmazonCredentials alloc] initWithAccessKey:MY_ACCESS_KEY withSecretKey:MY_SECRET_KEY];
Also, AmazonClientManager is not a part of the SDK. It's a part of the sample app and returns an instance of AmazonDynamoDBClient. It's included in the sample project.

Reading .plist from online

I've followed this tutorial: http://www.iphonedevcentral.com/hello-uitableview/
I've got it working great and all, but I can't quite figure out how to make it work by accessing the plist they've included, online.
Their plist is located here: http://www.iphonedevcentral.com/wp-content/uploads/2009/07/TestData.plist
And the source code for their tutorial is here: http://www.iphonedevcentral.com/wp-content/uploads/2009/07/MyDVDLibrary01.zip
For what i can see, the call to the file on that exercise refer to an internal resource:
libraryContent = [[NSArray alloc] initWithContentsOfFile:[[NSBundle mainBundle]
pathForResource:libraryPlist ofType:#"plist"]];
In order to have tis working you need to download the TestData.plist file from the server and copy it in your Xcode project. If you want to load the file from the server you have to change those lines with something like this:
libraryContent = [[NSArray alloc] initWithContentsOfURL:[NSURL URLWithString:#"http://www.iphonedevcentral.com/wp-content/uploads/2009/07/TestData.plist"]];

Resources