Thread: Open CV help
View Single Post
  #1   Spotlight this post!  
Unread 02-02-2017, 16:51
elijah1111's Avatar
elijah1111 elijah1111 is offline
Registered User
FRC #4601 (Circuit Birds)
Team Role: Programmer
 
Join Date: Jan 2017
Rookie Year: 2015
Location: Ohio
Posts: 15
elijah1111 is an unknown quantity at this point
Question Open CV help

Hey anybody got any ideas on Open CV? We were planning on using it for auto gears.
Code:
static void VisionThread(){
//blah blah set up cameras

while(true){
inRange(mat,cv::Scalar(0,100,0),cv::Scalar(100,255,100),mat)//find green light
cv::findContours(mat,contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_TC89_KCOS);//find reflect tape
			cv::drawContours(mat,contours,-1,cv::Scalar(255,255,255),1,8);//draw them
cameraserver.putframe(mat);//put the modifed image matrix
centerpoints.read()//I need to find the centerpoints here how would I do that?
}
}

void RobotInit(){
std::thread camthread(VisionThread);//makes a new thread
camthread.detach();//snaps the thread off to do its own thing
}

void AutonomousPeriodic(){
 camera.read()//Here is where I need help how do I get the two threads to talk
}
Anybody got any suggestions? I was thinking if you could calculate the distance between the two center points and you know the actual distance you can find out how far you are from the peg for the gear.

Thanks,
Elijah
4601

P.S. actual code is here https://github.com/CircuitBirds-FRC4601/CB5
Reply With Quote