View Single Post
  #8   Spotlight this post!  
Unread 03-02-2009, 22:57
yoyodyne yoyodyne is offline
Registered User
AKA: Greg Smith
FRC #0116 (Epsilon Delta)
Team Role: Engineer
 
Join Date: Jan 2006
Rookie Year: 2004
Location: Reston, VA
Posts: 61
yoyodyne is a splendid one to beholdyoyodyne is a splendid one to beholdyoyodyne is a splendid one to beholdyoyodyne is a splendid one to beholdyoyodyne is a splendid one to beholdyoyodyne is a splendid one to beholdyoyodyne is a splendid one to behold
Re: TrackTwoColors execution time

We've been trying to break up the image processing into three pieces, so that each piece would hopefully take up no more that 15ms. That way as long as all the other code that we run for each periodic loop executes in less than 5ms we will keep the system deterministic. That way we could process at 15fps which is what our tracking group says the need to keep the kalman filter converged for a worst case 20fps closing scenario. (In the latest WPILIB, the periodic period is always the DS packet rate or 20ms - we missed that in the release notes and it took a while to figure out what happened)

Anyway, what we did was in the first stage create three images. One to get the image from the camera and the other two as the output binary images from frcColorThreshold(). We want to hang onto the threshold output images so we can move the processing around to tweak the timing. What we have found so far is that frcColorThreshold() only seems to work if the source and destination image pointers are the same? Of course, I can't find the definition of the Image or Image_struct structure all I can find is:

01918 typedef struct Image_struct Image;

So it is pretty hard to figure out why frcColorThreshold() is failing - returning a 0.

One thing is that I think frcColorThreshold() is supposed to return a "binary" image but there are no image types for binary, U8 is the smallest. So right now the code creates all three images with the reasoning being that the threshold routine works with cameraImage as the input and output image.


cameraImage = frcCreateImage(IMAQ_IMAGE_HSL);
firstColorThreshImage = frcCreateImage(IMAQ_IMAGE_HSL);
secondColorThreshImage = frcCreateImage(IMAQ_IMAGE_HSL);

Anyway, the reason we are trying to do this is because we want to make sure that the pink and green thresholding use the same frame. I suppose that we could copy the image and then overwrite the original and the copy in the threshold function but I was wondering if anyone had any insight as to why

success = frcColorThreshold(colorThreshImage, cameraImage, mode, plane1Range, plane2Range, plane3Range);

always fails and

success = frcColorThreshold(cameraImage, cameraImage, mode, plane1Range, plane2Range, plane3Range);

Is successful.
Reply With Quote