Go to Post So I thought to myself "Man, I wish I was a part of a large technically minded community... oh... right..." - BordomBeThyName [more]
Home
Go Back   Chief Delphi > FIRST > General Forum
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rating: Thread Rating: 5 votes, 4.80 average. Display Modes
  #31   Spotlight this post!  
Unread 16-01-2012, 13:24
pattyb112 pattyb112 is offline
Registered User
FLL #1517
 
Join Date: Jan 2011
Location: Concord NH
Posts: 1
pattyb112 is an unknown quantity at this point
Re: Tracking Rectangles with Java/C++

Does anybody know how to perform the convex hull operations mentioned in the White Paper in Java? It specifically states that C/C++ and LabView can do it but there is nothing about Java and we are really scratching our heads over the problem.

If anyone could help us out on this problem it would be greatly appreciated. Thanks!
Reply With Quote
  #32   Spotlight this post!  
Unread 16-01-2012, 20:42
dvanvoorst dvanvoorst is offline
Registered User
FRC #2771 (Code Red)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Grand Rapids, MI
Posts: 70
dvanvoorst is an unknown quantity at this point
Re: Tracking Rectangles with Java/C++

Quote:
Originally Posted by rudun View Post
Would this be how to use the detectRectangles function in java. We looked at the ellipseDetect and I am thinking that hey do the same thing just based on different descriptors.

Code:
    private static final BlockingFunction imaqDetectRectanglesFn =
            NativeLibrary.getDefaultInstance().getBlockingFunction("imaqDetectRectangles");
    static { imaqDetectRectanglesFn.setTaskExecutor(NIVision.taskExecutor); }
    private static Pointer numberOfRectanglesDetected = new Pointer(4);
    
     public static RectangleMatch[] detectRectangles(MonoImage image, RectangleDescriptor rectangleDescriptor,
            CurveOptions curveOptions, ShapeDetectionOptions shapeDetectionOptions,
            RegionOfInterest roi) throws NIVisionException {

        int curveOptionsPointer = 0;
        if (curveOptions != null)
            curveOptionsPointer = curveOptions.getPointer().address().toUWord().toPrimitive();
        int shapeDetectionOptionsPointer = 0;
        if (shapeDetectionOptions != null)
            shapeDetectionOptionsPointer = shapeDetectionOptions.getPointer().address().toUWord().toPrimitive();
        int roiPointer = 0;
        if (roi != null)
            roiPointer = roi.getPointer().address().toUWord().toPrimitive();

        int returnedAddress =
                imaqDetectRectanglesFn.call6(
                image.image.address().toUWord().toPrimitive(),
                rectangleDescriptor.getPointer().address().toUWord().toPrimitive(),
                curveOptionsPointer, shapeDetectionOptionsPointer,
                roiPointer,
                numberOfRectanglesDetected.address().toUWord().toPrimitive());

        try {
            NIVision.assertCleanStatus(returnedAddress);
        } catch (NIVisionException ex) {
            if (!ex.getMessage().equals("No error."))
                throw ex;
        }

        RectanglesMatch[] matches = RectanglesMatch.getMatchesFromMemory(returnedAddress, numberOfRectanglesDetected.getInt(0));
        NIVision.dispose(new Pointer(returnedAddress,0));
        return matches;
    }
Where are RectangleMatch and RectangleDescriptor defined? I'd love to use this code to learn more about wrapping the IMAQ functions, but I'm running stuck getting it to compile.
Reply With Quote
  #33   Spotlight this post!  
Unread 16-01-2012, 20:43
basicxman basicxman is offline
Emily Horsman
FRC #2200 (MMRambotics)
Team Role: Programmer
 
Join Date: Oct 2007
Rookie Year: 2007
Location: Burlington, Ontario
Posts: 971
basicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant future
Send a message via AIM to basicxman Send a message via MSN to basicxman Send a message via Yahoo to basicxman
Re: Tracking Rectangles with Java/C++

Quote:
Originally Posted by dvanvoorst View Post
Where are RectangleMatch and RectangleDescriptor defined? I'd love to use this code to learn more about wrapping the IMAQ functions, but I'm running stuck getting it to compile.
Check out nivision.h and the CVI documentation mentioned earlier.

RectangleMatch: http://mmrambotics.ca/wpilib/struct_...h__struct.html

RectangleDescriptor:
http://mmrambotics.ca/wpilib/struct_...r__struct.html
Reply With Quote
  #34   Spotlight this post!  
Unread 21-01-2012, 17:37
basicxman basicxman is offline
Emily Horsman
FRC #2200 (MMRambotics)
Team Role: Programmer
 
Join Date: Oct 2007
Rookie Year: 2007
Location: Burlington, Ontario
Posts: 971
basicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant future
Send a message via AIM to basicxman Send a message via MSN to basicxman Send a message via Yahoo to basicxman
Re: Tracking Rectangles with Java/C++

Quote:
Originally Posted by basicxman View Post
Here's a snippet of [entirely untested as I don't currently have access to a cRio] code.
Do not use this snippet! After I finally got to experiment with the camera for a while today, I've fixed some flaws in that script and found a better way of doing it entirely.
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 21:38.

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