How I can read xml not written by openCV - opencv

For detection, I need to read number of points in xml file which was not written by openCV
so it starts like this
<?xml version="1.0" encoding="utf-8"?>
<KisaLibraryIndex>
....
<KisaLibraryIndex>
I tried to read this xml file using
FileStorage fs(filename, FileStorage::READ);
but it wasn't work with error message "abort() has been called"
I think the library index isn't matching with <opencv storage>
Is it impossible to read xml file doesn't written in openCV ::WRITE???

Related

Even after adding new mime type for Tika file is still detected as application/x-bplist

I was trying to use Apache Tika to detect a .memgraph file exported out of Xcode. But the problem is that it was getting detected as application/x-bplist using the Tika() detector. So I created a new file org/apache/tika/mime/custom-mimetypes.xmland added the following to it:
<?xml version="1.0" encoding="UTF-8"?>
<mime-info>
<mime-type type="application/memgraph">
<glob pattern="*.memgraph"/>
</mime-type>
</mime-info>
But even after adding this the file was still getting detected as application/x-bplist. Will I have to write my own custom detector? And how will I go about writing one?

How to read a xml file with python with xml.dom

i am having one xml file and i need to fetch value of tags postnumer and regarding every postnumber all the valid number values...i am using xml.dom for reading xml file in python what is the code to fetch the value...how can i do this? please help
xml code:
-<post>
<PostNumber>180</postNumber>
-<validList>
<validNumber>208</validNumber>
<validNumber>209</validNumber>
<validNumber>210</validNumber>
</validlist>
</post>
-<post>
<postNumber>1023832</postNumber>
-<validlist>
<validNumber>264</validNumber>
<validNumber>401</validNumber>
</validlist>
</post>

Download a zip file from eBay using rest-client

I want to download the zip file from eBay. Using downloadfile api.
response = RestClient.post(url,xml,headers)
This call return the content of zip file that is not exractable in xml I think. So i want to download zip file as it is from eBay.
My code is:
headers = {
"X-EBAY-SOA-OPERATION-NAME"=>"downloadFile",
"X-EBAY-SOA-SECURITY-TOKEN" => access_token_lister,
"X-EBAY-API-SITEID"=>"0",
"Content-Type"=>"application/zip"
}
url = 'https://storage.ebay.com/FileTransferService'
xml = '<?xml version="1.0"
encoding="utf-8"?> <downloadFileRequest xmlns="ebay.com/marketplace/services">; <fileReferenceId>6637191637</fileReferenceId> <taskReferenceId>6474385857</taskReferenceId> </downloadFileRequest>'
The documentation for the API used above can be found here : http://developer.ebay.com/devzone/file-transfer/CallRef/downloadFile.html
You will have to pass the content of the response to a library like rubyzip. Then use it to extract your files from the zipped file. This you can do by first writing the file to disk, and then reading it using rubyzip.
Specifically look at this part of the documentation of rubyzip - Reading a Zip file to accomplish what you are trying to achieve.

Ephesoft can't learn or extract certain tif image (not all image)

I'm using Ephesoft community edition 4.0.2.0 with tif images (tested by ephesoft) the problem that ephesoft can classify or extract data from certain images but from others he can't with no error message in files log, i dont now why.
When i click on Learn files the HOCR and HTML generated files are empty with no data just metadata like this :
Application_Checklist_HOCR.xml :
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<HocrPages<HocrPage>
<Title></Title><Spans/>
<HocrContent></HocrContent>
</HocrPage></HocrPages>
But for US-invoice_HOCR.xml ephesoft can learn and the file look like this :
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><HocrPages><HocrPage>
<Title></Title><Spans><Span><Value>INVOICE</Value><Coordinates><x0>579</x0>
<y0>247</y0><x1>881</x1><y1>304</y1></Coordinates></Span><Span>
<Value>ACME</Value><Coordinates><x0>168</x0><y0>394</y0><x1>311</x1><y1>431</y1>
</Coordinates></Span><Span><Value>Company</Value><Coordinates><x0>329</x0>
<y0>395</y0><x1>541</x1><y1>442</y1></Coordinates></Span><Span>
<Value>lnvoice</Value><Coordinates>............
You can modify the tesseract config file in /Path-To-Ephesoft/Application/WEB-INF/classes/META-INF/dcma-tesseract/tesseract-‌​reader.properties and comment this line #tesseract.command_parameters=-psm 4 to let tesseract use the default segmentation.

Object Detection using FERNS

I am new to image processing and have just started working in OpenCV. I was trying to do object detection using GenericDescriptorMatcher of type fern. But I don't know what to pass as the params_filename. What should be the format of the file? What parameters do I write in the file and in what format?
Ptr<GenericDescriptorMatcher> descriptorMatcher = GenericDescriptorMatcher::create("FERN", params_filename);
The opencv-2.x.x/samples/cpp should contain an example version of 'fern_params.xml', which according to opencv-2.4.8 contains the following xml content,
<?xml version="1.0"?>
<opencv_storage>
<nclasses>0</nclasses>
<patchSize>31</patchSize>
<signatureSize>INT_MAX</signatureSize>
<nstructs>50</nstructs>
<structSize>9</structSize>
<nviews>1000</nviews>
<compressionMethod>0</compressionMethod>
</opencv_storage>

Resources