Hi,
I want basic steps/tips to solve the following problem.
Problem
1) See the image below.
http://www.self-catering-breaks.com/blo ... 07/ace.jpg
2) Assume that instead of user holding the face side of the card, he is holding the backside of the card, where the texture is the same, known before hand (http://static.comicvine.com/uploads/ori ... b_full.jpg)
3) I want to detect the backside of the card in his hand and replace it with a face side of the Card (say king of heart).
Assumptions - to reduce the search space, assume that area of the card is marked by a oval shape before processing. The area of the oval just includes the card, it does not identify precises area of the card.
Image that will be replaced has to be scaled before replacing. Image can be gray-scale.
Thank you
Regards
Pati
Object Detection
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Object Detection
You need to do two operations:
1. Detect the position and orientation of the card in his hand.
2. Replace the card with a new image.
Step (2) is easy apart from the overlap with his finger and thumb. Step (1) is easy for a single image: just use Gimp or similar to find the corner coordinates. While in Gimp, create another layer with the finger and thumb. Then, when the card is replaced, you can paint the finger and thumb over it.
Perhaps you want to automate the entire process. In that case, I suggest you ignore the finger/thumb problem, and obtain photographs with a special card that is a solid an unusual colour, eg bright blue, that has sharp corners. Automatically finding the corner coordinates will be far easier.
1. Detect the position and orientation of the card in his hand.
2. Replace the card with a new image.
Step (2) is easy apart from the overlap with his finger and thumb. Step (1) is easy for a single image: just use Gimp or similar to find the corner coordinates. While in Gimp, create another layer with the finger and thumb. Then, when the card is replaced, you can paint the finger and thumb over it.
Perhaps you want to automate the entire process. In that case, I suggest you ignore the finger/thumb problem, and obtain photographs with a special card that is a solid an unusual colour, eg bright blue, that has sharp corners. Automatically finding the corner coordinates will be far easier.
snibgo's IM pages: im.snibgo.com
Re: Object Detection
Hi,
Thank you very much for ur response.
I want this algorithm to be implemented in a phone application. So need to be automated. Therefore I need to know the names of algorithms I can use and possibly code I can implement.
As you can see there is a think white border in
http://static.comicvine.com/uploads/ori ... b_full.jpg
Can I use this to detect or approximate the area. If there a way to keep the figures/thumbs would be awesome.
Finally whats the best way to scale a different image to this size.
Thank you
Thank you very much for ur response.
I want this algorithm to be implemented in a phone application. So need to be automated. Therefore I need to know the names of algorithms I can use and possibly code I can implement.
As you can see there is a think white border in
http://static.comicvine.com/uploads/ori ... b_full.jpg
Can I use this to detect or approximate the area. If there a way to keep the figures/thumbs would be awesome.
Finally whats the best way to scale a different image to this size.
Thank you
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Object Detection
You need to detect a known image (the back of the card) in another image, at any scale, at any orientation. You need to find the location, scale and orientation. (Or the location of the four corners, which is the same problem.)
IM does not contain simple commands to do this. It is possible, but would be complex, and developing the solution would take time.
IM does not contain simple commands to do this. It is possible, but would be complex, and developing the solution would take time.
snibgo's IM pages: im.snibgo.com
Re: Object Detection
Hi
Thank for your response.
Now I clearly understand what I have to do. Is there any general forum I can ask for candidate algos and solutions?
Maybe IM or somewhere else
Thanks
Thank for your response.
Now I clearly understand what I have to do. Is there any general forum I can ask for candidate algos and solutions?
Maybe IM or somewhere else
Thanks
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Object Detection
You basically need to find the corners of the card in the original image. Once you have that, you can figure out the perspective transformation between those corners and the back face card. IM can then warp the back face card to the original image replacing the front face with the back. (Or the same thing if the hand is holding the backside and you want to replace that with some card face)
Unfortunately IM does not have good algorithms for finding those corners in such a situation. Also matching textures without knowing the rotation of the texture is also hard to do. IM can compare a small image with a larger image to find where the small image is located in the larger image, but the orientations must be the same. It is not scale or rotational invariant.
One recommendation is to look at OpenCV and other such tools for straight line Hough transformation. I believe OpenCV has such a tool and probably finds the intersections of the straight line. You may have to crop the image first around the card in the hand to avoid excess lines in the image.
See also
http://en.wikipedia.org/wiki/Hough_transform
or search Google for it
Unfortunately IM does not have good algorithms for finding those corners in such a situation. Also matching textures without knowing the rotation of the texture is also hard to do. IM can compare a small image with a larger image to find where the small image is located in the larger image, but the orientations must be the same. It is not scale or rotational invariant.
One recommendation is to look at OpenCV and other such tools for straight line Hough transformation. I believe OpenCV has such a tool and probably finds the intersections of the straight line. You may have to crop the image first around the card in the hand to avoid excess lines in the image.
See also
http://en.wikipedia.org/wiki/Hough_transform
or search Google for it