Пример #1
0
static void process(char *ims, char *imt, char* imd){
 	pnm pims = pnm_load(ims);
 	pnm pimt = pnm_load(imt);

 	int colst = pnm_get_width(pimt);
 	int rowst = pnm_get_height(pimt);

 	int colss = pnm_get_width(pims);
 	int rowss = pnm_get_height(pims);

 	pnm pimd = pnm_new(colst, rowst, PnmRawPpm);

 	float * LABs = malloc(colss * rowss * 3 * sizeof(float));
 	float * LABt = malloc(colst * rowst * 3 * sizeof(float));
 	float * LABd = malloc(colst * rowst * 3 * sizeof(float));

 	// Conversion des images sources (pims) et target (pimt) en format lab (LABs et LABt)
 	RGB2LAB(pims, LABs, colss, rowss);
 	RGB2LAB(pimt, LABt, colst, rowst);

 	// Colorisation de l'image de destination LABd (en format lab)
 	colorization(LABs, LABt, LABd, colst, rowst, colss, rowss);

 	// Conversion de l'image de destination (LABd) en format RGB (pimd)
 	LAB2RGB(pimd, LABd, colst, rowst);

 	free(LABs);
 	free(LABt);
 	free(LABd);

 	pnm_save(pimd, PnmRawPpm, imd);
 	pnm_free(pimt);
 	pnm_free(pimd);
 	pnm_free(pims);
 }
Пример #2
0
// LABNode
bool
cpu_tsdf::LABNode::addObservation (float d_new, float w_new, float max_weight, 
                uint8_t r, uint8_t g, uint8_t b)
{
  float wsum = w_ + w_new;
  float L_new, A_new, B_new;
  RGB2LAB (r, g, b, L_new, A_new, B_new);
  uint8_t r_reconv, g_reconv, b_reconv;
  LAB2RGB (L_new, A_new, B_new, r_reconv, g_reconv, b_reconv);
  L_ = (w_*L_ + w_new*L_new) / wsum;
  A_ = (w_*A_ + w_new*A_new) / wsum;
  B_ = (w_*B_ + w_new*B_new) / wsum;
  return (OctreeNode::addObservation (d_new, w_new, max_weight));
}
Пример #3
0
bool
cpu_tsdf::LABNode::getRGB (uint8_t &r, uint8_t &g, uint8_t &b) const
{
  LAB2RGB (L_, A_, B_, r, g, b);
  return (true);
}