Revision 66 Calibration.cpp
| Calibration.cpp (revision 66) | ||
|---|---|---|
| 139 | 139 |
//transform x/y position to calibrated space |
| 140 | 140 |
calibrate.cameraToScreenPosition(drawBlob2.centroid.x, drawBlob2.centroid.y); |
| 141 | 141 |
|
| 142 |
//Get a random color for each blob |
|
| 143 |
if(blobcolor[drawBlob2.id] == 0) |
|
| 144 |
{
|
|
| 145 |
int r = ofRandom(0, 255); |
|
| 146 |
int g = ofRandom(0, 255); |
|
| 147 |
int b = ofRandom(0, 255); |
|
| 148 |
//Convert to hex |
|
| 149 |
int rgbNum = ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff); |
|
| 150 |
//Set hex into map position |
|
| 151 |
blobcolor[drawBlob2.id] = rgbNum; |
|
| 152 |
} |
|
| 153 |
|
|
| 154 |
//Draw Fuzzy Circles |
|
| 155 |
ofEnableAlphaBlending(); |
|
| 156 |
ofImage tempCalibrationParticle; |
|
| 157 |
tempCalibrationParticle.clone(calibrationParticle); |
|
| 158 |
ofSetColor(blobcolor[drawBlob2.id]); |
|
| 159 |
tempCalibrationParticle.draw(drawBlob2.centroid.x * ofGetWidth() - drawBlob2.boundingRect.width * .625, drawBlob2.centroid.y * ofGetHeight() - drawBlob2.boundingRect.height * .625, |
|
| 160 |
drawBlob2.boundingRect.width * 1.25, drawBlob2.boundingRect.height * 1.25); |
|
| 161 |
ofDisableAlphaBlending(); |
|
| 162 |
|
|
| 142 | 163 |
//Draw Blob Targets |
| 143 |
if(bShowTargets) |
|
| 144 |
{
|
|
| 145 |
ofSetColor(0xFFFFFF); |
|
| 146 |
glLineWidth(5); |
|
| 147 |
glPushMatrix(); |
|
| 148 |
// glLoadIdentity(); |
|
| 149 |
glTranslatef(drawBlob2.centroid.x * ofGetWidth(), ((drawBlob2.centroid.y * ofGetHeight())), 0); |
|
| 150 |
drawBlob2.centroid.x *= ofGetWidth() - drawBlob2.boundingRect.width * .625; |
|
| 151 |
drawBlob2.centroid.y *= ofGetHeight() - drawBlob2.boundingRect.height * .625; |
|
| 152 |
|
|
| 153 |
drawBlob2.draw(); |
|
| 154 |
glPopMatrix(); |
|
| 164 |
if(bShowTargets) |
|
| 165 |
{
|
|
| 166 |
ofSetColor(0xFFFFFF); |
|
| 167 |
glLineWidth(5); |
|
| 168 |
glPushMatrix(); |
|
| 169 |
// glLoadIdentity(); |
|
| 170 |
glTranslatef(drawBlob2.centroid.x * ofGetWidth(), ((drawBlob2.centroid.y * ofGetHeight())), 0); |
|
| 171 |
// ofEllipse(0, 0, drawBlob2.boundingRect.width/2, drawBlob2.boundingRect.height/2); |
|
| 172 |
ofLine(0, -drawBlob2.boundingRect.height/2, 0, drawBlob2.boundingRect.height/2); |
|
| 173 |
ofLine(-drawBlob2.boundingRect.width/2, 0, drawBlob2.boundingRect.width/2, 0); |
|
| 174 |
glPopMatrix(); |
|
| 155 | 175 |
} |
| 176 |
|
|
| 156 | 177 |
//set line width back to normal |
| 157 | 178 |
glLineWidth(1); |
| 158 | 179 |
|
| 159 |
//Displat Text of blob information |
|
| 160 |
// NOT SURE I WANT TO KEEP THIS. DON'T THINK IT'S USEFUL |
|
| 180 |
// Displat Text of blob information |
|
| 181 |
/* NOT SURE WE WANT TO KEEP THIS. DON'T THINK IT'S USEFUL |
|
| 161 | 182 |
|
| 162 |
/* ofSetColor(0xFFFFFF); |
|
| 183 |
ofSetColor(0xFFFFFF); |
|
| 163 | 184 |
glLineWidth(1); |
| 164 | 185 |
char idStr[1024]; |
| 165 | 186 |
sprintf(idStr, "id: %i \n x: %f \n y: %f",drawBlob2.id, ceil(drawBlob2.centroid.x * ofGetWidth()), |
| 166 | 187 |
ceil(drawBlob2.centroid.y * ofGetHeight())); |
| 167 | 188 |
verdana.drawString(idStr, drawBlob2.centroid.x * ofGetWidth() - drawBlob2.boundingRect.width/2 + 40, |
| 168 | 189 |
drawBlob2.centroid.y * ofGetHeight() - drawBlob2.boundingRect.height/2 + 40); |
| 169 |
*/ |
|
| 190 |
*/ |
|
| 170 | 191 |
} |
| 171 | 192 |
} |
| 172 | 193 |
|
Also available in: Unified diff
