"channel" parameter of [net] is used in detector when preparing images for net.

This commit is contained in:
IlyaOvodov
2018-05-30 19:34:38 +03:00
parent ec766fc3f1
commit 01bec65708
6 changed files with 64 additions and 41 deletions

View File

@ -283,19 +283,26 @@ image image_data_augmentation(IplImage* ipl, int w, int h,
// HSV augmentation
// CV_BGR2HSV, CV_RGB2HSV, CV_HSV2BGR, CV_HSV2RGB
cv::Mat hsv_src;
cvtColor(sized, hsv_src, CV_BGR2HSV); // also BGR -> RGB
if (ipl->nChannels >= 3)
{
cv::Mat hsv_src;
cvtColor(sized, hsv_src, CV_BGR2HSV); // also BGR -> RGB
std::vector<cv::Mat> hsv;
cv::split(hsv_src, hsv);
std::vector<cv::Mat> hsv;
cv::split(hsv_src, hsv);
hsv[1] *= dsat;
hsv[2] *= dexp;
hsv[0] += 179 * dhue;
hsv[1] *= dsat;
hsv[2] *= dexp;
hsv[0] += 179 * dhue;
cv::merge(hsv, hsv_src);
cv::merge(hsv, hsv_src);
cvtColor(hsv_src, sized, CV_HSV2RGB); // now RGB instead of BGR
cvtColor(hsv_src, sized, CV_HSV2RGB); // now RGB instead of BGR
}
else
{
sized *= dexp;
}
// Mat -> IplImage -> image
IplImage src = sized;