|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools |
Rating:
|
Display Modes |
|
|
|
#1
|
|||
|
|||
|
Re: Tracking Rectangles with Java/C++
Quote:
How exactly are you guys accomplishing that? Power connection, networking? Not sure how that would be done as we're also thinking of doing that. |
|
#2
|
|||
|
|||
|
Re: Tracking Rectangles with Java/C++
I'm working on this problem in Java. Am I crazy or do they only make a method available for detcting ellipses and nothing else? Can we, at least, access the values for individual pixels? That way, if they give us nothing else, we could at-least write our own image processing algorithms.
|
|
#3
|
|||
|
|||
|
I believe opencv and the axiscamera's JPEG is your best shot
|
|
#4
|
|||
|
|||
|
Re: Tracking Rectangles with Java/C++
basicxman, I tried the code you suggested and I found that we were finding a ridiculous amount of rectangles(around 42 million). Do you have any idea why this is happening? Also, is there any documentation for the imaqDetectRectangles function?
|
|
#5
|
|||
|
|||
|
Re: Tracking Rectangles with Java/C++
You probably want to filter by brightness (luminance) or color (probably in HSL or HSV space) before trying to detect rectangles.
|
|
#6
|
|||
|
|||
|
Re: Tracking Rectangles with Java/C++
I have a sheet of printer paper with the target(with correct proportions) printed on it except where the retro-reflective tape would be, we just printed green. I am then extracting the green plane and going from there.
|
|
#7
|
||||
|
||||
|
Re: Tracking Rectangles with Java/C++
Our team is also trying to figure out how to track the rectangles. Ive been spending a few hours or so looking over nivision.h as well as a few white papers and i seem to have gotten this far:
Code:
m_ModifiedImage = m_HSLImage->ThresholdHSL(80,125,45,60,115,130); ImaqImage = m_ModifiedImage->GetImaqImage(); ![]() |
|
#8
|
||||
|
||||
|
Re: Tracking Rectangles with Java/C++
Quote:
|
|
#9
|
|||
|
|||
|
Re: Tracking Rectangles with Java/C++
Quote:
|
|
#10
|
||||
|
||||
|
Re: Tracking Rectangles with Java/C++
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;
}
|
|
#11
|
||||
|
||||
|
Re: Tracking Rectangles with Java/C++
What is imaqConvexHull() returning to? I have it returning to an integer but what value does the integer have?
|
|
#12
|
|||
|
|||
|
Re: Tracking Rectangles with Java/C++
From the CVI documentation,
Return Value Type Description int On success, this function returns a non-zero value. On failure, this function returns 0. To get extended error information, call imaqGetLastError(). Greg McKaskle |
|
#13
|
|||
|
|||
|
Re: Tracking Rectangles with Java/C++
Quote:
|
|
#14
|
|||
|
|||
|
Re: Tracking Rectangles with Java/C++
Quote:
RectangleMatch: http://mmrambotics.ca/wpilib/struct_...h__struct.html RectangleDescriptor: http://mmrambotics.ca/wpilib/struct_...r__struct.html |
|
#15
|
||||
|
||||
|
Re: Tracking Rectangles with Java/C++
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|