Hey, try checking out my guide. It explains how to do the vision processing parts of what you're trying to do.
As for the rest, check out
my code for automatic turret tracking. RobotMap.top[0] is the reported x coordinate of the center of the detected target. If you're doing your own vision processing, just pass it that value as such. CameraXOffset is just 160, the x value of the center of the camera's vision. HorizontalTurretAxis.rotate() is a method I added to
HorizontalTurretAxis, but replace that with whatever you want the PID output to be of course.
If you need more explanation on how this works please ask.
TL;DR image processing sends x,y coordinates of detected target back to a command that runs a PID controller using that coordinate as input and your motors as output to align itself.