View Single Post
  #4   Spotlight this post!  
Unread 26-01-2017, 22:15
Thad House Thad House is offline
Volunteer, WPILib Contributor
no team (Waiting for 2021)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Thousand Oaks, California
Posts: 1,107
Thad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond repute
Re: Vision problem - robot view not matching Grip view

The reason for this is that OpenCV actually modifies the Mat passed into it when running findContours. Since the Mat from the HSV Threshold is passed into findContours directly, it modifies the Mat that is being sent to the dashboard.

The solution to this is to create a new Mat in the class (call it hsvSend or something like that). Then at the end of the HSVThreshold function, call hsvout.copyTo(hsvSend);. Then putSource the hsvSend mat instead of the hsvout mat

hsvout might not be the right name, I don't remember. But it's just the one that is the output from the inRange function.

As another hint, you are HIGHLY overexposing your image. Either lower the voltage to your light source, or lower the exposure on the camera. It will make tracking much easier and more reliable.
__________________
All statements made are my own and not the feelings of any of my affiliated teams.
Teams 1510 and 2898 - Student 2010-2012
Team 4488 - Mentor 2013-2016
Co-developer of RobotDotNet, a .NET port of the WPILib.
Reply With Quote