Commit 1ad0ce9f authored by Thiago C. Santini's avatar Thiago C. Santini

Deinterlaces BEFORE resizing

Old eye tracker had the same input size as the output size used for
testing so this went unoticed.
Ops :-)
parent 1fffe156
......@@ -234,16 +234,17 @@ void ImageAcquisition::frameCallbackInternal(char *pixelBuffer, size_t input, do
entry.perfCounter.start();
master->buffer.imageData = pixelBuffer;
Mat tmp = cvarrToMat(&master->buffer, false);
if ( settings.value("eyeCam/deinterlace").toBool() )
naiveDeinterlace(tmp);
resize(
cvarrToMat(&master->buffer, false),
tmp,
entry.leftEyeFrame,
Size(settings.value("eyeCam/outResX").toInt(), settings.value("eyeCam/outResY").toInt()),
INTER_CUBIC
);
cvtColor(entry.leftEyeFrame, entry.leftEyeFrame, CV_RGB2GRAY); // Assumes the pupil detection uses a grayscale input, may have to me changed later on
cvtColor(entry.leftEyeFrame, entry.leftEyeFrame, CV_RGB2GRAY); // Assumes the pupil detection uses a grayscale input, may have to be changed later on
flip(entry.leftEyeFrame, entry.leftEyeFrame, settings.value("eyeCam/flip").toInt());
if ( settings.value("eyeCam/deinterlace").toBool() )
naiveDeinterlace(entry.leftEyeFrame);
if (slave) {
// videoMan getFrame function does not respect the wait=false parameter, so we have to update the image on another thread (see updateSlave)
......@@ -314,15 +315,8 @@ QString ImageAcquisition::camToStr(Camera cam)
return QString("'%1' %2x%3 @ %4 fps").arg(cam.name.c_str()).arg(cam.format.width).arg(cam.format.height).arg(fps);
}
void ImageAcquisition::naiveDeinterlace(Mat in)
void ImageAcquisition::naiveDeinterlace(Mat &in)
{
cv::Mat out(in.row(0));
out.push_back(in.row(0));
for (int i=2; i<in.rows; i+=10) {
out.push_back(in.row(i));
out.push_back(in.row(i));
}
out.copyTo(in);
for (int i=2; i<in.rows-1; i+=2)
in.row(i).copyTo(in.row(i+1));
}
......@@ -41,7 +41,7 @@ public:
static void frameCallback(char *pixelBuffer, size_t input, double timestamp, void *data);
void frameCallbackInternal(char *pixelBuffer, size_t input, double timestamp);
QString camToStr(Camera cam);
void naiveDeinterlace(Mat in);
void naiveDeinterlace(Mat &in);
bool ready;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment