KisColor::KisColor(const KisColor& color, KisColor::Type type) { if(color.getType() == type) initHSX(type, color.getH(), color.getS(), color.getX(), color.getA()); else initRGB(type, color.getR(), color.getG(), color.getB(), color.getA()); }
KisColor::KisColor(float hue, float a, Type type) { float r = 0; float g = 0; float b = 0; ::getRGB(r, g, b, hue); initRGB(type, r, g, b, a); }
void KinectInterfacePrimesense::initOpenNI(const char* device_uri) { initOpenNIStatic(); if (device_uri) { cout << "Initializing device " << device_uri << "..." << endl; } else { cout << "Initializing first avaliable openNI device..." << endl; } // Open a connection to the OpenNI device const char* deviceURI = openni::ANY_DEVICE; if (device_uri != NULL) { deviceURI = device_uri; } device_ = new openni::Device(); checkOpenNIRC(device_->open(deviceURI), "Failed to connect to device"); const openni::DeviceInfo& info = device_->getDeviceInfo(); device_uri_ = info.getUri(); // Note: XYZ (real world values are ALL wrong when image registration is // turned on). It looks OK for a single Kinect, but the space is warped. // This is an OpenNI bug: setCropDepthToRGB(false); setDepthColorSync(false); // Open a connection to the device's depth channel initDepth(); const int depth_size = depth_dim_[0] * depth_dim_[1]; labels_ = new uint8_t[depth_size]; pts_world_ = new float[3 * depth_size]; pts_uvd_ = new float[3 * depth_size]; registered_rgb_ = new uint8_t[3 * depth_size]; // Open a connection to the device's rgb channel bool sync_ir_stream_ = false; initRGB(!sync_ir_stream_); initIR(sync_ir_stream_); bool flip_image_ = true; setFlipImage(flip_image_); std::this_thread::sleep_for(std::chrono::milliseconds(1)); // Update the OpenNIFuncs constants float depth_hfov = streams_[DEPTH_STREAM]->getHorizontalFieldOfView(); float depth_vfov = streams_[DEPTH_STREAM]->getVerticalFieldOfView(); openni_funcs_ = new OpenNIFuncs(depth_dim_[0], depth_dim_[1], depth_hfov, depth_vfov, openni_devices_open_); // Check OpenNI's math: //uint64_t zpd; //streams_[DEPTH_STREAM]->getProperty(XN_STREAM_PROPERTY_ZERO_PLANE_DISTANCE, &zpd); //double zpps; //streams_[DEPTH_STREAM]->getProperty(XN_STREAM_PROPERTY_ZERO_PLANE_PIXEL_SIZE, &zpps); //double focal_length_cmos = (double)zpd / zpps; //// http://en.wikipedia.org/wiki/Angle_of_view FOV calculation //double FOVh = 2.0 * atan( ( 1280.0 * 0.5 ) / focal_length_cmos ); //double FOVv = 2.0 * atan( ( 960.0 * 0.5 ) / focal_length_cmos ); //std::streamsize old_precision = std::cout.precision(); //std::cout.precision(15); //std::cout << "FOVh = " << FOVh << std::endl; //std::cout << "FOVv = " << FOVv << std::endl; //std::cout << "depth_hfov = " << depth_hfov << std::endl; //std::cout << "depth_vfov = " << depth_vfov << std::endl; //std::cout.precision(old_precision); std::cout << "Finished initializaing OpenNI device" << std::endl; }
KisColor::KisColor(const QColor& color, Type type) { initRGB(type, color.redF(), color.greenF(), color.blueF(), color.alphaF()); }
KisColor::KisColor(float r, float g, float b, float a, Type type) { initRGB(type, r, g, b, a); }
KisColor::KisColor(Type type) { initRGB(type, 0.0f, 0.0f, 0.0f, 0.0f); }
KisColor::KisColor(Qt::GlobalColor color, Type type) { QColor c(color); initRGB(type, c.redF(), c.greenF(), c.blueF(), c.alphaF()); }