Is there something missing in the chain code?
I am not able to read the image and how can i retrieve the xml file and save it? Can someone help..
#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/imgproc/imgproc_c.h"
#include <iostream>
using namespace std;
using namespace cv;
int main() {
Mat img = imread("Outline.jpg"); //outline of foot
imshow("Test", img);
vector<vector<Point> > contours;
findContours(img, contours, RETR_EXTERNAL, CV_CHAIN_CODE);
cout << Mat(contours[0]) << endl;
findContours(img, contours, RETR_EXTERNAL, CHAIN_APPROX_SIMPLE);
cout << "CHAIN_APPROX_SIMPLE" << endl;
cout << Mat(contours[0]) << endl;
CvChain* chain = 0;
CvMemStorage* storage = 0;
storage = cvCreateMemStorage(0);
cvFindContours(&IplImage(img), storage, (CvSeq**)(&chain), sizeof(*chain), CV_RETR_TREE,
CV_CHAIN_CODE);
for (; chain != NULL; chain = (CvChain*)chain->h_next)
{
CvSeqReader reader;
int i, total = chain->total;
cvStartReadSeq((CvSeq*)chain, &reader, 0);
cout<<"--------------------chain\n";
for (i = 0; i<total; i++)
{
char code;
CV_READ_SEQ_ELEM(code, reader);
cout<<"%d"<<code;
}
}
waitKey(0);
return 0;
}
opencv version? 1.0 or 2.4.9 3.2.0-dev?
@LBerger 2.4.9
Sorry it's too old for me. You have an example here and filestorage doc is here.