Esempio n. 1
0
fb_pixel_t Hsv2SysColor(HsvColor *hsv, uint8_t tr)
{
	RgbColor rgb;
	Hsv2Rgb(hsv, &rgb);
	return (((tr    << 24) & 0xFF000000) |
		((rgb.r << 16) & 0x00FF0000) |
		((rgb.g <<  8) & 0x0000FF00) |
		((rgb.b      ) & 0x000000FF));
}
Esempio n. 2
0
void Utility::drawField(mat_3f& vecField, mat_3f& canvas, mat_u& mask) {
	cv::Size fieldSize = vecField.size();

	float h, s, v, r1, g, b;
	float avg = 1;
	for (int r=0; r<fieldSize.height; r++) {
		for (int c=0; c<fieldSize.width; c++) {
			if (!mask(r, c))
				continue;
			cv::Vec3f& vec = vecField(r, c);
			float tmpH=vec[0];
			float tmpV=vec[1];
			float orient = 180 * (atan2(tmpV, tmpH)+3.1415926)/3.1415926;
			h = orient;
			s =1;
			v =sqrt(tmpH*tmpH+tmpV*tmpV)/avg;
			Hsv2Rgb(h, s, v, r1, g, b);
			cv::circle(canvas, cv::Point(c, r), 1, cv::Scalar(g, r1, b), 
			CV_FILLED, CV_AA);
		}
	}
}