Go to Post So once and a while no matter how addicted you may be, try to think outside the 48'x24' box of FIRST. - Tytus Gerrish [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 03-02-2013, 13:49
Gmercer Gmercer is offline
Registered User
None #1631
 
Join Date: Jan 2013
Location: Las Vegas
Posts: 15
Gmercer is an unknown quantity at this point
How to view a binary image

I'm working on refining my auto aim code and noticed a couple bugs when the robot is looking from a certain angle. Is there a way i can save the binary image to the robot in a format maybe MS paint could open so i could view the image and check to make sure my code it right? Here is what i have for my camera function:

Code:
public void cameraCapture() throws AxisCameraException, NIVisionException {
        if (joy2.getRawButton(3)) {
            //Color Image will be our MAIN image, Binary image will be the manipulated data
            ColorImage initImg;
            BinaryImage dataImg;
            //array of particles to pass into aim function, plus the target count of particles
            ParticleAnalysisReport[] particle;
            int trgCnt;
            SmartDashboard.putString("Taken Picture", "Picture begun...");
            //if camera is 'fresh'
            if (camera.freshImage()) {
                //grab an image, set binaryImg to it and start manipulating the image
                initImg = camera.getImage();
                dataImg = initImg.thresholdRGB(0, 144, 153, 243, 34, 167);   //set threshold to bright colors(UNFINISHED)
                dataImg = dataImg.removeSmallObjects(false, 1);     //remove small pixles from image
                dataImg = dataImg.convexHull(false);                //fill in rectangles selected
                dataImg = dataImg.particleFilter(critCollection);   //filter rectangles
                trgCnt = dataImg.getNumberParticles();
                //if there are any particles, aim at them
                if (trgCnt > 0) {
                    //assign particle array of values
                    particle = dataImg.getOrderedParticleAnalysisReports();
                    SmartDashboard.putString("Taken Picture", "binary mapping finished....calling Aim");
                    Aim(particle);
                } else {
                    SmartDashboard.putString("Taken Picture", "No particles to manipulate, picture was not taken?");
                }
                //free images used
                dataImg.free();
                initImg.free();
            }
        }
    }
Criteria collection params:
Code:
critCollection.addCriteria(MeasurementType.IMAQ_MT_BOUNDING_RECT_WIDTH, 30, 400, false);
        critCollection.addCriteria(MeasurementType.IMAQ_MT_BOUNDING_RECT_HEIGHT, 20, 400, false);
Reply With Quote
 


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:29.

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