added sample on color generation and updated sample on lsvm

This commit is contained in:
Maria Dimashova
2011-10-06 09:43:43 +00:00
parent 408d6b84fa
commit e6009c1614
2 changed files with 38 additions and 9 deletions

View File

@@ -53,7 +53,7 @@ void detectAndDrawObjects( Mat& image, LatentSvmDetector& detector, const vector
for( size_t i = 0; i < detections.size(); i++ )
{
const LatentSvmDetector::ObjectDetection& od = detections[i];
rectangle( image, od.rect, colors[od.classID], 2 );
rectangle( image, od.rect, colors[od.classID], 3 );
}
// put text over the all rectangles
for( size_t i = 0; i < detections.size(); i++ )
@@ -102,12 +102,6 @@ void readDirectory( const string& directoryName, vector<string>& filenames, bool
sort( filenames.begin(), filenames.end() );
}
void fillRngColors( vector<Scalar>& colors )
{
Mat m = Mat(colors).reshape(1,1);
randu( m, 0, 255 );
}
int main(int argc, char* argv[])
{
help();
@@ -150,8 +144,8 @@ int main(int argc, char* argv[])
cout << "overlapThreshold = " << overlapThreshold << endl;
vector<Scalar> colors( detector.getClassNames().size() );
fillRngColors( colors );
vector<Scalar> colors;
generateColors( colors, detector.getClassNames().size() );
for( size_t i = 0; i < images_filenames.size(); i++ )
{