Barycentric Coordinates Implementation
Posted: 16 August 2013 01:12 AM   [ Ignore ]
Avatar
Rank
Joined  2013-02-08
Total Posts:  25
New Member

Hi all, I’m trying to understand how the barycentric coordinates implement on CCV’s callibration. I’ve tried to close look on the CCV’s source code and found the calibration proses on http://ccv.nuigroup.com/docs/1.3/_calibration_utils_8cpp_source.html. I read it each line on source code and tried to understand, but I’m stuck on understand this code

bool CalibrationUtils::isPointInTriangle(vector2df pvector2df avector2df bvector2df c)
{
        
if (vector2df::isOnSameSide(p,ab,c) && vector2df::isOnSameSide(p,ba,c) && vector2df::isOnSameSide(pcab))
                return 
true;
    else
                return 
false;
}

I know that code above is boolean funtion to check whether the point is in triangle area or not. But how the algorithm to know that. I found “isOnSameSide” function declaration is in vector2d.h

static bool isOnSameSide(vector2d<Tp1vector2d<Tp2vector2d<Tavector2d<Tb)
        
{
            vector2d
<Tba a;

            
float cp1 ba.crossProduct(p1-a);
            
float cp2 ba.crossProduct(p2-a);

            if (
cp1*cp2 >= 0.0f
                return 
true;
            else 
                return 
false;
        
}

But I still don’t understand what’s the meaning with those vector on the same side. Somebody can help me?

Profile
 
 
Posted: 25 August 2013 10:33 PM   [ Ignore ]   [ # 1 ]
Avatar
Rank
Joined  2013-02-08
Total Posts:  25
New Member

hmmm… I suppose that there isn’t anyone know about barycentric coordinate....

I’ve read some topics on forum and found that more grid I use to calibration can increase accuracy of blob position on application. First I tried to use 2x2 grid point and it seems that the horizontal work fine but the vertical not. Like in the pic I attach, the vertical line seems not on the middle of my finger like the horizontal did, isn’t it?

But when I tried to use 3x2 since my projector use screen 4:3, it seems both the horizontal and vertical line appear from middle of my finger. And I tried again for 3x3, 4x3, 4x4, .... until 10x10. In this test, I don’t see significant change position on my result. Both of line appear from middle of my finger. But I feel that more grid point for calibration make the response of line faster ( I don’t know if it was supposed to be like that or it just my imagination).

I know that CCV use Barycentric coordinates for calibration method. I’ve read some article from internet about this method and have a little understanding about the concept. But I still confuse about how it was implemented to mapping from camera space to screen space. I’ve learn it with ccv source code but I’m stack on it. Can anyone explain it to me in detail how the mapping coordinates process from camera space to screen space?

Image Attachments
horver.png
Profile