16 numImages(imageProviderInfo.numberImages),
17 width(imageProviderInfo.imageFormat.dimension.width),
18 height(imageProviderInfo.imageFormat.dimension.height)
23 ss <<
"Tried to initialize HsvImageSegmentation with " << numImages
24 <<
" images, but need at least 1 image.";
25 throw std::invalid_argument(ss.str());
28 allocate(imageProviderInfo);
53 return inputImagesRgb;
58 return inputImagesHsv;
63 return inputVisuImages;
68 return outputImagesGray;
73 return outputImagesRgb;
85 for (
int i = 0; i < numImages; ++i)
87 ::ImageProcessor::CopyImage(inputImagesRgb[i], inputVisuImages[i]);
90 ::ImageProcessor::CalculateHSVImage(inputImagesRgb[i], inputImagesHsv[i]);
93 ::ImageProcessor::FilterHSV(inputImagesHsv[i], outputImagesGray[i],
94 hue, hueTol, satMin, satMax, valMin, valMax);
97 ::ImageProcessor::ConvertImage(outputImagesGray[i], outputImagesRgb[i],
true);
103 inputImagesRgb =
new CByteImage*[numImages];
104 inputVisuImages =
new CByteImage*[numImages];
105 inputImagesHsv =
new CByteImage*[numImages];
106 outputImagesGray =
new CByteImage*[numImages];
107 outputImagesRgb =
new CByteImage*[numImages];
109 for (
int i = 0; i < numImages; ++i)
114 outputImagesGray[i] =
new CByteImage(width, height, CByteImage::eGrayScale);
119 void HsvImageSegmentation::deallocate()
123 for (
int i = 0; i < numImages; ++i)
125 delete inputImagesRgb[i];
126 delete inputVisuImages[i];
127 delete inputImagesHsv[i];
128 delete outputImagesGray[i];
129 delete outputImagesRgb[i];
132 delete[] inputImagesRgb;
133 delete[] inputVisuImages;
134 delete[] inputImagesHsv;
135 delete[] outputImagesGray;
136 delete[] outputImagesRgb;
138 inputImagesRgb =
nullptr;
139 inputVisuImages =
nullptr;
140 inputImagesHsv =
nullptr;
141 outputImagesGray =
nullptr;
142 outputImagesRgb =
nullptr;
148 this->numImages = other.numImages;
149 this->height = other.height;
150 this->width = other.width;
153 this->inputImagesRgb = other.inputImagesRgb;
154 this->inputVisuImages = other.inputVisuImages;
155 this->inputImagesHsv = other.inputImagesHsv;
156 this->outputImagesGray = other.outputImagesGray;
157 this->outputImagesRgb = other.outputImagesRgb;
160 other.numImages = other.height = other.width = 0;
161 other.inputImagesRgb = other.inputImagesHsv = other.inputVisuImages =
nullptr;
162 other.outputImagesGray = other.outputImagesRgb =
nullptr;