示例#1
0
void SuperResolution_setInput(struct SuperResolutionPtr ptr, struct FrameSourcePtr frameSource)
{
    cv::Ptr<superres::FrameSource> tempPtr(
            static_cast<superres::FrameSource *>(frameSource.ptr));
    rescueObjectFromPtr(tempPtr);
    ptr->setInput(tempPtr);
}
/**
Restores and check the values of a CImMimeHeader
*/
void CTestImapMailStoreHeaders::TestCImMimeHeaderL()
	{
	
	
	INFO_PRINTF1(KTestingCImMimeHeader);
	INFO_PRINTF1(KRestoringCImMimeHeader);
	iServerEntry->SetEntry(iAttMessageEntry);
	CMsvStore* store=iServerEntry->ReadStoreL();
	CleanupStack::PushL(store);
	CImMimeHeader* header = CImMimeHeader::NewLC();	
	header->RestoreL(*store);
	
	TPtrC8 tempPtr8(KImailHeader1);
	ASSERT_EQUALS(header->ContentType(),tempPtr8);
	ASSERT_EQUALS(header->ContentDescription(),tempPtr8);
	ASSERT_EQUALS(header->ContentDescription(),tempPtr8);
	
	tempPtr8.Set(KImailHeader9);
	ASSERT_EQUALS(header->ContentDisposition(),tempPtr8);
	ASSERT_EQUALS(header->ContentDisposition(),tempPtr8);
	
	tempPtr8.Set(KImailHeader4);
	ASSERT_EQUALS(header->ContentID(),tempPtr8);
	
	tempPtr8.Set(KImailHeader3);
	ASSERT_EQUALS(header->ContentBase(),tempPtr8);	

	TPtrC tempPtr(KImailHeader6);
	ASSERT_EQUALS(header->ContentLocation(),tempPtr);

	CleanupStack::PopAndDestroy(2,store);
	}
示例#3
0
void SuperResolution_setOpticalFlow(struct SuperResolutionPtr ptr, struct DenseOpticalFlowExtPtr val)
{
    cv::Ptr<FakeOpticalFlow> tempPtr(
            static_cast<FakeOpticalFlow *>(val.ptr));
    rescueObjectFromPtr(tempPtr);
    ptr->setOpticalFlow(tempPtr);
}
示例#4
0
void BPTree::insert(Value key,PtrType pointer)
{
	 
	PtrType nodePtr = findLeafNode(key);
	Node node(dbName,nodePtr,indexName,tableInstance,n);
	if (node.getCount() < (n - 1))
		insertLeaf(node,key,pointer);
	else
	{
		//排序
		vector<Value> keyList = node.getInfo();//只读键值对
		if (isLess(key,keyList[0]))
		{
			keyList.insert(keyList.begin(),key);
			Value temp(_TYPE_INT,pointer);
			keyList.insert(keyList.begin(),temp);
		}
		else
		{
			for (int i = (keyList.size() - 1 - 1); i >= 0; i-=2)
			{
				if (isLessEqual(keyList.at(i),key))
				{
					Value tempPtr(_TYPE_INT,pointer);
					keyList.insert(keyList.begin() + i+1,tempPtr);
					keyList.insert(keyList.begin() + i+2,key);
					break;
				}
			}
		}
		
		//更新尾指针
		Node newNode(dbName,indexName,tableInstance,n);
		PtrType newNodePtr = newNode.getNodePtr();
		newNode.setLastPtr(node.getLastPtr());
		node.setLastPtr(newNodePtr);

		//赋值元素到该到的地方
		int breakPoint = 0;
		if (n % 2 == 0)
			breakPoint = (n /2)*2;
		else
			breakPoint = ((n / 2) + 1)*2;
		vector<Value> temp(keyList.begin(),keyList.begin() + breakPoint);
		node.set(temp);//只写键值对
		vector<Value> temp2(keyList.begin() + breakPoint,keyList.end());//TODO:左闭右开?
		newNode.set(temp2);

		insertNonleaf(node,temp2[0],newNodePtr);
	}
}
示例#5
0
Enemy::Enemy(std::string n, std::string s, Vector3 loc)
{
    fprintf(stderr, "Enemy constructing\n");
    name = n;
    spritePath = s;
    boost::shared_ptr<Sprite> tempPtr(new Sprite(s));
    enemySprite = tempPtr;
    location = loc;
    velocity.x = 0;
    velocity.y = 0;
    velocity.z = 0;

    velocity_max = 2.0f;
    directional_thruster_power = 0.01f;
    thrust = 0.01f;
    shipRotation = 0.0f;
    brakePower = 0.03f;
}
/**
Restores and check the values of a CImHeader
*/
void CTestImapMailStoreHeaders::TestCImHeaderL()
	{
	INFO_PRINTF1(KTestingCImHeader);
	INFO_PRINTF1(KRestoringCImHeader);
	iServerEntry->SetEntry(iMsvMessageEntry);	
	CMsvStore* store=iServerEntry->ReadStoreL();
	CleanupStack::PushL(store);
	CImHeader* header = CImHeader::NewLC();	
	header->RestoreL(*store);

	TPtrC tempPtr(KMiutSubject);	
	ASSERT_EQUALS(header->Subject(),tempPtr);	
	tempPtr.Set(KMiutFrom);
	ASSERT_EQUALS(header->From(),tempPtr);
	
	TPtrC8 tempPtr8(KMiutMsgId);
	ASSERT_EQUALS(header->ImMsgId(),tempPtr8);
	tempPtr.Set(KMiutReplyTo);
	ASSERT_EQUALS(header->ReplyTo(),tempPtr);
	CleanupStack::PopAndDestroy(2,store);
	}
示例#7
0
void BPTree::insertLeaf(Node node,Value key,PtrType pointer)
{
	vector<Value> keyList = node.getInfo();//只读键值对
	if (isLess(key,keyList[0]))
	{
		keyList.insert(keyList.begin(),key);
		Value temp(_TYPE_INT,pointer);
		keyList.insert(keyList.begin(),temp);
	}
	else
	{
		for (int i = (keyList.size() - 1 - 1); i >= 0; i-=2)
		{
			if (isLessEqual(keyList.at(i),key))
			{
				Value tempPtr(_TYPE_INT,pointer);
				keyList.insert(keyList.begin() + i+1,tempPtr);
				keyList.insert(keyList.begin() + i+2,key);
				break;
			}
		}
	}
	node.set(keyList);
}
/**************************************************************************
 * AUTHOR		: Naveen Sundar G
 * DATE			: 
 * NAME			: 
 * DESCRIPTION	: 
 * ARGUMENTS	: 
 * RETURNS		: 
 * NOTES			:
 * CHANGE HISTROY
 * Author			Date			
 ****************************************************************************/
LTKShapeFeaturePtr PointFloatShapeFeatureExtractor::getShapeFeatureInstance()
{
	LTKShapeFeaturePtr tempPtr(new PointFloatShapeFeature);	
	return tempPtr;
}
示例#9
0
void ActivenessComponent::OnNotify(IParam &param)
{
    std::string strActiveModule;
    param.GetParam(std::string("activeness"), strActiveModule);
    int nTargetType = ActivenessTargetConfig::GetTypeFromName(strActiveModule);

    ActivenessTargetConfig  targetConfig;
    if (!ActivenessDataManager::Instance().GetTarget(nTargetType, targetConfig))
    {
        return;
    }

    // 根据当前时间充值活动数据
    ResetActivinessData(time(NULL));

    ActivenessTarget* pTarget = ActivenessTargetFactory::Instance().CreateTarget(targetConfig);
    if (pTarget == NULL)
    {
        return;
    }
    // 用于自动释放内存
    std::auto_ptr<ActivenessTarget> tempPtr(pTarget);

    // 设置数据
    pTarget->SetProgress(GetTargetProgress(nTargetType));
    if (nTargetType == ActivenessTargetConfig::EType_DanceMode)
    {
        ((ActivenessDanceModeTarget*)pTarget)->SetFinishedDanceMode(m_setFinishedDanceMode);
    }

    //目标是否完成
    if (pTarget->IsTargetComplete())
    {
        return;
    }

    // 更新目标进度
    if (pTarget->UpdateProgress(param))
    {
        // 更新component进度
        UpdateTarget(*pTarget);
    }

    // 更新活跃度
    if (pTarget->IsTargetComplete())
    {
        AddActiveness(pTarget->GetTargetScore(), nTargetType);

        if (CanGetReward())
        {
            // 重新通知前端
            SendActivenessInfo();
        }

        // 增加舞团试炼活力值
        CommonParam commonParam;
        commonParam.SetParam("dance_group_active", pTarget->GetTargetScore());
        NotifyAll(commonParam);
    }

    SaveActivinessDataToDb(); // 保存数据
}
示例#10
0
/**********************************************************************************
* AUTHOR        : Bharath A
* DATE          : 12-Jun-2008
* NAME          : getShapeFeatureInstance
* DESCRIPTION   : Returns an NPenShapeFeature instance
* ARGUMENTS     :
* RETURNS       : An NPenShapeFeature instance
* NOTES         :
* CHANGE HISTROY
* Author            Date                Description of change
*************************************************************************************/
LTKShapeFeaturePtr NPenShapeFeatureExtractor::getShapeFeatureInstance()
{
	LTKShapeFeaturePtr tempPtr(new NPenShapeFeature);
	return tempPtr;
}
示例#11
0
void CSTTrackerConnection::MHFRunL(RHTTPTransaction aTransaction, 
						  			const THTTPEvent& aEvent)
{
	switch (aEvent.iStatus)
	{
		case THTTPEvent::EGotResponseHeaders:
		{
			// HTTP response headers have been received. Use
			// aTransaction.Response() to get the response. However, it's not
			// necessary to do anything with the response when this event occurs.

			LWRITELN(iLog, _L("[Trackerconnection] Got HTTP headers"));
			// Get HTTP status code from header (e.g. 200)
			RHTTPResponse resp = aTransaction.Response();
			TInt status = resp.StatusCode();
			
			if (status != 200) // ERROR, hiba esetén mi legyen? 404-et lekezelni!
			{
				LWRITE(iLog, _L("[Trackerconnection] Error, status = "));
				TBuf<20> numBuf;
				numBuf.Num(status);
				LWRITELN(iLog, numBuf);
				Cancel();
				if (iObserver)
					iObserver->TrackerConnectionFailedL();
				break;
			}

			// Get status text (e.g. "OK")
			HLWRITE(iLog, _L("[Trackerconnection] Status text = "));
			TBuf<32> statusText;
			statusText.Copy(resp.StatusText().DesC());
			HLWRITELN(iLog, statusText);
			
			
			#ifdef LOG_TO_FILE
			RHTTPHeaders headers = 
				aTransaction.Response().GetHeaderCollection();		
			THTTPHdrFieldIter i =
				headers.Fields();
			for (i.First(); !(i.AtEnd()); ++i)
			{
				RStringF header = iSession.StringPool().StringF(i());
				
				if ((header.DesC() == _L8("Content-Type")))
				{
					HLWRITE(iLog, header.DesC());
					HLWRITE(iLog, _L(": "));
					THTTPHdrVal	val;
					headers.GetField(header, 0, val);
					RStringF value = val.StrF();
					HLWRITELN(iLog, value.DesC());
				}
				else
					HLWRITELN(iLog, header.DesC());
			}
						
			#endif
		}
		break;

		case THTTPEvent::EGotResponseBodyData:
		{			
			// Part (or all) of response's body data received. Use 
			// aTransaction.Response().Body()->GetNextDataPart() to get the actual
			// body data.						

			// Get the body data supplier
			MHTTPDataSupplier* body = aTransaction.Response().Body();
			TPtrC8 dataChunk;						

			// GetNextDataPart() returns ETrue, if the received part is the last 
			// one.
			TBool isLast = body->GetNextDataPart(dataChunk);
			
			//iDownloadedSize += dataChunk.Size();						
			
			HLWRITELN(iLog, _L8("[TrackerConnection] HTTP response body chunk received: "));
			HLWRITELN(iLog, dataChunk);
			
			if (iReceiveBuffer)
			{
				HBufC8* temp = HBufC8::NewL(
					iReceiveBuffer->Length() + dataChunk.Length());
				TPtr8 tempPtr(temp->Des());
				tempPtr.Copy(*iReceiveBuffer);
				tempPtr.Append(dataChunk);
				
				delete iReceiveBuffer;
				iReceiveBuffer = temp;
			}
			else
				iReceiveBuffer = dataChunk.AllocL();

			// Always remember to release the body data.
			body->ReleaseData();
		
			// NOTE: isLast may not be ETrue even if last data part received.
			// (e.g. multipart response without content length field)
			// Use EResponseComplete to reliably determine when body is completely
			// received.
			if (isLast)
			{
				
				#ifdef LOG_TO_FILE
				_LIT(KBodyReceived,"Body received");
				HLWRITELN(iLog, KBodyReceived);
				#endif
				
				//CSTBencode* bencodedResponse = CSTBencode::ParseL(*iReceiveBuffer);	
				//iLog->WriteLineL(*iReceiveBuffer);
				//
				//if (bencodedResponse)
				//{
				//	CleanupStack::PushL(bencodedResponse);
				//	iTorrent.ProcessTrackerResponseL(bencodedResponse);
				//	CleanupStack::PopAndDestroy(); // bencodedResponse
				//}
			}
		}
		break;

		case THTTPEvent::EResponseComplete:
		{
			// Indicates that header & body of response is completely received.
			// No further action here needed.
			//_LIT(KTransactionComplete, "Transaction Complete");
			//iLog->WriteLineL(KTransactionComplete);
			//iResult = ESucceeded;
		}
		break;

		case THTTPEvent::ESucceeded:
		{
			LWRITELN(iLog, _L("[Trackerconnection] HTTP transaction succeded"));

			CSTBencode* bencodedResponse = CSTBencode::ParseL(*iReceiveBuffer);	
			//iLog->WriteLineL(*iReceiveBuffer);
			
			if (bencodedResponse && iObserver)
			{
				CleanupStack::PushL(bencodedResponse);
				iObserver->TrackerResponseReceivedL(*bencodedResponse);
				CleanupStack::PopAndDestroy(); // bencodedResponse
			}
			
			iRunning = EFalse;
			
			if (iObserver)
				iObserver->TrackerConnectionSucceededL();
		}
		break;

		case THTTPEvent::EFailed:
		{
			LWRITELN(iLog, _L("[Trackerconnection] HTTP transaction failed"));
			iRunning = EFalse;
			if (iObserver)
				iObserver->TrackerConnectionFailedL();
		}
		break;

		default:
			// There are more events in THTTPEvent, but they are not usually 
			// needed. However, event status smaller than zero should be handled 
			// correctly since it's error.
		{
			TBuf<64> text;
			if (aEvent.iStatus < 0)
			{
				LWRITE(iLog, _L("[Trackerconnection] HTTP transaction failed, "));
				_LIT(KErrorStr, "Error: %d");
				text.Format(KErrorStr, aEvent.iStatus);
				LWRITELN(iLog, text);
			
				// Just close the transaction on errors
				aTransaction.Close();
				iRunning = EFalse;
				
				if (iObserver)
					iObserver->TrackerConnectionFailedL();
			}
			else
			{
				// Other events are not errors (e.g. permanent and temporary
				// redirections)
				_LIT(KUnrecognisedEvent, "[Trackerconnection] Unrecognised event: %d");
				text.Format(KUnrecognisedEvent, aEvent.iStatus);
				LWRITELN(iLog, text);
			}		
		}
		break;
	}
}
示例#12
0
void BPTree::insertNonleaf(Node node,Value key,PtrType pointer)
{
	 
	if (node.getNodePtr() == root)
	{
		Node newNode(dbName,indexName,tableInstance,n);
		vector<Value> keyList;
		Value temp1(_TYPE_INT,node.getNodePtr());
		Value temp2(_TYPE_INT,pointer);
		keyList.push_back(temp1);
		keyList.push_back(key);
		keyList.push_back(temp2);
		newNode.set(keyList);
		root = newNode.getNodePtr();
		//把根节点的更改写入磁盘
		int firstBlock = bfm->getIndexBlocks(indexName)[0];//获取开始的块
		Node rootNode(dbName,firstBlock,indexName,tableInstance,n);
		Value temp3(_TYPE_INT,root);
		vector<Value> temp4;
		temp4.push_back(temp3);
		rootNode.set(temp4);
	}
	else
	{
		Node parentNode(dbName,findParentNode(node.getNodePtr()),indexName,tableInstance,n);
		if (parentNode.getCount() < n)
		{
			vector<Value> keyList = parentNode.getInfo();//只读键值对
			if (isLess(key,keyList[0]))
			{
				Value tempPtr(_TYPE_INT,pointer);
				keyList.insert(keyList.begin()+1,tempPtr);
				keyList.insert(keyList.begin()+1,key);
			}
			else
			{
				for (int i = (keyList.size() - 1 - 1); i >= 0; i-=2)
				{
					if (isLessEqual(keyList.at(i),key))
					{
						Value tempPtr(_TYPE_INT,pointer);
						keyList.insert(keyList.begin() + i+2,tempPtr);//TODO:最后一个会怎么样?
						keyList.insert(keyList.begin() + i+2,key);
						break;
					}
				}
			}
			parentNode.set(keyList);
		}
		else//分裂ParentNode
		{
			//排序
			vector<Value> keyList = parentNode.getInfo();//只读键值对
			if (isLess(key,keyList[0]))
			{
				Value tempPtr(_TYPE_INT,pointer);
				keyList.insert(keyList.begin()+1,tempPtr);
				keyList.insert(keyList.begin()+1,key);
			}
			else
			{
				for (int i = (keyList.size() - 1 - 1); i >= 0; i-=2)
				{
					if (isLessEqual(keyList.at(i),key))
					{
						Value tempPtr(_TYPE_INT,pointer);
						keyList.insert(keyList.begin() + i+2,tempPtr);//TODO:最后一个会怎么样?
						keyList.insert(keyList.begin() + i+2,key);
						break;
					}
				}
			}

			//赋值元素到该到的地方
			int breakPoint = 0;
			if (n % 2 == 0)
				breakPoint = (n /2);
			else
				breakPoint = ((n / 2) + 1);
			vector<Value> temp;
			temp.push_back(keyList[0]);
			int j = 1;
			for (int i = 1; i < breakPoint; i++)
			{
				temp.push_back(keyList[j]);
				temp.push_back(keyList[++j]);
			}
			parentNode.set(temp);

			Value newK = keyList[++j];
			vector<Value> temp2;
			for (int i = j + 1; i < keyList.size(); i++)
			{
				temp2.push_back(keyList[i]);
			}
			Node newNode(dbName,indexName,tableInstance,n);
			newNode.set(temp2);

			insertNonleaf(parentNode,newK,newNode.getNodePtr());
		}
	}
}
int
 main (int argc, char** argv)
{
  pcl::PointCloud<pcl::PointXYZ> cloud;

  pcl::io::loadPCDFile(argv[1],cloud);
  //pcl::io::loadPLYFile(argv[1], cloud);

  pcl::ModelCoefficients::Ptr coefficients (new pcl::ModelCoefficients);
  pcl::PointIndices::Ptr inliers (new pcl::PointIndices);
  // Create the segmentation object

  pcl::SACSegmentation<pcl::PointXYZ> seg;
  // Optional
  seg.setOptimizeCoefficients (true);
  // Mandatory
  seg.setModelType (pcl::SACMODEL_PLANE);
  seg.setMethodType (pcl::SAC_RANSAC);
  double distanceTh = 0.025;
  if(argc > 2)
      distanceTh = atof(argv[2]);
  seg.setDistanceThreshold (distanceTh);

  seg.setInputCloud (cloud.makeShared ());
  seg.segment (*inliers, *coefficients);

  if (inliers->indices.size () == 0)
  {
    PCL_ERROR ("Could not estimate a planar model for the given dataset.");
    return (-1);
  }

  std::cerr << "Model coefficients: " << coefficients->values[0] << " " 
                                      << coefficients->values[1] << " "
                                      << coefficients->values[2] << " " 
                                      << coefficients->values[3] << std::endl;

  pcl::PointCloud<pcl::PointXYZ> output;
  output.width = inliers->indices.size();
  output.height = 1;
  output.points.resize(output.width * output.height);

  std::cerr << "Model inliers: " << inliers->indices.size () << std::endl;
  for (size_t i = 0; i < inliers->indices.size (); ++i){
    /*std::cerr << inliers->indices[i] << "    " << cloud.points[inliers->indices[i]].x << " "
                                               << cloud.points[inliers->indices[i]].y << " "
                                               << cloud.points[inliers->indices[i]].z << std::endl;*/
    output.points[i].x = cloud.points[inliers->indices[i]].x;
    output.points[i].y = cloud.points[inliers->indices[i]].y;
    output.points[i].z = cloud.points[inliers->indices[i]].z;
  }
  pcl::PointCloud<pcl::PointXYZ> object;

  pcl::ExtractIndices<pcl::PointXYZ> extract;
  pcl::PointCloud<pcl::PointXYZ>::Ptr tempPtr(new pcl::PointCloud<pcl::PointXYZ>);
  pcl::copyPointCloud(cloud,*tempPtr);
  extract.setInputCloud(tempPtr);
  extract.setIndices(inliers);
  extract.setNegative(true);
  extract.filter(object);

  pcl::io::savePCDFile("output.pcd",output);
  pcl::io::savePCDFile("object.pcd",object);


  /*THE PLANAR SEGMENT REMOVED NOW RUN CLUSTERING AND COMPARE WITH EACH ONE.*/
  system("../eucliden_clustering/build/cluster_extraction ./object.pcd");
  return (0);
}