13 numImages(imageProviderInfo.numberImages),
14 width(imageProviderInfo.imageFormat.dimension.width),
15 height(imageProviderInfo.imageFormat.dimension.height)
20 ss <<
"Tried to initialize HsvImageSegmentation with " << numImages
21 <<
" images, but need at least 1 image.";
22 throw std::invalid_argument(ss.str());
25 allocate(imageProviderInfo);
52 return inputImagesRgb;
58 return inputImagesHsv;
64 return inputVisuImages;
70 return outputImagesGray;
76 return outputImagesRgb;
95 for (
int i = 0; i < numImages; ++i)
97 ::ImageProcessor::CopyImage(inputImagesRgb[i], inputVisuImages[i]);
100 ::ImageProcessor::CalculateHSVImage(inputImagesRgb[i], inputImagesHsv[i]);
103 ::ImageProcessor::FilterHSV(
104 inputImagesHsv[i], outputImagesGray[i], hue, hueTol, satMin, satMax, valMin, valMax);
107 ::ImageProcessor::ConvertImage(outputImagesGray[i], outputImagesRgb[i],
true);
114 inputImagesRgb =
new CByteImage*[numImages];
115 inputVisuImages =
new CByteImage*[numImages];
116 inputImagesHsv =
new CByteImage*[numImages];
117 outputImagesGray =
new CByteImage*[numImages];
118 outputImagesRgb =
new CByteImage*[numImages];
120 for (
int i = 0; i < numImages; ++i)
125 outputImagesGray[i] =
new CByteImage(width, height, CByteImage::eGrayScale);
131 HsvImageSegmentation::deallocate()
135 for (
int i = 0; i < numImages; ++i)
137 delete inputImagesRgb[i];
138 delete inputVisuImages[i];
139 delete inputImagesHsv[i];
140 delete outputImagesGray[i];
141 delete outputImagesRgb[i];
144 delete[] inputImagesRgb;
145 delete[] inputVisuImages;
146 delete[] inputImagesHsv;
147 delete[] outputImagesGray;
148 delete[] outputImagesRgb;
150 inputImagesRgb =
nullptr;
151 inputVisuImages =
nullptr;
152 inputImagesHsv =
nullptr;
153 outputImagesGray =
nullptr;
154 outputImagesRgb =
nullptr;
161 this->numImages = other.numImages;
162 this->height = other.height;
163 this->width = other.width;
166 this->inputImagesRgb = other.inputImagesRgb;
167 this->inputVisuImages = other.inputVisuImages;
168 this->inputImagesHsv = other.inputImagesHsv;
169 this->outputImagesGray = other.outputImagesGray;
170 this->outputImagesRgb = other.outputImagesRgb;
173 other.numImages = other.height = other.width = 0;
174 other.inputImagesRgb = other.inputImagesHsv = other.inputVisuImages =
nullptr;
175 other.outputImagesGray = other.outputImagesRgb =
nullptr;