Does any one know how to process pixels in CLEyeMulticamWPFTest?
It’s not work below.
void CaptureThread()
{
int w = 0, h = 0;
System.IntPtr Scan0 = _map;
int nVal;
CLEyeCameraGetFrameDimensions(_camera, ref w, ref h);
CLEyeCameraStart(_camera);
int i = 0;
var color=0;
unsafe
{
char* thisPtr;
char* tmpPtr;
while (_running)
{
if (CLEyeCameraGetFrame(_camera, _map, 500))
{
if (!_running) break;
Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Render, (SendOrPostCallback)delegate
{
thisPtr = (char*)Scan0;
for (int y = 0; y < h; ++y)
{
for (int x = 0; x < w; ++x)
{
if (ColorMode == CLEyeCameraColorMode.CLEYE_COLOR_PROCESSED || ColorMode == CLEyeCameraColorMode.CLEYE_COLOR_RAW)
{
tmpPtr = (thisPtr + (y * w * 4) + (x * 4));
nVal = (int)*(tmpPtr);
if (nVal < 0) nVal = 0;
if (nVal > 255) nVal = 255;
*((thisPtr + (y * w * 4) + (x * 4))) = (char)nVal;
}
else
{
tmpPtr = thisPtr + (y * w ) + x;
nVal = (int)*(thisPtr+y*w+x);
if (nVal < 0) nVal = 0;
if (nVal > 255) nVal = 255;
*(thisPtr + (y * w ) + x)=(char)nVal;
}
}
}
BitmapSource.Invalidate();
}, null);
i++;
}
}
}