You need to put the pixel values ββfrom your training image in train_data, and in the answers you need to put the index corresponding to the class of this pixel (for example, 1 for the skin class, 0 for the non-skin class). var_idx and sample_idx can be left as is, they are used to mask some descriptors or samples in your training set. Set the update to true / false, depending on whether you get all the descriptors (all pixels of all training images) at once if you can allow it to be mistakenly or gradually process training images (which may be better for memory problems), and in In this case, you need to update your model.
Let me explain the code to you (not tested and use the C ++ interface for OpenCV, which I highly recommend instead of the old C)
int main(int argc, char **argv) { CvNormalBaseClassifier classifier; for (int i = 0; i < argc; ++i) { cv::Mat image =
}
source share