示例#1
0
void BackGround::OutputBackground(double scale,double scalefactor,double step)
{
	cv::Rect currentroi;
	currentroi.width=m_bgroi.width;
	currentroi.height=m_bgroi.height;
	for(;currentroi.width<m_input.cols || currentroi.height<m_input.rows;)
	{
		currentroi.x=0;
		currentroi.y=0;
		for(;currentroi.x+currentroi.width<m_input.cols;currentroi.x=(int)(currentroi.x+currentroi.width*step))
		{
			for(;currentroi.y+currentroi.height<m_input.rows;currentroi.y=(int)(currentroi.y+currentroi.height*step))
			{
				cv::Mat imgtmp=m_input(currentroi);
				cv::Mat imgtmp_target(m_bgroi.height,m_bgroi.width,m_input.type());
				cv::resize(imgtmp,imgtmp_target,cv::Size(m_bgroi.width,m_bgroi.height));

				char num[65535];
//				char num[NUMLENGTH];
#ifdef WIN32
				_itoa_s(m_total++,num,10);
#else
				itoa(m_total++,num,10);
#endif
				string strnum(num);
				cv::imwrite(m_outputdir+m_prefix+string("_")+strnum+string(".jpg"),imgtmp_target);
			}
		}
		currentroi.width=(int)(m_bgroi.width*scale);
		currentroi.height=(int)(m_bgroi.height*scale);
		scale*=scalefactor;
	}
}
示例#2
0
Vamp::Plugin::FeatureSet VampPlugin::process(const float *const *inputBuffers,
                                             Vamp::RealTime)
{
  Vamp::Plugin::FeatureSet feature_set;
  Vamp::Plugin::FeatureList feature_list;

  for(mrs_natural c = 0; c < (mrs_natural) m_channels; ++c)
  {
    for(mrs_natural s = 0; s < (mrs_natural) m_block_size; ++s)
    {
      m_input(c,s) = inputBuffers[c][s];
    }
  }

  m_system->process(m_input, m_output);

  for(mrs_natural s = 0; s < m_output.getCols(); ++s)
  {
    Feature features;
    for(mrs_natural o = 0; o < m_output.getRows(); ++o)
    {
      features.values.push_back( (float) m_output(o,s) );
    }

    feature_list.push_back(features);
  }

  feature_set[0] = feature_list;

  return feature_set;
}
示例#3
0
wxDataInputStream::wxDataInputStream(wxInputStream& s, const wxMBConv& conv)
    : m_input(&s), m_be_order(false), m_conv(conv.Clone())
#else
wxDataInputStream::wxDataInputStream(wxInputStream& s)
    : m_input(&s), m_be_order(false)
#endif
{
}

wxDataInputStream::~wxDataInputStream()
{
#if wxUSE_UNICODE
    delete m_conv;
#endif // wxUSE_UNICODE
}

#if wxUSE_UNICODE
void wxDataInputStream::SetConv( const wxMBConv &conv )
{
    delete m_conv;
    m_conv = conv.Clone();
}
示例#4
0
void BackGround::OutputBackground_OnePass(cv::Size win_stride)
{
	cv::Rect currentroi;
	currentroi.width=m_bgroi.width;
	currentroi.height=m_bgroi.height;
	int stridewidth = win_stride.width;
	int strideheight = win_stride.height;
	int i,j;
	int purecolor = m_bgroi.width*m_bgroi.height*255;
	cv::Scalar colorsum;
	for (j=0; (j+currentroi.height) < m_input.rows; j+=strideheight)
	{
		for (i=0; (i+currentroi.width) < m_input.cols; i+=stridewidth)
		{
			currentroi.x=i;
			currentroi.y=j;
			cv::Mat imgtmp=m_input(currentroi);
			colorsum = cv::sum(imgtmp);
			if (colorsum[0] == purecolor)
			{
				continue;
			}
			
			char num[65535];
			//				char num[NUMLENGTH];
#ifdef WIN32
			_itoa_s(m_total++,num,10);
#else
			itoa(m_total++,num,10);
#endif
			string strnum(num);
			cv::imwrite(m_outputdir+m_prefix+string("_")+strnum+string(".jpg"),imgtmp);

		}
	}
}
示例#5
0
wxDataInputStream::wxDataInputStream(wxInputStream& s, const wxMBConv& conv)
  : m_input(&s), m_be_order(false), m_conv(conv.Clone())
#else
wxDataInputStream::wxDataInputStream(wxInputStream& s)
  : m_input(&s), m_be_order(false)
#endif
{
}

wxDataInputStream::~wxDataInputStream()
{
#if wxUSE_UNICODE
    delete m_conv;
#endif // wxUSE_UNICODE
}

#if wxHAS_INT64
wxUint64 wxDataInputStream::Read64()
{
  wxUint64 tmp;
  Read64(&tmp, 1);
  return tmp;
}
#endif // wxHAS_INT64

wxUint32 wxDataInputStream::Read32()
{
  wxUint32 i32;

  m_input->Read(&i32, 4);

  if (m_be_order)
    return wxUINT32_SWAP_ON_LE(i32);
  else
    return wxUINT32_SWAP_ON_BE(i32);
}

wxUint16 wxDataInputStream::Read16()
{
  wxUint16 i16;

  m_input->Read(&i16, 2);

  if (m_be_order)
    return wxUINT16_SWAP_ON_LE(i16);
  else
    return wxUINT16_SWAP_ON_BE(i16);
}

wxUint8 wxDataInputStream::Read8()
{
  wxUint8 buf;

  m_input->Read(&buf, 1);
  return (wxUint8)buf;
}

double wxDataInputStream::ReadDouble()
{
#if wxUSE_APPLE_IEEE
  char buf[10];

  m_input->Read(buf, 10);
  return ConvertFromIeeeExtended((const wxInt8 *)buf);
#else
  return 0.0;
#endif
}