Go to Post Life is so much better when you do what you love rather than what others want you to do. - KelliV [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 10-02-2012, 09:43
dominique dominique is offline
Registered User
FTC #0211 (MK211)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Rochester,NY
Posts: 9
dominique is an unknown quantity at this point
Access to WPIImages and IPLImages

We are using SmartDashboard to view and process the images from the camera.

We have access to a WPIColorImage. Unfortunately, when we isolate the blue, red and green channel as per examples given, the detection of rectangles of a specific color (around the hoop) is erratic.

So I thougt of using HSL space to isolate specific colors but this can be done only from an IPLImage.

Paul indicated here a way to access the underneath IPLImage using a java wrapper.
http://www.chiefdelphi.com/forums/sh...ferrerid=46078
Now I have access to the IPLImage but my detection still does not work as expected - I need to see the IPLImage and check what I am doing. Anybody knows how to obtain the WPIImage from an IPLImage ? Thanks.
Reply With Quote
  #2   Spotlight this post!  
Unread 13-02-2012, 15:28
pblankenbaker pblankenbaker is offline
Registered User
FRC #0868
 
Join Date: Feb 2012
Location: Carmel, IN, USA
Posts: 103
pblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of light
Re: Access to WPIImages and IPLImages

The following code fragments demonstrate going both directions:

Code:
public WPIImage processImage(WPIColorImage colorImg) {

  // Example of getting access to the underlying IplImage of a WPIImage

  WPIImageWrapper wrapper = new WPIImageWrapper(colorImg);
  IplImage iplImage = wrapper.getIplImage();

  // Example of getting the BufferedImage from a IplImage and constructing
  // a new WPIColorImage

  WPIColorImage newColorImg = new WPIColorImage(iplImage.getBufferedImage()); 

  return newColorImg;
}
Reply With Quote
  #3   Spotlight this post!  
Unread 13-02-2012, 15:32
Jared Russell's Avatar
Jared Russell Jared Russell is online now
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,078
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Access to WPIImages and IPLImages

This is essentially what we did, and it works great.
Reply With Quote
  #4   Spotlight this post!  
Unread 15-02-2012, 10:12
nickpeq nickpeq is offline
Turing-complete
FRC #1255 (Blarglefish)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Baytown, TX
Posts: 60
nickpeq is an unknown quantity at this point
Re: Access to WPIImages and IPLImages

I understood how to do vision processing on the cRIO and our program is very good at recognizing the target using HSL color space. However, I know next to nothing about programming SmartDashboard extensions with WPI/javacv libraries. Does anyone have example code on using HSL color space with vision processing through SmartDashboard?
Reply With Quote
  #5   Spotlight this post!  
Unread 23-02-2012, 20:12
nickpeq nickpeq is offline
Turing-complete
FRC #1255 (Blarglefish)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Baytown, TX
Posts: 60
nickpeq is an unknown quantity at this point
Re: Access to WPIImages and IPLImages

Sorry to bump, but I know that someone has a solution and may have just missed this thread/post. Can anyone please give an example of how to track using HSL color space on SmartDashboard?
Reply With Quote
  #6   Spotlight this post!  
Unread 03-04-2012, 18:13
pequnp pequnp is offline
Registered User
FRC #1477
 
Join Date: Mar 2012
Location: Texas
Posts: 1
pequnp is an unknown quantity at this point
Re: Access to WPIImages and IPLImages

For accessing SmartDashboard, just extend the WPICameraExtension class provided in the jar in the SmartDashboard extensions directory.
Then just override the processImage(WPIColorImage rawImage) method. The only real change you'll need to make code wise is to figure how you want to output the data to SD. When you're done, compile your widget into a jar and place it in the extensions directory. I'm sorry, but I don't have good example code of this.
Reply With Quote
  #7   Spotlight this post!  
Unread 01-05-2012, 12:53
notmattlythgoe's Avatar
notmattlythgoe notmattlythgoe is offline
Flywheel Police
AKA: Matthew Lythgoe
FRC #2363 (Triple Helix)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Newport News, VA
Posts: 1,717
notmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond repute
Re: Access to WPIImages and IPLImages

I'm working on improving our vision processing over the off season. I'm trying to create a grid of images to display but I can't figure out how to get the BufferedImage converted back into a WPIImage. It compiles but throws this error when I try to build it.

cannot access com.googlecode.javacv.cpp.opencv_core
class file for com.googlecode.javacv.cpp.opencv_core not found
return new WPIColorImage(img);
Reply With Quote
  #8   Spotlight this post!  
Unread 03-05-2012, 13:41
notmattlythgoe's Avatar
notmattlythgoe notmattlythgoe is offline
Flywheel Police
AKA: Matthew Lythgoe
FRC #2363 (Triple Helix)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Newport News, VA
Posts: 1,717
notmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond repute
Re: Access to WPIImages and IPLImages

I got the last problem figured out but have run into another problem. I am having problems with getting the IplImage out of a WPIImage. When I try to access the image field variable it tells me that it has protected access. What is the work around for this?
Reply With Quote
  #9   Spotlight this post!  
Unread 03-05-2012, 15:46
Jared Russell's Avatar
Jared Russell Jared Russell is online now
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,078
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Access to WPIImages and IPLImages

What we did here is make a static helper class that lives within the same package namespace as the WPIJavaCV classes with methods to expose the protected member variables (since protected members are visible to all classes within the same package).
Reply With Quote
  #10   Spotlight this post!  
Unread 04-05-2012, 09:10
notmattlythgoe's Avatar
notmattlythgoe notmattlythgoe is offline
Flywheel Police
AKA: Matthew Lythgoe
FRC #2363 (Triple Helix)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Newport News, VA
Posts: 1,717
notmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond repute
Re: Access to WPIImages and IPLImages

Quote:
Originally Posted by Jared341 View Post
What we did here is make a static helper class that lives within the same package namespace as the WPIJavaCV classes with methods to expose the protected member variables (since protected members are visible to all classes within the same package).
Thanks, I had been looking at your code and missed the package line. Makes sense now.
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 22:22.

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