void KPropColor::setConfig() { // debug("kpropcolor::setConfig()"); if( ConfigObject ) { ConfigObject->setGroup( Group ); // debug("kpropcolor: group=%s key=%s",ConfigObject->group(), Key.data() ); if( Key.data() != 0 ) ConfigObject->writeEntry( Key.data(), getLabelColor() ); else debug("kpropcolor: Null key not allowed"); } }
void Utils::getColoredLabelMap(const cv::Mat& labelMap, cv::Mat& coloredLabelMap) { if (coloredLabelMap.empty() || coloredLabelMap.rows != labelMap.rows || coloredLabelMap.cols != labelMap.cols || coloredLabelMap.type() != CV_8UC3) { coloredLabelMap = cv::Mat(labelMap.rows, labelMap.cols, CV_8UC3); } coloredLabelMap.setTo(0); for (int i = 0; i < labelMap.cols; i++) { for (int j = 0; j < labelMap.rows; j++) { const unsigned int& label = labelMap.at<unsigned int>(cv::Point(i, j)); if (label > 0) { cv::Vec3b color = getLabelColor(label); coloredLabelMap.at<cv::Vec3b>(cv::Point(i, j))[0] = (uchar)color[0]; coloredLabelMap.at<cv::Vec3b>(cv::Point(i, j))[1] = (uchar)color[1]; coloredLabelMap.at<cv::Vec3b>(cv::Point(i, j))[2] = (uchar)color[2]; } } } }