Ask Your Question
0

cant understand the XML file output

asked 2017-02-18 11:43:14 -0600

Tomna gravatar image

i am working in extracting features using HOG for SVM training so i managed to make the code work but i cant understand the output i am working on the positive image which are 550 image with size 100*40 and saved to an xml file

here is the code

  public static void trainPositives() {
            for (File file : new File(PATH_POSITIVE).listFiles()) {
                Mat img = getMat(file.getAbsolutePath());
                HOGDescriptor d = new HOGDescriptor(new Size(32, 32), new Size(8, 8), new Size(4, 4), new Size(4, 4), 9);
                MatOfFloat descriptorsValues = new MatOfFloat();
                MatOfPoint locations = new MatOfPoint();
                d.compute(img, descriptorsValues, new Size(0, 0), new Size(0, 0), locations);
                v_descriptors.push_back(descriptorsValues);
                v_loacation.push_back(locations);
                d.save(XML);
            } 
         }

what i want to know about the output where is the features or this output is completely wrong and why or any link explaining the HOG XML file output

<?xml version="1.0"?>
<opencv_storage>
<data type_id="opencv-object-detector-hog">
  <winSize>
    32 32</winSize>
  <blockSize>
    8 8</blockSize>
  <blockStride>
    4 4</blockStride>
  <cellSize>
    4 4</cellSize>
  <nbins>9</nbins>
  <derivAperture>1</derivAperture>
  <winSigma>2.</winSigma>
  <histogramNormType>0</histogramNormType>
  <L2HysThreshold>2.0000000000000001e-01</L2HysThreshold>
  <gammaCorrection>0</gammaCorrection>
  <nlevels>64</nlevels>
  <signedGradient>0</signedGradient></data>
</opencv_storage>
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2017-02-20 04:06:09 -0600

berak gravatar image

HOGDescriptor::save only saves the instance's params (those you passed into the constructor), not any data obtained from compute(). (which is probably , what you wanted). since it is also impossible, to use cv::FileStorage from java, -- you'll have to find your own way to serialize your data ;(

edit flag offensive delete link more

Comments

@berak for the fileStorage i think i will try import YAML Parser using yamlbeans will see how it will go and for the d.save could you provide more explanation code if possible because i think if i am not supposed to save the output of the compute to an xml file what exactly i am supposed to and i have a question is the saved data to the xml are features to all the images or what exactly ? and thank you

Tomna gravatar imageTomna ( 2017-02-20 09:32:25 -0600 )edit

i would not waste any time with yaml or xml parsers here.

also, it might not be nessecary, to write the hog output to disk at all, you could just pass it to the SVM, and save the trained SVM

berak gravatar imageberak ( 2017-02-20 09:52:44 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-02-18 11:43:14 -0600

Seen: 279 times

Last updated: Feb 20 '17