I'm trying to detect a texture using OpenCV. The texture would be similar to that of a brush on a paintbrush, so on an image it would have many many little lines together. I've tried using Hough Lines to be able to distinguish the texture from other things, but it hasn't been working out too well, as too many other false positives are detected. Other than that, I've had ideas about using Template Matching as well as Fast-Fourier Transforms, but I haven't tried testing or implementing them.
So, would anyone else have any idea of a possible method to do this? Maybe use some other line detector or an edge detector? Or would that bring up too many false positives?
This texture should be able to be detected in a cluttered scene and the algorithm for doing so should be relatively fast, since I want it to be tracked in real-time if possible. Sorry for not being able to post a sample of the texture I want (too less rep l0l), but you can simply search up paintbrush/paintbrush texture if you really need to see what it looks like. But if you've seen a paintbrush before, it should be pretty obvious which part I'm talking about (the part with the brush).
Thanks in advance, really appreciate it.
Related
I've been trying to extract hand-drawn circles from a document for a while now but every attempt I make doesn't have the level of consistency I need.
Process Album
The problem I keep coming up against is when 2 "circles" are too close they become a single contour, ruining my attempt to detect if a contour is curved. I'm sure there must be a better way to extract these circles, but their imperfection and inconsistency are really stumping me.
I've tried many other ways to single out the curves, the most accurate of which being:
Rather than use dilation to bridge the gap between the segmented contours, find the endpoints and attempt to continue the curve until it hits another contour.
Problem: I can't effectively find the turning points of the contour, otherwise this would be my preferable method
I apologize if this question is deemed "too specific", but I feel like Computer Vision stuff like this can always be applied elsewhere.
Thanks ahead of time for any and all help, I'm about at the end of my rope here.
EDIT: I've just realized the album wasn't working correctly, I think it should be fixed now though.
It looks like a very challenging problem so it is very likely that the things I am going to write wouldn't work very well in practice.
In order to ease the problem, I would probably try to remove as much of other stuff from the image as possible.
If the template of the document is always the same, it might be worth trying to remove horizontal and vertical lines along with grayed areas. For example, given the empty template, substract it from the document that you are processing. Probably, it might be possible to get rid of the text also. This would result in an image with only parts of hand drawn circles.
On such image, detecting circles or ellipses with hough transform might give some results (although shapes might be far from circles or ellipses).
I am very new to CV, and I am trying to check for an image in a snapshot in an iphone app, something very simple (like an overly simple QR code -- I only need to really know if it is one of two images). The concept is to play "laser tag" with an iphone camera. If someone is wearing a badge, I want to know they badge is there, and which badge it is. This should be adjusted for lighting and affine transformations. It seems like scaling with template matching might not be strong enough (even though the image could be whatever I want it to be) due to affine transformations and lighting issues. Something like haar cascading seems like big overkill, but I am very new to CV, so I really don't know where to start, or if this process will be necessary. Any advice about the tradeoffs of the various ways to approach this problem would be helpful. What OpenCV methods are going to be helpful, and which ones will probably not work? What designs would be easiest to detect for to denote the two teams. Encoding more data than two teams would be great, but not necessary for now.
A much stronger version of what I need to do is implemented in the Plickers app, so insight on how you think that is done with opencv would be helpful.
I'm a fairly extreme newbie to the world of graphics programming, so forgive me if this question has an obvious answer, but I haven't managed to track it down.
When the depth test is being performed in DirectX 11, how do you identify which triangles are being tested at any given time? I'm trying to manually tell the depth test to fail unless specific polygons are being viewed through specific polygons (i.e., you can see one set of geometry through only one surface, and another set only through another surface).
I guess the real question is, when a pixel is being tested, how does the system reference the data for that pixel (position, color, etc.)? Is there just something I'm completely overlooking?
For the time being, I'm not interested in alternate solutions to the greater problem, just an answer to this particular question. Thanks for any help!
I'm working on a game idea (2D) that needs directional lights. Basically I want to add light sources that can be moved and the light rays interact with the other bodies on the scene.
What I'm doing right now is some test where using sensors (box2d) and ccDrawLine I could achieve something similar to what I want. Basically I send a bunch of sensors from certain point and with raycast detect collisions, get the end points and draw lines over the sensors.
Just want to get some opinions if this is a good way of doing this or is other better options to build something like this?
Also I would like to know how to make a light effect over this area (sensors area) to provide a better looking light effect. Any ideas?
I can think of one cool looking effect you could apply. Put some particles inside the area where light is visible, like sparks shining and falling down very slowly, something like on this picture
Any approach to this problem would need to use collision detection anyway so your is pretty nice providing you have limited number of box2d objects.
Other approach when you have a lot of box2d objects I would think of is to render your screen to texture with just solid colors (should be fast) and perform ray tracing on that generated texture to find pixels that are going to be affected by light. That way you are limited to resolution not the number of box2d objects.
There is a good source code here about dynamic and static lights in a 2D space.
It's Ruby code but easy to understand so it shouldn't be long to port it to Obj-C/Cocos2D/box2D.
I really hope it will help you as it helped me.
Hm, interesting question. Cocos2D does provide some rather flexible masking effects. You could have a gradient mask that you lay over your objects, where its position depends on the position of the "light", thereby giving the effect that your objects were being coloured by the light.
I was hoping someone could point me in the right direction here. With a picture of a die (from above) I want to recognize which side is up.
I understand the basics in play here, but I'm having trouble grasping the power of OpenCV. I imagine I want a picture of each side of the die. Then I can somehow compare them all to the current image to be classified. How can I use OpenCV to do this?
Thanks,
Jonathan
While that would work and OpenCV has template matching functions, it would probably be harder than necessary. Good results would require that the lighting is more or less unchanged between all images, and that the camera is fixed and no projective distorsions occur.
Instead, I would do something like this:
In the image, locate the die. The difficulty here will vary with regard to how the die looks and the background. If you have a white die on a lpain black (or some other color) background then finding the die will be easy.
When the die has been located, find the eyes. This can be done by simply finding all black blobs.
If necessary, make sure that the found eyes form a coherent pattern. E.g. if the side up is four you expect to find the eyes as the corners in a square, not on a straight line.
Count valid eyes. There's your side up.
This outline is quite vague as there are lots of ways of performing each step. I do however believe that everything you need is available in OpenCV.
Good luck!