コード例 #1
0
ファイル: main.cpp プロジェクト: DoQuy/glMiSOM
int main( int argc, char* argv[] )
{
        // load an image
        IplImage* image = cvLoadImage("motor.jpg");

        ///-- extract global image descriptors --

        // create a Frame object (see include/Frame.h)
        // allocate memory for 3-channel color and 1-channel gray image and mask
        Frame* frame = new Frame( image->width, image->height, true, true, true);

        // set the image of the frame
        frame->setImage(image);

        // compute Color Structure descriptor
        XM::ColorStructureDescriptor* csd = Feature::getColorStructureD(frame, 32);

        // write to screen
        for(unsigned int i = 0; i < csd->GetSize(); i++)
                std::cout << (int)csd->GetElement(i) << " " ;
        std::cout << std::endl;

        // release descriptor
        delete csd;

        // release the images..
        delete frame;
        cvReleaseImage(&image);

        return 0;
}
コード例 #2
0
ファイル: local_color_node.cpp プロジェクト: ferdianap/eris
void LocalColorFeat::localColorCb(
	const visor::detEntityArray::ConstPtr& msg
){
	cv_bridge::CvImagePtr cv_ptr;
	
	lcolor_.object_color.clear();
	lcolor_.header.stamp = msg->header.stamp;
	lcolor_.object_count = msg->count;
	cinfo_.header.stamp = msg->header.stamp;
	cinfo_.size = 64; //msg->count;		
	for (int i=0; i<msg->count; i++) {
		try {
			cv_ptr = cv_bridge::toCvCopy(msg->entity[i], sensor_msgs::image_encodings::BGR8);
			// ROS_WARN("OBJECT %d: ", i);
			Frame* frame = new Frame( cv_ptr->image );
			XM::ColorStructureDescriptor* csd = Feature::getColorStructureD(frame, cinfo_.size);
			cinfo_.desc.clear();
			for(int i = 0; i < csd->GetSize(); i++) {
				// std::cout << (int)csd->GetElement(i) << " ";
				// Assign each element to cinfo_.desc
				cinfo_.desc.push_back((int)csd->GetElement(i));
			}
			// std::cout << std::endl;
			delete csd;
			lcolor_.object_color.push_back(cinfo_);
		} catch (cv_bridge::Exception& e) {
			ROS_ERROR("LOCAL COLOR <- cv_bridge exception: %s", e.what());
			return;
		}
	}
	pub_.publish(lcolor_);
}
コード例 #3
0
ファイル: mpeg7.cpp プロジェクト: varungupta181186/vistool
Descriptor ColorStructure::extract_(MyImage *image,
				   bool makeVisRep,
				   Magick::Image *repr){
  cv::Mat &img = *image->getOpenCVMat();
  Frame* frame = new Frame(img);
  XM::ColorStructureDescriptor *ehd = Mpeg7Feature::getColorStructureD(frame, 64);
  Descriptor desc;
  for(size_t i = 0; i < ehd->GetSize(); ++i)
    desc.push_back((float) ehd->GetElement(i));
  return desc;
}
コード例 #4
0
ファイル: FexWrite.cpp プロジェクト: elfmedy/2013
// Color Structure
void FexWrite::computeWriteCSD( Frame* frame, int descSize )
{
	if(!frame)
		return;

    // compute the descriptor
	XM::ColorStructureDescriptor* csd = Feature::getColorStructureD(frame, descSize);

	// write to screen
	for(unsigned int i = 0; i < csd->GetSize(); i++)
		std::cout << (int)csd->GetElement(i) << " " ;
	std::cout << std::endl;

    // release descriptor
	delete csd;
}