a121064023 / javacv

Automatically exported from code.google.com/p/javacv
GNU General Public License v2.0
0 stars 0 forks source link

Passing CvHistogram between processes #389

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
Im trying to read an arraylist of histograms from an xml file

Pointer pointer1 = cvReadByName(cvfile, null, "Descriptors"+index+"-"+dindex);
Pointer pointer2 = cvReadByName(cvfile, null, "Histogram"+index+"-"+dindex); 
----> This is failing

Im writing it to the xml file like this:
CvFileStorage cvfile,cvfile2;
cvfile = opencv_core.cvOpenFileStorage(
                "C:\\FeatColorMetadata.xml", // filename
                null, // memstorage
                CV_STORAGE_WRITE, // flags
                null); // encoding
        int i = 0;
for(int index = 0; index < videoList.size(); index++){
cvWriteInt(cvfile, "size",videoList.get(index).getListofDescriptors().size());
            for (CvMat eachDescriptor : videoList.get(index).getListofDescriptors()) {
                cvWrite(cvfile, "Descriptors"+index+"-"+i, eachDescriptor);
                i++;
            }
            i=0;
            for (CvHistogram eachHistorgram : videoList.get(index).getListofHistograms()) {
                cvWrite(cvfile, "Histogram"+index+"-"+i, eachHistorgram);
                i++;
            }
        }
        cvReleaseFileStorage(cvfile);

Giving this error:
OpenCV Error: Unspecified error (The node does not represent a user object 
(unknown type?))

Note: Im doing the same thing with CvMat and was able to do it successfully

What is the expected output? What do you see instead?
CvHistogram should be read from the xml file

What version of the product are you using? On what operating system?
opencv 2.4.6
javacv 64 bit windows operating system

Please provide any additional information below.
Thanks & Regards
Preetham

Original issue reported on code.google.com by preethu....@gmail.com on 30 Nov 2013 at 1:01

GoogleCodeExporter commented 8 years ago
Never mind..issue solved, sent across histograms matrices, thresh separately, 
and it works fine

Original comment by preethu....@gmail.com on 1 Dec 2013 at 5:52

GoogleCodeExporter commented 8 years ago
Ok, sounds good, but I'm not sure I understand how you solved it. If you have 
some time, please post some code explaining how you solved that to help the 
next person to hit the same problem, thanks!

Original comment by samuel.a...@gmail.com on 1 Dec 2013 at 12:34

GoogleCodeExporter commented 8 years ago
sure.. I wrote all the individual data involved in creating a histogram such as 
mat, ranges, uniform, dims, sizes separately to xml file

Writing to XML
cvWrite(cvfile2, "Histogram"+i, eachHistorgram.mat());

Reading from XML
Pointer pointer2 = cvReadByName(cvfile2, null, "Histogram"+dindex);
CvHistogram hist = cvCreateHist(dims, sizes, histType, ranges, uniform);
hist.mat(new CvMatND(pointer2));

Thanks,
Preetham

Original comment by preethu....@gmail.com on 1 Dec 2013 at 6:39