Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Geeting error while reading the xml file.

Hi , I am getting the error while reading the xml file. The error message is.."duplicate key".

int main() { std::vector<std::string> names = { "SuperPixelno", "lValue", "aValue","bValue","xCenter","yCenter","depthValue" }; cv::FileStorage fs("FeatureVector.xml", cv::FileStorage::WRITE); superpixelSlic.writeVector(fs, names, tempCenters); fs.release();

vector<centervalues> readTempCenters; std::vector<std::string> nm = { "SuperPixelno", "lValue", "aValue","bValue","xCenter","yCenter","depthValue" }; FileStorage fs2("FeatureVector.xml", FileStorage::READ); readVector(fs2, nm, readTempCenters); fs2.release();

return (0); }

void readVector(FileStorage &fns, vector<std::string> nm, vector<centervalues> &data) { data.clear();

CenterValues tmp;
FileNode fn = fns["features"];

if (fn.empty()) {
    return;
}

for (FileNodeIterator current = fn.begin(); current != fn.end(); ++current)
{
    //FileNode item = *current;


    cout << "superpixelno. " << (double)(*current)[nm[0]];
    cout << "light Value " << (double)(*current)[nm[1]];
    cout << "a value" << (double)(*current)[nm[2]];
    cout << "b value" << (double)(*current)[nm[3]];
    cout << "x Value" << (double)(*current)[nm[4]];
    cout << "y Value" << (double)(*current)[nm[5]];
    cout << "depth Value" << (double)(*current)[nm[6]];

}

}

void SuperpixelSlic:: writeVector(cv::FileStorage &fs, std::vector<std::string> &names, std::vector<centervalues> &data) {

for (int i = 0; i < data.size(); i++)![image description](/upfiles/1518773204719258.png)
{
    fs << "features";
    fs <<"{:"<< names[0] << i<<names[1] << data[i].lightValue <<names[2] << data[i].aValue<<names[3] << data[i].bValue << names[4] << data[i].xValue<<names[5] << data[i].yValue<<names[6] << data[i].depthValue<<"}";
}

}

Geeting error while reading the xml file.

Hi , I am getting the error while reading the xml file. The error message is.."duplicate key". iHave attched read and write function and screenshot of xml file.image description thank you.

int main() { std::vector<std::string> names = { "SuperPixelno", "lValue", "aValue","bValue","xCenter","yCenter","depthValue" }; cv::FileStorage fs("FeatureVector.xml", cv::FileStorage::WRITE); superpixelSlic.writeVector(fs, names, tempCenters); fs.release();

vector<centervalues> readTempCenters; std::vector<std::string> nm = { "SuperPixelno", "lValue", "aValue","bValue","xCenter","yCenter","depthValue" }; FileStorage fs2("FeatureVector.xml", FileStorage::READ); readVector(fs2, nm, readTempCenters); fs2.release();

return (0); }

void readVector(FileStorage &fns, vector<std::string> nm, vector<centervalues> &data) { data.clear();

CenterValues tmp;
FileNode fn = fns["features"];

if (fn.empty()) {
    return;
}

for (FileNodeIterator current = fn.begin(); current != fn.end(); ++current)
{
    //FileNode item = *current;


    cout << "superpixelno. " << (double)(*current)[nm[0]];
    cout << "light Value " << (double)(*current)[nm[1]];
    cout << "a value" << (double)(*current)[nm[2]];
    cout << "b value" << (double)(*current)[nm[3]];
    cout << "x Value" << (double)(*current)[nm[4]];
    cout << "y Value" << (double)(*current)[nm[5]];
    cout << "depth Value" << (double)(*current)[nm[6]];

}

}

void SuperpixelSlic:: writeVector(cv::FileStorage &fs, std::vector<std::string> &names, std::vector<centervalues> &data) {

for (int i = 0; i < data.size(); i++)![image description](/upfiles/1518773204719258.png)
{
    fs << "features";
    fs <<"{:"<< names[0] << i<<names[1] << data[i].lightValue <<names[2] << data[i].aValue<<names[3] << data[i].bValue << names[4] << data[i].xValue<<names[5] << data[i].yValue<<names[6] << data[i].depthValue<<"}";
}

}

Geeting error while reading the xml file.

Hi , I am getting the error while reading the xml file. The error message is.."duplicate key". iHave attched read and write function and screenshot of xml file.image description thank you.

int main()
{
std::vector<std::string> names = { "SuperPixelno", "lValue", "aValue","bValue","xCenter","yCenter","depthValue" };
cv::FileStorage fs("FeatureVector.xml", cv::FileStorage::WRITE);
superpixelSlic.writeVector(fs, names, tempCenters);
fs.release();

vector<centervalues> fs.release(); vector<CenterValues> readTempCenters; std::vector<std::string> nm = { "SuperPixelno", "lValue", "aValue","bValue","xCenter","yCenter","depthValue" }; FileStorage fs2("FeatureVector.xml", FileStorage::READ); readVector(fs2, nm, readTempCenters); fs2.release();

fs2.release(); return (0); }

} void readVector(FileStorage &fns, vector<std::string> nm, vector<centervalues> vector<CenterValues> &data) { data.clear();


data.clear();

CenterValues tmp;
FileNode fn = fns["features"];

if (fn.empty()) {
    return;
}

for (FileNodeIterator current = fn.begin(); current != fn.end(); ++current)
{
    //FileNode item = *current;


    cout << "superpixelno. " << (double)(*current)[nm[0]];
    cout << "light Value " << (double)(*current)[nm[1]];
    cout << "a value" << (double)(*current)[nm[2]];
    cout << "b value" << (double)(*current)[nm[3]];
    cout << "x Value" << (double)(*current)[nm[4]];
    cout << "y Value" << (double)(*current)[nm[5]];
    cout << "depth Value" << (double)(*current)[nm[6]];

}

}

} void SuperpixelSlic:: writeVector(cv::FileStorage &fs, std::vector<std::string> &names, std::vector<centervalues> std::vector<CenterValues> &data) {

{

    for (int i = 0; i < data.size(); i++)![image description](/upfiles/1518773204719258.png)
{
    {
        fs << "features";
     fs <<"{:"<< names[0] << i<<names[1] << data[i].lightValue <<names[2] << data[i].aValue<<names[3] << data[i].bValue << names[4] << data[i].xValue<<names[5] << data[i].yValue<<names[6] << data[i].depthValue<<"}";

}
}

}

Geeting error while reading the xml file.

Hi , I am getting the error while reading the xml file. The error message is.."duplicate key".

 I have attached read and write function and screenshot of xml file.image description
thank you.

int main() { std::vector<std::string> names = { "SuperPixelno", "lValue", "aValue","bValue","xCenter","yCenter","depthValue" }; cv::FileStorage fs("FeatureVector.xml", cv::FileStorage::WRITE); superpixelSlic.writeVector(fs, names, tempCenters); fs.release(); vector<CenterValues> fs.release();

vector<centervalues> readTempCenters; std::vector<std::string> nm = { "SuperPixelno", "lValue", "aValue","bValue","xCenter","yCenter","depthValue" }; FileStorage fs2("FeatureVector.xml", FileStorage::READ); readVector(fs2, nm, readTempCenters); fs2.release(); fs2.release();

return (0); } }

void readVector(FileStorage &fns, vector<std::string> nm, vector<CenterValues> vector<centervalues> &data) { data.clear(); data.clear();

CenterValues tmp;
FileNode fn = fns["features"];

if (fn.empty()) {
    return;
}

for (FileNodeIterator current = fn.begin(); current != fn.end(); ++current)
{
    //FileNode item = *current;


    cout << "superpixelno. " << (double)(*current)[nm[0]];
    cout << "light Value " << (double)(*current)[nm[1]];
    cout << "a value" << (double)(*current)[nm[2]];
    cout << "b value" << (double)(*current)[nm[3]];
    cout << "x Value" << (double)(*current)[nm[4]];
    cout << "y Value" << (double)(*current)[nm[5]];
    cout << "depth Value" << (double)(*current)[nm[6]];

}

}

}

void SuperpixelSlic:: writeVector(cv::FileStorage &fs, std::vector<std::string> &names, std::vector<CenterValues> std::vector<centervalues> &data) { {

for (int i = 0; i < data.size(); i++)![image description](/upfiles/1518773204719258.png)
    {
    {
    fs << "features";
     fs <<"{:"<< names[0] << i<<names[1] << data[i].lightValue <<names[2] << data[i].aValue<<names[3] << data[i].bValue << names[4] << data[i].xValue<<names[5] << data[i].yValue<<names[6] << data[i].depthValue<<"}";

}
}

}

click to hide/show revision 5
None

updated 2018-02-16 03:33:32 -0600

berak gravatar image

Geeting error while reading the xml file.

Hi , I am getting the error while reading the xml file. The error message is.."duplicate key". I have attached read and write function and screenshot of xml file.image description thank you.

int main()
{
std::vector<std::string> names = { "SuperPixelno", "lValue", "aValue","bValue","xCenter","yCenter","depthValue" };
cv::FileStorage fs("FeatureVector.xml", cv::FileStorage::WRITE);
superpixelSlic.writeVector(fs, names, tempCenters);
fs.release();

vector<centervalues> fs.release(); vector<CenterValues> readTempCenters; std::vector<std::string> nm = { "SuperPixelno", "lValue", "aValue","bValue","xCenter","yCenter","depthValue" }; FileStorage fs2("FeatureVector.xml", FileStorage::READ); readVector(fs2, nm, readTempCenters); fs2.release();

fs2.release(); return (0); }

} void readVector(FileStorage &fns, vector<std::string> nm, vector<centervalues> vector<CenterValues> &data) { data.clear();

data.clear();

    CenterValues tmp;
 FileNode fn = fns["features"];

 if (fn.empty()) {
     return;
}

    }

    for (FileNodeIterator current = fn.begin(); current != fn.end(); ++current)
{
    {
        //FileNode item = *current;


     cout << "superpixelno. " << (double)(*current)[nm[0]];
     cout << "light Value " << (double)(*current)[nm[1]];
     cout << "a value" << (double)(*current)[nm[2]];
     cout << "b value" << (double)(*current)[nm[3]];
     cout << "x Value" << (double)(*current)[nm[4]];
     cout << "y Value" << (double)(*current)[nm[5]];
     cout << "depth Value" << (double)(*current)[nm[6]];

}

}

} } void SuperpixelSlic:: writeVector(cv::FileStorage &fs, std::vector<std::string> &names, std::vector<centervalues> std::vector<CenterValues> &data) {

{

    for (int i = 0; i < data.size(); i++)![image description](/upfiles/1518773204719258.png)
{
    {
        fs << "features";
     fs <<"{:"<< names[0] << i<<names[1] << data[i].lightValue <<names[2] << data[i].aValue<<names[3] << data[i].bValue << names[4] << data[i].xValue<<names[5] << data[i].yValue<<names[6] << data[i].depthValue<<"}";
    }
}

}

Geeting error while reading the xml file.

Hi , I am getting the error while reading the xml file. The error message is.."duplicate key". I have attached read and write function and screenshot of xml file.image description thank you.

int main()
{
std::vector<std::string> names = { "SuperPixelno", "lValue", "aValue","bValue","xCenter","yCenter","depthValue" };
cv::FileStorage fs("FeatureVector.xml", cv::FileStorage::WRITE);
superpixelSlic.writeVector(fs, names, tempCenters);
fs.release();

vector<CenterValues> readTempCenters;
std::vector<std::string> nm = { "SuperPixelno", "lValue", "aValue","bValue","xCenter","yCenter","depthValue" };
FileStorage fs2("FeatureVector.xml", FileStorage::READ);
readVector(fs2, nm, readTempCenters);
fs2.release();

return (0);
}

void readVector(FileStorage &fns, vector<std::string> nm, vector<CenterValues> &data)
{
    data.clear();

    CenterValues tmp;
    FileNode fn = fns["features"];

    if (fn.empty()) {
        return;
    }

    for (FileNodeIterator current = fn.begin(); current != fn.end(); ++current)
    {
        //FileNode item = *current;


        cout << "superpixelno. " << (double)(*current)[nm[0]];
        cout << "light Value " << (double)(*current)[nm[1]];
        cout << "a value" << (double)(*current)[nm[2]];
        cout << "b value" << (double)(*current)[nm[3]];
        cout << "x Value" << (double)(*current)[nm[4]];
        cout << "y Value" << (double)(*current)[nm[5]];
        cout << "depth Value" << (double)(*current)[nm[6]];

    }

}

void SuperpixelSlic:: writeVector(cv::FileStorage &fs, std::vector<std::string> &names, std::vector<CenterValues> &data)
{

    for (int i = 0; i < data.size(); i++)![image description](/upfiles/1518773204719258.png)
    {
        fs << "features";
        fs <<"{:"<< names[0] << i<<names[1] << data[i].lightValue <<names[2] << data[i].aValue<<names[3] << data[i].bValue << names[4] << data[i].xValue<<names[5] << data[i].yValue<<names[6] << data[i].depthValue<<"}";
    }
}

Geeting error while reading the xml file.

Hi , I am getting the error while reading the xml file. The error message is.."duplicate key". I have attached read and write function and screenshot of xml file.image description thank you.

link text ...........................................................................................................................................

int main()
{
std::vector<std::string> names = { "SuperPixelno", "lValue", "aValue","bValue","xCenter","yCenter","depthValue" };
cv::FileStorage fs("FeatureVector.xml", cv::FileStorage::WRITE);
superpixelSlic.writeVector(fs, names, tempCenters);
fs.release();

vector<CenterValues> readTempCenters;
std::vector<std::string> nm = { "SuperPixelno", "lValue", "aValue","bValue","xCenter","yCenter","depthValue" };
FileStorage fs2("FeatureVector.xml", FileStorage::READ);
readVector(fs2, nm, readTempCenters);
fs2.release();

return (0);
}

void readVector(FileStorage &fns, vector<std::string> nm, vector<CenterValues> &data)
{
    data.clear();

    CenterValues tmp;
    FileNode fn = fns["features"];

    if (fn.empty()) {
        return;
    }

    for (FileNodeIterator current = fn.begin(); current != fn.end(); ++current)
    {
        //FileNode item = *current;


        cout << "superpixelno. " << (double)(*current)[nm[0]];
        cout << "light Value " << (double)(*current)[nm[1]];
        cout << "a value" << (double)(*current)[nm[2]];
        cout << "b value" << (double)(*current)[nm[3]];
        cout << "x Value" << (double)(*current)[nm[4]];
        cout << "y Value" << (double)(*current)[nm[5]];
        cout << "depth Value" << (double)(*current)[nm[6]];

    }

}

void SuperpixelSlic:: writeVector(cv::FileStorage &fs, std::vector<std::string> &names, std::vector<CenterValues> &data)
{

    for (int i = 0; i < data.size(); i++)![image description](/upfiles/1518773204719258.png)
    {
        fs << "features";
        fs <<"{:"<< names[0] << i<<names[1] << data[i].lightValue <<names[2] << data[i].aValue<<names[3] << data[i].bValue << names[4] << data[i].xValue<<names[5] << data[i].yValue<<names[6] << data[i].depthValue<<"}";
    }
}

Geeting error while reading the xml file.

Hi , I am getting the error while reading the xml file. The error message is.."duplicate key". I have attached read and write function and screenshot of xml file.image description thank you.

xml data:

<?xml version="1.0"?>

   -<opencv_storage>


           -<features>

          <SuperPixelno>0</SuperPixelno>

          <lValue>2.9496402877697842e-01</lValue>

          <aValue>1.2799040767386091e+02</aValue>

          <bValue>1.2798081534772182e+02</bValue>

          <xCenter>1.1899280575539569e+01</xCenter>

          <yCenter>1.5884892086330936e+01</yCenter>

         <depthValue>-1.</depthValue>

          </features>


       -<features>

         <SuperPixelno>1</SuperPixelno>

           <lValue>1.6258596973865200e+00</lValue>

         <aValue>1.2793397524071527e+02</aValue>

         <bValue>1.2792159559834938e+02</bValue>

        <xCenter>9.6396148555708390e+00</xCenter>

        <yCenter>5.1880330123796426e+01</yCenter>

       <depthValue>-1.</depthValue>

      </features>

...........................so on.....................

link text ...........................................................................................................................................

int main()
{
std::vector<std::string> names = { "SuperPixelno", "lValue", "aValue","bValue","xCenter","yCenter","depthValue" };
cv::FileStorage fs("FeatureVector.xml", cv::FileStorage::WRITE);
superpixelSlic.writeVector(fs, names, tempCenters);
fs.release();

vector<CenterValues> readTempCenters;
std::vector<std::string> nm = { "SuperPixelno", "lValue", "aValue","bValue","xCenter","yCenter","depthValue" };
FileStorage fs2("FeatureVector.xml", FileStorage::READ);
readVector(fs2, nm, readTempCenters);
fs2.release();

return (0);
}

void readVector(FileStorage &fns, vector<std::string> nm, vector<CenterValues> &data)
{
    data.clear();

    CenterValues tmp;
    FileNode fn = fns["features"];

    if (fn.empty()) {
        return;
    }

    for (FileNodeIterator current = fn.begin(); current != fn.end(); ++current)
    {
        //FileNode item = *current;


        cout << "superpixelno. " << (double)(*current)[nm[0]];
        cout << "light Value " << (double)(*current)[nm[1]];
        cout << "a value" << (double)(*current)[nm[2]];
        cout << "b value" << (double)(*current)[nm[3]];
        cout << "x Value" << (double)(*current)[nm[4]];
        cout << "y Value" << (double)(*current)[nm[5]];
        cout << "depth Value" << (double)(*current)[nm[6]];

    }

}

void SuperpixelSlic:: writeVector(cv::FileStorage &fs, std::vector<std::string> &names, std::vector<CenterValues> &data)
{

    for (int i = 0; i < data.size(); i++)![image description](/upfiles/1518773204719258.png)
    {
        fs << "features";
        fs <<"{:"<< names[0] << i<<names[1] << data[i].lightValue <<names[2] << data[i].aValue<<names[3] << data[i].bValue << names[4] << data[i].xValue<<names[5] << data[i].yValue<<names[6] << data[i].depthValue<<"}";
    }
}

Geeting error while reading the xml file.

Hi , I am getting the error while reading the xml file. The error message is.."duplicate key". I have attached read and write function and screenshot of xml file.image description file. thank you.

xml data:

<?xml version="1.0"?>

   -<opencv_storage>


           -<features>

          <SuperPixelno>0</SuperPixelno>

          <lValue>2.9496402877697842e-01</lValue>

          <aValue>1.2799040767386091e+02</aValue>

          <bValue>1.2798081534772182e+02</bValue>

          <xCenter>1.1899280575539569e+01</xCenter>

          <yCenter>1.5884892086330936e+01</yCenter>

         <depthValue>-1.</depthValue>

          </features>


       -<features>

         <SuperPixelno>1</SuperPixelno>

           <lValue>1.6258596973865200e+00</lValue>

         <aValue>1.2793397524071527e+02</aValue>

         <bValue>1.2792159559834938e+02</bValue>

        <xCenter>9.6396148555708390e+00</xCenter>

        <yCenter>5.1880330123796426e+01</yCenter>

       <depthValue>-1.</depthValue>

      </features>

...........................so on.....................

link text ...........................................................................................................................................

int main()
{
std::vector<std::string> names = { "SuperPixelno", "lValue", "aValue","bValue","xCenter","yCenter","depthValue" };
cv::FileStorage fs("FeatureVector.xml", cv::FileStorage::WRITE);
superpixelSlic.writeVector(fs, names, tempCenters);
fs.release();

vector<CenterValues> readTempCenters;
std::vector<std::string> nm = { "SuperPixelno", "lValue", "aValue","bValue","xCenter","yCenter","depthValue" };
FileStorage fs2("FeatureVector.xml", FileStorage::READ);
readVector(fs2, nm, readTempCenters);
fs2.release();

return (0);
}

void readVector(FileStorage &fns, vector<std::string> nm, vector<CenterValues> &data)
{
    data.clear();

    CenterValues tmp;
    FileNode fn = fns["features"];

    if (fn.empty()) {
        return;
    }

    for (FileNodeIterator current = fn.begin(); current != fn.end(); ++current)
    {
        //FileNode item = *current;


        cout << "superpixelno. " << (double)(*current)[nm[0]];
        cout << "light Value " << (double)(*current)[nm[1]];
        cout << "a value" << (double)(*current)[nm[2]];
        cout << "b value" << (double)(*current)[nm[3]];
        cout << "x Value" << (double)(*current)[nm[4]];
        cout << "y Value" << (double)(*current)[nm[5]];
        cout << "depth Value" << (double)(*current)[nm[6]];

    }

}

void SuperpixelSlic:: writeVector(cv::FileStorage &fs, std::vector<std::string> &names, std::vector<CenterValues> &data)
{

    for (int i = 0; i < data.size(); i++)![image description](/upfiles/1518773204719258.png)
    {
        fs << "features";
        fs <<"{:"<< names[0] << i<<names[1] << data[i].lightValue <<names[2] << data[i].aValue<<names[3] << data[i].bValue << names[4] << data[i].xValue<<names[5] << data[i].yValue<<names[6] << data[i].depthValue<<"}";
    }
}

Geeting error while reading the xml file.

Hi , I am getting the error while reading the xml file. The error message is.."duplicate key". I have attached read and write function and screenshot of xml file. thank you.

xml data:

<?xml version="1.0"?>

   -<opencv_storage>


           -<features>

          <SuperPixelno>0</SuperPixelno>

          <lValue>2.9496402877697842e-01</lValue>

          <aValue>1.2799040767386091e+02</aValue>

          <bValue>1.2798081534772182e+02</bValue>

          <xCenter>1.1899280575539569e+01</xCenter>

          <yCenter>1.5884892086330936e+01</yCenter>

         <depthValue>-1.</depthValue>

          </features>


       -<features>

         <SuperPixelno>1</SuperPixelno>

           <lValue>1.6258596973865200e+00</lValue>

         <aValue>1.2793397524071527e+02</aValue>

         <bValue>1.2792159559834938e+02</bValue>

        <xCenter>9.6396148555708390e+00</xCenter>

        <yCenter>5.1880330123796426e+01</yCenter>

       <depthValue>-1.</depthValue>

      </features>

...........................so on.....................

link text ...........................................................................................................................................

int main()
{
std::vector<std::string> names = { "SuperPixelno", "lValue", "aValue","bValue","xCenter","yCenter","depthValue" };
cv::FileStorage fs("FeatureVector.xml", cv::FileStorage::WRITE);
superpixelSlic.writeVector(fs, names, tempCenters);
fs.release();

vector<CenterValues> readTempCenters;
std::vector<std::string> nm = { "SuperPixelno", "lValue", "aValue","bValue","xCenter","yCenter","depthValue" };
FileStorage fs2("FeatureVector.xml", FileStorage::READ);
readVector(fs2, nm, readTempCenters);
fs2.release();

return (0);
}

void readVector(FileStorage &fns, vector<std::string> nm, vector<CenterValues> &data)
{
    data.clear();

    CenterValues tmp;
    FileNode fn = fns["features"];

    if (fn.empty()) {
        return;
    }

    for (FileNodeIterator current = fn.begin(); current != fn.end(); ++current)
    {
        //FileNode item = *current;


        cout << "superpixelno. " << (double)(*current)[nm[0]];
        cout << "light Value " << (double)(*current)[nm[1]];
        cout << "a value" << (double)(*current)[nm[2]];
        cout << "b value" << (double)(*current)[nm[3]];
        cout << "x Value" << (double)(*current)[nm[4]];
        cout << "y Value" << (double)(*current)[nm[5]];
        cout << "depth Value" << (double)(*current)[nm[6]];

    }

}

void SuperpixelSlic:: writeVector(cv::FileStorage &fs, std::vector<std::string> &names, std::vector<CenterValues> &data)
{

    for (int i = 0; i < data.size(); i++)![image description](/upfiles/1518773204719258.png)
    {
        fs << "features";
        fs <<"{:"<< names[0] << i<<names[1] << data[i].lightValue <<names[2] << data[i].aValue<<names[3] << data[i].bValue << names[4] << data[i].xValue<<names[5] << data[i].yValue<<names[6] << data[i].depthValue<<"}";
    }
}