Hello, I am currently using aravis-0.4 on a QT project.
I use a callback to display the live vidéo, but the image is blinking and there are artifacts on it (see the image).
Did wrong parameters can make an image look like that ?
Here is my functions to start aquire and my callback:
void AcquisitionThread::startAcquire()
{
if(canCapture && camera != NULL && device != NULL)
{
cameraStream = arv_camera_create_stream(camera, NULL, NULL);
if(cameraStream != NULL)
{
arv_stream_push_buffer (cameraStream, arv_buffer_new (arv_camera_get_payload (camera), NULL));
/* Connect the new-buffer signal */
g_signal_connect (cameraStream, "new-buffer", G_CALLBACK (&AcquisitionThread::acquireFrame), this);
/* And enable emission of this signal (it's disabled by default for performance reason) */
arv_stream_set_emit_signals (cameraStream, TRUE);
/* Connect the control-lost signal */
g_signal_connect (device, "control-lost", G_CALLBACK (&AcquisitionThread::controlLostCallback), this);
/* Start the video stream */
arv_camera_start_acquisition (camera);
isRunning = true;
}
else
{
isRunning = false ;
}
}
else
{
qDebug() << tr("%1 The acquisition thread isn't able to capture.").arg("<KAT0x9>");
}
}
void KAcquisitionThread::acquireFrame(ArvStream *pStream, void *instance)
{
AcquisitionThread* instanceClasse =static_cast<AcquisitionThread*>( instance);
ArvBuffer *pBuffer;
pBuffer = arv_stream_try_pop_buffer(pStream);
qDebug() << "TRY POP BUFFER";
if (pBuffer != NULL)
{
qDebug() << "BUFFER NON NULL";
ArvBufferStatus status = arv_buffer_get_status (pBuffer);
if(status == ARV_BUFFER_STATUS_SUCCESS)
{
qDebug() << "BUFFER SUCCES";
int width = arv_buffer_get_image_width(pBuffer);
int height = arv_buffer_get_image_height(pBuffer);
QImage im( instanceClasse->image.scaled(width, height));
size_t nDim = width*height;
memcpy(im.bits(), (unsigned char*)arv_buffer_get_data (pBuffer, &nDim ), (size_t)im.byteCount());
Q_EMIT instanceClasse->updateImage(im.mirrored( instanceClasse->camID == 2, instanceClasse->camID == 1)); //??
}
else
{
instanceClasse->ShowErrormessage(status);
}
unsigned int payload;
payload = arv_camera_get_payload (instanceClasse->camera);
g_object_unref(pBuffer);
g_mutex_lock(instanceClasse->mutex);
pBuffer = arv_buffer_new (payload, NULL);
g_mutex_unlock(instanceClasse->mutex);
arv_stream_push_buffer (pStream, pBuffer);
}
else
{
qDebug() << "Buffer is null" ;
}
}
Did you see a probleme ?
I also try to download the frame, same probleme. Thats why I think I have a acquisition issue.
Ty for your help.
Romain