mirror of
https://github.com/storytold/LiveScan3D.git
synced 2026-10-09 00:09:58 +00:00
Data streaming is now much faster (up to 40%). Also added the option to save to binary PLY which is faster than ASCII.
This commit is contained in:
@@ -163,7 +163,7 @@ HRESULT ImageRenderer::Draw(BYTE* pImage, unsigned long cbImage, std::vector<Bod
|
||||
// Draw the bitmap stretched to the size of the window
|
||||
m_pRenderTarget->DrawBitmap(m_pBitmap);
|
||||
|
||||
for (int i = 0; i < vBodies.size(); i++)
|
||||
for (unsigned int i = 0; i < vBodies.size(); i++)
|
||||
{
|
||||
if (vBodies[i].bTracked)
|
||||
{
|
||||
@@ -226,7 +226,7 @@ void ImageRenderer::DrawBody(Body &body)
|
||||
DrawBone(body, JointType_KneeLeft, JointType_AnkleLeft);
|
||||
DrawBone(body, JointType_AnkleLeft, JointType_FootLeft);
|
||||
|
||||
for (int i = 0; i < body.vJoints.size(); i++)
|
||||
for (unsigned int i = 0; i < body.vJoints.size(); i++)
|
||||
{
|
||||
D2D1_POINT_2F tempPoint;
|
||||
tempPoint.x = body.vJointsInColorSpace[i].X;
|
||||
|
||||
@@ -611,9 +611,9 @@ void LiveScanClient::HandleSocket()
|
||||
}
|
||||
}
|
||||
|
||||
void LiveScanClient::SendFrame(vector<Point3f> vertices, vector<RGB> RGB, vector<Body> body)
|
||||
void LiveScanClient::SendFrame(vector<Point3s> vertices, vector<RGB> RGB, vector<Body> body)
|
||||
{
|
||||
int size = RGB.size() * (3 + 3 * sizeof(float)) + sizeof(int);
|
||||
int size = RGB.size() * (3 + 3 * sizeof(short)) + sizeof(int);
|
||||
|
||||
vector<char> buffer(size);
|
||||
char *ptr2 = (char*)vertices.data();
|
||||
@@ -630,9 +630,9 @@ void LiveScanClient::SendFrame(vector<Point3f> vertices, vector<RGB> RGB, vector
|
||||
buffer[pos++] = RGB[i].rgbBlue;
|
||||
|
||||
|
||||
memcpy(buffer.data() + pos, ptr2, sizeof(float)* 3);
|
||||
ptr2 += sizeof(float)* 3;
|
||||
pos += sizeof(float)* 3;
|
||||
memcpy(buffer.data() + pos, ptr2, sizeof(short)* 3);
|
||||
ptr2 += sizeof(short) * 3;
|
||||
pos += sizeof(short) * 3;
|
||||
}
|
||||
|
||||
int nBodies = body.size();
|
||||
@@ -745,8 +745,15 @@ void LiveScanClient::StoreFrame(Point3f *vertices, Point2f *mapping, RGB *color,
|
||||
if (m_bFilter)
|
||||
filter(goodVertices, goodColorPoints, m_nFilterNeighbors, m_fFilterThreshold);
|
||||
|
||||
vector<Point3s> goodVerticesShort(goodVertices.size());
|
||||
|
||||
for (unsigned int i = 0; i < goodVertices.size(); i++)
|
||||
{
|
||||
goodVerticesShort[i] = goodVertices[i];
|
||||
}
|
||||
|
||||
m_vLastFrameBody = bodies;
|
||||
m_vLastFrameVertices = goodVertices;
|
||||
m_vLastFrameVertices = goodVerticesShort;
|
||||
m_vLastFrameRGB = goodColorPoints;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user