We are about to switch to a new forum software. Until then we have removed the registration on this forum.
The term you are looking for is fiducials or fiducial markers.
Computer vision libraries often have built-in methods for dealing with fiducials. For Processing the two common libraries are OpenCV and BoofCV. If you search, you may find some tutorials and example code:
Are you familiar with the provided examples in those libraries? if not, that is your step #1. Step 2 is to become familiar with those libraries by looking up their documentation or previous posts:
https://forum.processing.org/two/search?Search=blobdetection
https://forum.processing.org/two/search?Search=blob (more options but more posts)
https://forum.processing.org/two/search?Search=fiducials
You can always post what you have so far and you could get some more feedback.
Kf
Fiducials might be helpful to you: https://forum.processing.org/two/search?Search=fiducials
Also consider checking the blob detection library. You can install it using the Processing's lib manager. Then check the provided examples. This should give you some alternatives.
Kf
Hey guys,
at the moment I'm working at a little spelling game for which I use fiducials for letters (reactivision), processing for the logic, and arduino for the buttons and stuff I'm using to control the game. I know, this is all done really laboriously BUT it has to be like it is. (I know that this problem comes from working with processing, reactivision and arduino at the same time...)
So the big problem is the performance. I'm also using some GUI elements of ControlP5 and everything, every single button, every println() laggs as f****. I've already changed the camera.xml of reacTVision to the lowest quality. Nothing changed.
Any suggestions?
I think you are looking for fiducials. Here there are some previous posts:
https://forum.processing.org/two/search?Search=fiducials
Kf
There are examples of marker detection specifically are in the BoofCV and OpenCV libraries. In BoofCV (and many other computer vision libraries) these "markers" may be called "fiducials" -- this will help you search for related tutorials and example code.
A recent related discussion (cross-posted):
@DeveloperITA -- Could you be more specific? "What I need seems to be" doesn't really tell me what you are trying to do.
BoofCV comes with examples that demonstrate how to use it -- including the fiducials example that I linked earlier. Is that specific example not working for you? If it is working, what specifically are you trying to change about it that isn't working?
My idea was to have one or more qr-like tags on the paper
These are often called "fiducials." There are several Processing libraries and many examples -- one recent one is BoofProcessing, which uses BoofCV to detect fiducials in the webcam input stream.
You can also search past forum discussions:
You specifically mentioned the location in three-dimensional space. Looking at the example, I believe (?) this is the BoofProcessing "world location":
List<FiducialFound> found = detector.detect(cam);
image(cam, 0, 0);
for( FiducialFound f : found ) {
println("world location "+f.getFiducialToCamera().getT());
detector.render(this,f);
}
It sounds logical. However, if you are trying to process color from your camera as a depth cue (rather than using markers) just be wary that it will be highly, highly sensitive to lighting conditions -- including shadows. You'll need a solid color floor in good lighting conditions with no windows and no light behind the user.
The major game consoles are a good illustration of the state of the art for this problem. Everybody tried to do depth with color. It didn't work. So Wii added an infrared lightbar to calibrate angle and distance, while Kinect added a special depth-sensing camera, etc. There are easy ways to make it work well -- like fiducials. Just don't be surprised if, when you don't use those ways, it doesn't work well. Nobody else got it to work well either. Of course, a living room game console is a much harder problem than an art installation -- but it gives you some context.
I could be wrong, but I think you aren't going to get enough accuracy from the accelerometer (IMU MPU6050) to do the keep-aligned-with-the-floor-while -looking-away thing that you want. Way, way too much drift.
You may need some kind of camera marker feedback. You can do them with fiducials, or edge detection, or IR lights like the Wii, or a special depth camera like the Kinect, but you'll need more position data to keep your ellipse on the floor.
If you don't care about alignment and can let things float about, the IMU should do just fine.
essentially im trying to find a edge or profile or simply a color line on a white background? ... noticing patterns connecting the dots sorta speak.
The kind of edge-following, flood-fill approach you described in your first question really doesn't have much to do with contemporary approaches to object detection.
Object detection / object recognition is a subdomain of Computer Vision -- hence "OpenCV" and "boofCV." They have blob detectors -- and convolution neural networks. Many (most) applications require training data, but if you want to (and it seems you do) you can use non-trained approaches -- still it depends on what you trying to find. Fiducials? Faces? Birds? Colored pieces of paper? That will affect the libraries / tools you use and the algorithm you choose. If a blob is moving on video, you can use background subtraction. If you are dealing with images, there are color / texture / frequency based approaches, but non-recognition systems have extremely poor performance for many applications.
Describe your problem more, rather than your ideas about approaches to pixels, and people will be able to give you better suggestions. Are you working on moving objects with video? Can you use a depth camera, like a Kinect? etc.
Hi
Thanks guys. For now i am taking a simpler approach. Here is the code.
class Fiducial {
//Change the Fiducial Marker numbers to the ones which needs to be detected.
//BoofCV returns false positives sometimes.
int[] fiducialsToDetect = {284, 643};
Fiducial() {
}
float[] trackFiducialLocation(int id) {
float[] xy = new float[2];
List<FiducialFound> found = detector.detect(cam);
for ( FiducialFound f : found ) {
if (f.getId() == id) {
xy[0] = (float) f.getImageLocation().getX();
xy[1] = (float) f.getImageLocation().getY();
}
break;
}
return xy;
}
IntList detectAvailableFiducials() {
// Detects available fiducials on the camera.
// Note that calling this method might return zero values because the fiducial might not be in the line of vision.
// The return values must be checked and appended.
// Edit int[] fiducialsToDetect variable to edit list of expected fiducial IDs.
IntList d = new IntList();
List<FiducialFound> found = detector.detect(cam);
for ( FiducialFound f : found ) {
int id = (int) f.getId();
if (!d.hasValue(id)) {
for (int i = 0; i<fiducialsToDetect.length; i++) {
if (id==fiducialsToDetect[i]) {
d.append(id);
}
}
}
}
d.sort();
if (debug) println(d);
return d;
}
}
Thanks
S
Hi
What is the best way to return <Int, Float, Float> values from a method using an array? I am trying to make a fiducial class which detects the x and y location of the fiducials identified using an ID.
I am new to processing and trying to get a hang of it. Thanks in advance.
Regards
S
Hi Jeremy,
Yes i am not expecting to have more than 5 fiducials. Thanks for your help.
Regards S
Looks good!
IntList does not guarantee unique values, but is fine if you are careful about checking and not adding to it concurrently.
Besides, I'm assuming that you are going to have something like 0-10 fiducials, not thousands. Part of the reason for using it types like Set and hashes is for better lookup performance, which isn't as big an issue with very small lists.
Hi
I am writing a class called Fiducial. This class has a method which detects the number of available Fiducials after reading from camera. I am using BoofCV to detect the Fiducials. I rewrote the code as Chrisir mentioned and also used an IntList instead of an int[] return type. It seems to work now.
Here is the code:
IntList detectAvailableFiducials() {
IntList d = new IntList();
List<FiducialFound> found = detector.detect(cam);
for ( FiducialFound f : found ) {
int id = (int) f.getId();
d.append(id);
}
d.sort();
return d;
}
Thanks for the help. How do i get the IntList to have only unique values. Does processing provide any such functions?
Thanks Sujith
Hi,
I am trying to return a list of int array in a method. But i get this error, "This method must return a result type of int[]". Can someone please let me know where i am going wrong.
int[] detectAvailableFiducials() {
int[] d = new int[3];
List<FiducialFound> found = detector.detect(cam);
for ( FiducialFound f : found ) {
append(d, f.getId());
sort(d);
return d;
}
}
I am trying to get a list of Fiducials detected by the camera. Please let me know. Thanks S
Please link between crossposts: http://stackoverflow.com/questions/40067739/boofcv-detecting-x-and-y-coordinates-of-fiducials
Hi
The latest github snapshot of BoofCV Processing returns the image x and y pixels. Thanks to Peter Abeles.
https://groups.google.com/forum/#!topic/boofcv/K56oTHyOVw0
Thanks all for the help.
Cheers S
This has to be mapped to the screen using WorldToCameraToPixel() class (i think).
Sounds like modeling from a working example would really help. Are there example / demo sketches of BoofCV fiducials? Possibly a forum search for fiducials?