Esempio n. 1
0
// Color Layout
void FexWrite::computeWriteCLD( Frame* frame, int numYCoef, int numCCoef )
{
	if(!frame)
		return;

    // compute the descriptor
	XM::ColorLayoutDescriptor* cld = Feature::getColorLayoutD( frame, numYCoef, numCCoef );

	// write to screen

	// number of coefficients
	int numberOfYCoeff = cld->GetNumberOfYCoeff();
	int numberOfCCoeff = cld->GetNumberOfCCoeff();


	// values
	int *y_coeff, *cb_coeff, *cr_coeff;
	y_coeff = cld->GetYCoeff();
	cb_coeff = cld->GetCbCoeff();
	cr_coeff = cld->GetCrCoeff();


	int i = 0;
	// Y coeff (DC and AC)
	for ( i = 0; i < numberOfYCoeff; i++ )
		std::cout << y_coeff[i] << " " ;

	//Cb coeff  (DC and AC)
	for ( i = 0; i < numberOfCCoeff; i++ )
		std::cout << cb_coeff[i] << " ";

	//Cr coeff  (DC and AC)
	for ( i = 0; i < numberOfCCoeff; i++ )
		std::cout << cr_coeff[i] << " ";

	std::cout << std::endl;

    // release the descriptor
	delete cld;
}
Esempio n. 2
0
Descriptor ColorLayout::extract_(MyImage *image,
				 bool makeVisrep,
				 Magick::Image *repr){
  cv::Mat &img = *image->getOpenCVMat();
  Frame *frame = new Frame(img);
  XM::ColorLayoutDescriptor *xmdesc = 
    Mpeg7Feature::getColorLayoutD(frame);
  size_t nY = xmdesc->GetNumberOfYCoeff();
  size_t nC = xmdesc->GetNumberOfCCoeff();
  int *YCoeff  = xmdesc->GetYCoeff();
  int *CbCoeff = xmdesc->GetCbCoeff();
  int *CrCoeff = xmdesc->GetCrCoeff();

  // write coefficients to single descriptor
  Descriptor desc;
  for(size_t i = 0; i < nY; i++)
    desc.push_back((float) YCoeff[i]);
  for(size_t i = 0; i < nC; i++)
    desc.push_back((float) CbCoeff[i]);
  for(size_t i = 0; i < nC; i++)
    desc.push_back((float) CrCoeff[i]);
  return desc;
}