RobotCasserole1736 / RobotCasserole2015

Code for the 2015 Recycle Rush robot for team 1736
1 stars 1 forks source link

Investigate Dual Camera Usage #1

Open imdunne8 opened 9 years ago

imdunne8 commented 9 years ago

Setting up the camera: http://wpilib.screenstepslive.com/s/4485/m/24194/l/144985-configuring-an-axis-camera

Vision Processing 2014: https://wpilib.screenstepslive.com/s/3120/m/8731 (no 2015 examples/help available at this time)

Also, look at our past code to see how we interacted with the camera.

The two axis cameras will need separate IP addresses, and those will have to be passed into each constructor.

gerth2 commented 9 years ago

See http://wpilib.screenstepslive.com/s/4485/m/13503/l/242608-roborio-networking for info on IP address usage in the FRC control system

There is also an example project in Eclipse for communicating with a network camera and drawing things on the image.

imdunne8 commented 9 years ago

Good Java OpenCV example of tote tracking.

https://github.com/fauge7/YellowToteTracker/blob/master/src/com/team3019/VisionCode/YellowToteTracker.java

nzietlow commented 9 years ago

The code is complete, we just need to find the correct coordinates for the lines and test the code.

imdunne8 commented 9 years ago

Apparently we may need to use: CameraServer = CameraServer.getInstance().setImage(image);

See last line of post here: http://www.reddit.com/r/FRC/comments/2ta7er/woo_with_some_help_from_faust_1706_i_believe_weve/

imdunne8 commented 9 years ago

Got it working tonight!! Still need to do some further color value tuning and maybe use some more complex algorithms to find edges rather than just finding contours, but overall it's working fairly well. See NickD_YellowToteTracker branch.

imdunne8 commented 9 years ago

com.ni.vision.NIVision.Image im = com.ni.vision.NIVision.imaqCreateImage(com.ni.vision.NIVision.ImageType.IMAGE_RGB, 0); com.ni.vision.NIVision.RawData data = new com.ni.vision.NIVision.RawData(); byte[] bytes = new byte[frame.width() * frame.height() * frame.channels()]; frame.get(0, 0, bytes); ByteBuffer buf = ByteBuffer.wrap(bytes); data.setBuffer(buf); com.ni.vision.NIVision.imaqArrayToImage(im, data, frame.width(), frame.height());