contourfinder/opencv

Hey all.

It seems contourfinder in openCV is a little borked for me.

When I draw the contourfinder on the grayimage it lines up well but not on my kinect feed it seems to be about 20 px too high.

Any help woul dbe super appreciated.

  
  
void testApp::setup(){  
	  
	ofBackground(204,204,204);  
	ofSetCircleResolution(100);  
	ofSetFrameRate(60);  
	  
	//circle  
	myCircle.x         = 100;  
	myCircle.y         = 100;  
	myCircle.radius    = 100;  
	  
	//kinect   
	kinect.init();  
	kinect.open();  
	angle = 0;  
	//kinect.setCameraTiltAngle(angle);  
	  
	//blob detection  
	colorImg.allocate(kinect.width, kinect.height);  
	grayImage.allocate(kinect.width, kinect.height);  
	grayThresh.allocate(kinect.width, kinect.height);  
	grayThreshFar.allocate(kinect.width, kinect.height);  
	  
	nearThreshold = 230;  
	farThreshold  = 150;  
	bThreshWithOpenCV = true;  
	   
  
}  
  
//--------------------------------------------------------------  
  
void testApp::update(){  
	  
	//kinect   
	kinect.update();  
	  
	//blob detection   
	if(kinect.isFrameNew()){  
		  
		grayImage.setFromPixels(kinect.getDepthPixels(), kinect.width, kinect.height);  
  
		grayThreshFar = grayImage;  
		grayThresh = grayImage;  
		grayThresh.threshold(nearThreshold, true);  
		grayThreshFar.threshold(farThreshold);  
		cvAnd(grayThresh.getCvImage(), grayThreshFar.getCvImage(), grayImage.getCvImage(), NULL);  
  
    	contourFinder.findContours(grayImage, 10, (kinect.width*kinect.height)/2, 20, false);  
	}  
	  
}  
  
//--------------------------------------------------------------  
  
void testApp::draw(){  
	  
  
	  
	//kinect   
	kinect.draw(0, 0, 1024, 768);  
	//kinect.drawDepth(0, 0, 1024, 768);  
	  
	//blob detection  
	//grayImage.draw(0, 0, 1024, 768);  
	contourFinder.draw(0, 0, 1024, 768);  
  
	  
	//circle  
	//myCircle.draw();  
	  
}  
  
  

[attachment=0:2codfbe3]gray.png[/attachment:2codfbe3]
[attachment=1:2codfbe3]cf.png[/attachment:2codfbe3]

this is because you have to sync the depthImage to the colorImage like so:

  
depthGenerator.GetAlternativeViewPointCap().SetViewPoint(imageGenerator);  

greetings

Hi!
I just started playing around with the kinect in OF and i have the same problem. I am quite new to coding in c++ too and I don’t really understand the solution. :-\ What is depthGenerator and imageGenerator? Where in the code should this be?

Thank you, I really appreciate any help!