Go to Post I jumped up and yelled when I saw both my teams in the same division. Less running for me in the pits. Thank you, Great Homie in the Sky! - Barry Bonzack [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 06-02-2016, 20:15
The Doctor's Avatar
The Doctor The Doctor is offline
Robotics is life
AKA: Hackson
FRC #3216 (MRT)
Team Role: Programmer
 
Join Date: Mar 2014
Rookie Year: 2013
Location: United States
Posts: 155
The Doctor is on a distinguished road
Running a custom deinterlacng program on the driver station

I'm trying to get two cameras running on our robot this year. I've started putting some code into our main program [Java]:

globals:
Code:
final int numcameras = 2; // we've got this many cameras
int[] cameras;
int curcamera;
NIVision.Image curframe;
CameraServer cserver;
init:
Code:
curframe = NIVision.imaqCreateImage(NIVision.ImageType.IMAGE_RGB, 0);
for (int i = 0; i < numcameras; i++) {
	cameras[i] = NIVision.IMAQdxOpenCamera("cam" + (i+1), NIVision.IMAQdxCameraControlMode.CameraControlModeController);
	NIVision.IMAQdxConfigureGrab(cameras[i]);
}
curcamera = 0;
cserver = CameraServer.getInstance();
periodic:
Code:
curcamera += 1; curcamera %= numcameras;
NIVision.IMAQdxGrab(cameras[curcamera], curframe, 1);
cserver.setImage(curframe);
...However, this code will rapidly switch between the cameras. What I want to do is write a program to run on the driver station, to "deinterlace" the images, by displaying every other frame in its own spot. I'm quite fluent in Processing (Java with some cool libraries), which would make deinterlacing the images easy if I had the image stream available... My question is: how do I get raw image data from the robot on the driver station? I ideally want a solution that can work through the FMS.

Is there a part of the NIVision library that can receive this stream? Or do I need another Java library? And how is it possible to access the video stream with third-party programs in the DS?
__________________
Robots + Python + pentesting == me;
Blog ~ GitHub ~ Keybase
If you have a pressing issue to discuss with me, kik me at slush.puddles since I don't check CD very often.
  #2   Spotlight this post!  
Unread 06-02-2016, 21:59
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,752
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Running a custom deinterlacng program on the driver station

Do you want to mod the images on the stream? Separating them, for example, into evens and odds to display into two different displays.

Or do you truly mean that you want to take even and odd lines in an single image and merge or separate them.

I sorta assume the first, in which case, you can have take the i terminal in the while loop that is getting the images and use the Integer Divide and Remainder to divide by 2. This is the % equivalent in LV. Use the remainder of 0 or 1 wired to a case statement to display into the correct image display.

Greg McKaskle
  #3   Spotlight this post!  
Unread 07-02-2016, 11:31
The Doctor's Avatar
The Doctor The Doctor is offline
Robotics is life
AKA: Hackson
FRC #3216 (MRT)
Team Role: Programmer
 
Join Date: Mar 2014
Rookie Year: 2013
Location: United States
Posts: 155
The Doctor is on a distinguished road
Re: Running a custom deinterlacng program on the driver station

Quote:
Originally Posted by Greg McKaskle View Post
Do you want to mod the images on the stream? Separating them, for example, into evens and odds to display into two different displays.

Or do you truly mean that you want to take even and odd lines in an single image and merge or separate them.
What I meant to say is that every other frame is from a different camera. Say we have two cameras, A and B. The video stream would look like this:

ABABABABABAB

The driver station would then simply grab every frame, and display the A frames in one window and the B frames in another. It would halve the framerate for each camera, but that's not important.
__________________
Robots + Python + pentesting == me;
Blog ~ GitHub ~ Keybase
If you have a pressing issue to discuss with me, kik me at slush.puddles since I don't check CD very often.
  #4   Spotlight this post!  
Unread 07-02-2016, 19:26
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,752
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Running a custom deinterlacng program on the driver station

OK. So that is cleared up.


The receiving stuff is not in NIVision, but in the dashboard code. The loop allocates one image, gets the images, and displays them in one display. If you customize to have two displays, then you can write the images to alternate displays using even/odd code described above.

Greg McKaskle
Closed Thread


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 05:07.

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