本文整理汇总了C++中CChannel::GetPixel方法的典型用法代码示例。如果您正苦于以下问题:C++ CChannel::GetPixel方法的具体用法?C++ CChannel::GetPixel怎么用?C++ CChannel::GetPixel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CChannel
的用法示例。
在下文中一共展示了CChannel::GetPixel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Calculate
void CPatch::Calculate (ubyte nChnlNo) {
uvar16_32 nDimX = *(m_pImg->m_pnDimX),
nDimY = *(m_pImg->m_pnDimY);
uvar32_64 nValue, j;
uvar32_64 dwConPtr;
ubyte nAlpha;
rtbyte rValue;
rtbyte rPI = 3.1415926535897932384626433832795,
rRotAngle = rPI / 32.0;
rtbyte rDiamMin, rDiamMax, rDiamSum2,
rX, rY, rXX, rYY,
rTopX, rTopY, rBottomX, rBottomY,
rFeretY, rAngle;
rtbyte prFactors[3];
CVector<rtbyte> vA, vB, vC;
CChannel* pChnl = &(m_pImg->Channels[nChnlNo]);
// #### TODO: Put geometric scaling factors here
prFactors[0] = theApp.GeomScales[aimActive].GetCoefX ();
prFactors[1] = theApp.GeomScales[aimActive].GetCoefY ();
prFactors[2] = pow ( prFactors[0] * prFactors[0] + prFactors[1] * prFactors[1], 0.5 );
m_rArea = m_nArea * prFactors[0] * prFactors[1];
m_rPerimX = m_nPerimX * prFactors[0];
m_rPerimY = m_nPerimY * prFactors[1];
m_rPerimXY = m_nPerimXY * prFactors[0] * prFactors[1];
m_rPerim = m_rPerimX + m_rPerimY + m_rPerimXY;
m_rGravCntX = m_pntGravCnt.x * prFactors[0];
m_rGravCntY = m_pntGravCnt.y * prFactors[1];
// #### TODO: Allocate memory for m_prDistrib
// Determining densitometric parameters
m_rSum = m_rSum2 = m_rMax = 0;
m_rMin = 1e100; // #### TODO: Place max real value here
m_prDistrib = (rtbyte*)aimMemoryCommit (m_pImg->m_pDoc->m_nBPP, "CPatch::Measure", "m_prDistrib");
for (uvar32_64 n = 0 ; n < m_pImg->m_pDoc->m_nBPP ; ++n)
m_prDistrib[n] = 0;
for (uvar32_64 dwCntPtr = 0 ; dwCntPtr < m_dwCntLen ; ++dwCntPtr) {
nValue = pChnl->GetPixel (m_pdwContent[dwCntPtr], false);
rValue = pChnl->GetPixel (m_pdwContent[dwCntPtr], true);
m_rSum += rValue;
m_rSum2 += rValue * rValue;
m_rMin = (rValue < m_rMin) ? rValue : m_rMin;
m_rMax = (rValue > m_rMax) ? rValue : m_rMax;
++m_prDistrib[nValue];
}
m_rMean = m_rSum / m_dwCntLen;
if (m_dwCntLen != 1)
m_rStdDev = pow ((m_rSum2 * m_dwCntLen - m_rSum * m_rSum) / (m_dwCntLen * (m_dwCntLen - 1)), 0.5);
else
m_rStdDev = 0.;
for (n = 0 ; n < m_pImg->m_pDoc->m_nBPP ; ++n)
m_prDistrib[n] /= rtbyte (m_dwCntLen);
// Rotating
m_prFeretsX[0] = m_pntApex.x * prFactors[0];
m_prFeretsY[0] = m_pntApex.y * prFactors[1];
m_prDiameters[0] = (m_rectPatch.bottom - m_rectPatch.top) * prFactors[0];
m_nDiamMin = m_nDiamMax = 0;
m_rDiamMean = rDiamMin = rDiamMax = m_prDiameters[0];
rDiamSum2 = m_prDiameters[0] * m_prDiameters[0];
for (ubyte rot = 1; rot < 64; ++rot) {
rTopX = rTopY = rFeretY = 0x7FFFFFFF;
rBottomX = rBottomY = -0x7FFFFFFF;
for (dwConPtr = 0; dwConPtr < m_dwConLen; ++dwConPtr) {
rXX = SRCOFFSET_TO_COORDX (m_pdwContour[dwConPtr]) - m_pntGravCnt.x;
rYY = SRCOFFSET_TO_COORDY (m_pdwContour[dwConPtr]) - m_pntGravCnt.y;
rX = rXX * cosl (rRotAngle * rot) - rYY * sinl (rRotAngle * rot);
rY = rXX * sinl (rRotAngle * rot) + rYY * cosl (rRotAngle * rot);
if (rX < rTopX) rTopX = rX;
if (rY < rTopY) rTopY = rY;
if (rX > rBottomX) rBottomX = rX;
if (rY > rBottomY) rBottomY = rY;
if (rY < rFeretY) {
rFeretY = rY;
m_prFeretsX[rot] = SRCOFFSET_TO_COORDX (m_pdwContour[dwConPtr]);
m_prFeretsY[rot] = SRCOFFSET_TO_COORDY (m_pdwContour[dwConPtr]);
if (m_prFeretsX[rot] - m_pntGravCnt.x < 0) m_prFeretsX[rot] -= .5;
if (m_prFeretsX[rot] - m_pntGravCnt.x > 0) m_prFeretsX[rot] += .5;
if (m_prFeretsY[rot] - m_pntGravCnt.y < 0) m_prFeretsY[rot] -= .5;
if (m_prFeretsY[rot] - m_pntGravCnt.y > 0) m_prFeretsY[rot] += .5;
}
}
if (rot >= 32)
continue;
nAlpha = (rot <= 16) ? rot : (32 - rot);
rAngle = rRotAngle * nAlpha;
m_prDiameters[rot] = rBottomX - rTopX + sinl (rAngle) + cosl (rAngle);
m_prDiameters[rot] *= pow (prFactors[1]*sinl(rAngle) * prFactors[1]*sinl(rAngle) + prFactors[0]*cosl(rAngle) * prFactors[0]*cosl(rAngle), 0.5);
m_prAngles[rot] = rot * rRotAngle * 180.0 / rPI;
m_rDiamMean += m_prDiameters[rot];
rDiamSum2 += m_prDiameters[rot] * m_prDiameters[rot];
if (rDiamMin > m_prDiameters[rot]) {
rDiamMin = m_prDiameters[rot];
m_nDiamMin = rot;
}
if (rDiamMax < m_prDiameters[rot]) {
rDiamMax = m_prDiameters[rot];
m_nDiamMax = rot;
}
//.........这里部分代码省略.........