Go to Post Sometimes, having someone that can teach you just shows you another way to do what you've been doing, but in fewer moves. - Amanda Morrison [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 08-02-2016, 22:19
gruffen gruffen is offline
Registered User
FRC #1648
 
Join Date: Jan 2016
Location: Atlanta
Posts: 3
gruffen is an unknown quantity at this point
Axis camera not retrieving images

Hi all,

So we decided to switch to the Axis 206 for vision processing, and so far we've been unsuccessful in grabbing images to process and sending them to dashboard.

The connection appears to be set up (I can see the camera feed in the LabVIEW dashboard when I select "IP Camera"), and there seems to be no other errors. The images don't show up at all.

Here is the code we've been using:

Code:
package org.usfirst.frc.team1648.robot;

import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;

import com.ni.vision.NIVision;
import com.ni.vision.NIVision.Image;
import com.ni.vision.NIVision.ImageType;

import edu.wpi.first.wpilibj.vision.AxisCamera;
import edu.wpi.first.wpilibj.CameraServer;

public class Robot extends IterativeRobot {

 int session;
    Image frame; 
    Image binaryFrame;
    AxisCamera camera;

 public void robotInit() {
 frame = NIVision.imaqCreateImage(NIVision.ImageType.IMAGE_RGB, 0);
		binaryFrame = NIVision.imaqCreateImage(ImageType.IMAGE_U8, 0);
}
public void teleopPeriodic() {
        while (isOperatorControl() && isEnabled()){
        	SmartDashboard.putNumber("Number of particles", 0);
        	grabImage();
        	Timer.delay(0.005);
        }
    }
Nothing appears to be wrong, and we can't figure out why. Thanks for the help!
Reply With Quote
  #2   Spotlight this post!  
Unread 10-02-2016, 21:51
Justin Buist Justin Buist is offline
Registered User
FRC #4003 (TriSonics)
Team Role: Mentor
 
Join Date: Feb 2015
Rookie Year: 2015
Location: Allendale, MI
Posts: 18
Justin Buist is an unknown quantity at this point
Re: Axis camera not retrieving images

Are you sure that's all of your code? I don't even see a definition for grabImage() in there. Giving us the whole picture might help.
Reply With Quote
  #3   Spotlight this post!  
Unread 12-02-2016, 19:52
gruffen gruffen is offline
Registered User
FRC #1648
 
Join Date: Jan 2016
Location: Atlanta
Posts: 3
gruffen is an unknown quantity at this point
Re: Axis camera not retrieving images

Quote:
Originally Posted by Justin Buist View Post
Are you sure that's all of your code? I don't even see a definition for grabImage() in there. Giving us the whole picture might help.
Wow, that was a big mistake there- I didn't even notice it. Thanks for pointing that out. Here's grabImage():

Code:
public void grabImage(){

 if (Pilot.getRawButton(A_BUTTON)){
    		
camera.getImage(frame);
CameraServer.getInstance().setImage(frame);
    		
NIVision.imaqColorThreshold(binaryFrame, frame, 255, NIVision.ColorMode.HSL, 
HIGHGOAL_HUE_RANGE, HIGHGOAL_SAT_RANGE, HIGHGOAL_LUM_RANGE);

int numParticles = NIVision.imaqCountParticles(binaryFrame, 1);
SmartDashboard.putNumber("masked particles", numParticles);
			
CameraServer.getInstance().setImage(binaryFrame);
			
    	}
    }
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 08:54.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi