<commit_before>#ifndef __linux__
#include "videoin.cpp"
#else
#include "videoin_c920.hpp"

using namespace cv;
using namespace std;

VideoIn::VideoIn(const char *path)
{
   if (strstr(path, ".png") || strstr(path, ".jpg"))
   {
      _frame = imread(path);
      _video = false;
   }
   else
   {
      _cap = VideoCapture(path);
      _video = true;
   }
   _frameCounter = 0;
   _c920 = false;
}

VideoIn::VideoIn(int _stream)
{
   if (_stream < 0)
      _stream = 0;
   stringstream videoStream;

   videoStream << "/dev/video";
   videoStream << _stream;
   _camera.Open(videoStream.str().c_str());

   _brightness = 128;
   _contrast = 128;
   _saturation = 128;
   _sharpness = 128;
   _gain = 1;
   _focus = 1;
   _backlightCompensation = 0;
   _whiteBalanceTemperature = 0;
   _video        = true;
   _c920         = true;
   _frameCounter = 0;


   _camera.ChangeCaptureSize(v4l2::CAPTURE_SIZE_640x480);
   _camera.ChangeCaptureFPS(v4l2::CAPTURE_FPS_30);
   _camera.GetBrightness(_brightness);
   _camera.GetContrast(_contrast);
   _camera.GetSaturation(_saturation);
   _camera.GetSharpness(_sharpness);
   _camera.GetGain(_gain);
   _camera.GetBacklightCompensation(_backlightCompensation);
   _camera.GetWhiteBalanceTemperature(_whiteBalanceTemperature);
   ++_whiteBalanceTemperature;
  // _camera.GetFocus(_focus);
  // ++_focus;
   cv::namedWindow("Adjustments", CV_WINDOW_NORMAL);
   cv::createTrackbar("Brightness", "Adjustments", &_brightness, 255);
   cv::createTrackbar("Contrast", "Adjustments", &_contrast, 255);
   cv::createTrackbar("Saturation", "Adjustments", &_saturation, 255);
   cv::createTrackbar("Sharpness", "Adjustments", &_sharpness, 255);
   cv::createTrackbar("Gain", "Adjustments", &_gain, 255);
   cv::createTrackbar("Backlight Compensation", "Adjustments", &_backlightCompensation, 1);
   // Off by one to account for -1 being auto.
   cv::createTrackbar("White Balance Temperature", "Adjustments", &_whiteBalanceTemperature, 6501);
   cv::createTrackbar("Focus", "Adjustments", &_focus, 256);
}

VideoCapture *VideoIn::VideoCap(void) 
{
   if (_video && !_c920)
      return &_cap;
   return NULL;
}

bool VideoIn::getNextFrame(bool pause, Mat &frame)
{<commit_msg>Don't pop up camera gui - fix later so this is controlled by --batch<commit_after>#ifndef __linux__
#include "videoin.cpp"
#else
#include "videoin_c920.hpp"

using namespace cv;
using namespace std;

VideoIn::VideoIn(const char *path)
{
   if (strstr(path, ".png") || strstr(path, ".jpg"))
   {
      _frame = imread(path);
      _video = false;
   }
   else
   {
      _cap = VideoCapture(path);
      _video = true;
   }
   _frameCounter = 0;
   _c920 = false;
}

VideoIn::VideoIn(int _stream)
{
   if (_stream < 0)
      _stream = 0;
   stringstream videoStream;

   videoStream << "/dev/video";
   videoStream << _stream;
   _camera.Open(videoStream.str().c_str());

   _brightness = 128;
   _contrast = 128;
   _saturation = 128;
   _sharpness = 128;
   _gain = 1;
   _focus = 1;
   _backlightCompensation = 0;
   _whiteBalanceTemperature = 0;
   _video        = true;
   _c920         = true;
   _frameCounter = 0;


   _camera.ChangeCaptureSize(v4l2::CAPTURE_SIZE_640x480);
   _camera.ChangeCaptureFPS(v4l2::CAPTURE_FPS_30);
   _camera.GetBrightness(_brightness);
   _camera.GetContrast(_contrast);
   _camera.GetSaturation(_saturation);
   _camera.GetSharpness(_sharpness);
   _camera.GetGain(_gain);
   _camera.GetBacklightCompensation(_backlightCompensation);
   _camera.GetWhiteBalanceTemperature(_whiteBalanceTemperature);
   ++_whiteBalanceTemperature;
  // _camera.GetFocus(_focus);
  // ++_focus;
#if 0
   cv::namedWindow("Adjustments", CV_WINDOW_NORMAL);
   cv::createTrackbar("Brightness", "Adjustments", &_brightness, 255);
   cv::createTrackbar("Contrast", "Adjustments", &_contrast, 255);
   cv::createTrackbar("Saturation", "Adjustments", &_saturation, 255);
   cv::createTrackbar("Sharpness", "Adjustments", &_sharpness, 255);
   cv::createTrackbar("Gain", "Adjustments", &_gain, 255);
   cv::createTrackbar("Backlight Compensation", "Adjustments", &_backlightCompensation, 1);
#endif
   // Off by one to account for -1 being auto.
   cv::createTrackbar("White Balance Temperature", "Adjustments", &_whiteBalanceTemperature, 6501);
   cv::createTrackbar("Focus", "Adjustments", &_focus, 256);
}

VideoCapture *VideoIn::VideoCap(void) 
{
   if (_video && !_c920)
      return &_cap;
   return NULL;
}

bool VideoIn::getNextFrame(bool pause, Mat &frame)
{
{'fraction_non_alphanumeric': 0.13699241410084784, 'fraction_numerical': 0.030566711289602855, 'mean_word_length': 4.3624401913875595, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7123273', 'n_tokens_mistral': 1696, 'n_tokens_neox': 1535, 'n_words': 299}