So I have been using OpenCV and Affdex SDK to capture image and process emotion. But when the camera is in use by another application then
// Capture an image from the camera
cv::Mat frame_image;
if (!video_capture.read(frame_image)) {}
read still returns true but however frame_image.data contains garbage value in debug version but in release version it's empty. I had been using this code in release version to detect if the data is empty:
bool CEmotionTracker::is_frame_data_empty(const uchar *frame_data) const
{
if (frame_data && frame_data[0] == '\0')
return true;
return false;
}
but this won't work in debug version because of garbage value and I don't think it's a good idea to check if data contains garbage value to determine if it contains a valid frame data or not. Is there any way to check if frame_image.data contains valid data or not?
Edit:
frame_image.empty() will return false so it's not what I am looking for