Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions modules/ccalib/src/ccalib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
#include "opencv2/ccalib.hpp"

#include <opencv2/core.hpp>
#include <opencv2/core/types_c.h> // CV_TERM
#include <opencv2/imgproc.hpp>
#include <opencv2/calib3d.hpp>
#include <opencv2/features2d.hpp>
Expand Down Expand Up @@ -221,7 +220,7 @@ void CustomPattern::refinePointsPos(const Mat& img, vector<Point2f>& p)
Mat gray;
cvtColor(img, gray, COLOR_RGB2GRAY);
cornerSubPix(gray, p, Size(10, 10), Size(-1, -1),
TermCriteria(CV_TERMCRIT_ITER + CV_TERMCRIT_EPS, 30, 0.1));
TermCriteria(TermCriteria::MAX_ITER | TermCriteria::EPS, 30, 0.1));

}

Expand Down
64 changes: 12 additions & 52 deletions modules/cudalegacy/src/fgd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Ptr<cuda::BackgroundSubtractorFGD> cv::cuda::createBackgroundSubtractorFGD(const
#else

#include "cuda/fgd.hpp"
#include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/imgproc.hpp"

/////////////////////////////////////////////////////////////////////////
// FGDParams
Expand Down Expand Up @@ -345,69 +345,35 @@ namespace

namespace
{
void seqToContours(CvSeq* _ccontours, CvMemStorage* storage, OutputArrayOfArrays _contours)
{
Seq<CvSeq*> all_contours(cvTreeToNodeSeq(_ccontours, sizeof(CvSeq), storage));

size_t total = all_contours.size();

_contours.create((int) total, 1, 0, -1, true);

SeqIterator<CvSeq*> it = all_contours.begin();
for (size_t i = 0; i < total; ++i, ++it)
{
CvSeq* c = *it;
((CvContour*)c)->color = (int)i;
_contours.create((int)c->total, 1, CV_32SC2, (int)i, true);
Mat ci = _contours.getMat((int)i);
CV_Assert( ci.isContinuous() );
cvCvtSeqToArray(c, ci.data);
}
}

int findForegroundRegions(GpuMat& d_foreground, Mat& h_foreground, std::vector< std::vector<Point> >& foreground_regions,
CvMemStorage* storage, const FGDParams& params)
const FGDParams& params)
{
int region_count = 0;

// Discard under-size foreground regions:

d_foreground.download(h_foreground);
IplImage ipl_foreground = cvIplImage(h_foreground);
CvSeq* first_seq = 0;

cvFindContours(&ipl_foreground, storage, &first_seq, sizeof(CvContour), CV_RETR_LIST);
int mode = RETR_LIST;
if (params.is_obj_without_holes) mode |= RETR_EXTERNAL;
findContours(h_foreground, foreground_regions, mode, CHAIN_APPROX_NONE);

for (CvSeq* seq = first_seq; seq; seq = seq->h_next)
for (size_t i = 0; i < foreground_regions.size(); ++i)
{
CvContour* cnt = reinterpret_cast<CvContour*>(seq);
const std::vector<Point> &cnt = foreground_regions[i];
const Rect rect = boundingRect(cnt);

if (cnt->rect.width * cnt->rect.height < params.minArea || (params.is_obj_without_holes && CV_IS_SEQ_HOLE(seq)))
if (rect.width * rect.height < params.minArea)
{
// Delete under-size contour:
CvSeq* prev_seq = seq->h_prev;
if (prev_seq)
{
prev_seq->h_next = seq->h_next;

if (seq->h_next)
seq->h_next->h_prev = prev_seq;
}
else
{
first_seq = seq->h_next;

if (seq->h_next)
seq->h_next->h_prev = NULL;
}
}
else
{
region_count++;
foreground_regions[region_count++] = foreground_regions[i];
}
}

seqToContours(first_seq, storage, foreground_regions);
foreground_regions.resize(region_count);
h_foreground.setTo(0);

drawContours(h_foreground, foreground_regions, -1, Scalar::all(255), -1);
Expand Down Expand Up @@ -612,19 +578,14 @@ namespace
Ptr<cuda::Filter> dilateFilter_;
Ptr<cuda::Filter> erodeFilter_;
#endif

CvMemStorage* storage_;
};

FGDImpl::FGDImpl(const FGDParams& params) : params_(params), frameSize_(0, 0)
{
storage_ = cvCreateMemStorage();
CV_Assert( storage_ != 0 );
}

FGDImpl::~FGDImpl()
{
cvReleaseMemStorage(&storage_);
}

void FGDImpl::apply(InputArray _frame, OutputArray fgmask, double)
Expand All @@ -640,7 +601,6 @@ namespace
CV_Assert( curFrame.type() == CV_8UC3 || curFrame.type() == CV_8UC4 );
CV_Assert( curFrame.size() == prevFrame_.size() );

cvClearMemStorage(storage_);
foreground_regions_.clear();
foreground_.setTo(Scalar::all(0));

Expand All @@ -655,7 +615,7 @@ namespace
#endif

if (params_.minArea > 0 || params_.is_obj_without_holes)
findForegroundRegions(foreground_, h_foreground_, foreground_regions_, storage_, params_);
findForegroundRegions(foreground_, h_foreground_, foreground_regions_, params_);

// Check ALL BG update condition:
const double BGFG_FGD_BG_UPDATE_TRESH = 0.5;
Expand Down
2 changes: 0 additions & 2 deletions modules/cvv/samples/cvv_demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
// library includes
#include <opencv2/imgproc.hpp>
#include <opencv2/features2d.hpp>
#include <opencv2/imgproc/types_c.h>
#include <opencv2/videoio.hpp>
#include <opencv2/videoio/videoio_c.h>

#define CVVISUAL_DEBUGMODE
#include <opencv2/cvv/debug_mode.hpp>
Expand Down
5 changes: 2 additions & 3 deletions modules/dpm/samples/cascade_detect_camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/videoio.hpp>
#include <opencv2/videoio/videoio_c.h>

#include <stdio.h>
#include <iostream>
Expand Down Expand Up @@ -88,8 +87,8 @@ int main( int argc, char** argv )

// use web camera
VideoCapture capture(0);
capture.set(CV_CAP_PROP_FRAME_WIDTH, 320);
capture.set(CV_CAP_PROP_FRAME_HEIGHT, 240);
capture.set(cv::CAP_PROP_FRAME_WIDTH, 320);
capture.set(cv::CAP_PROP_FRAME_HEIGHT, 240);

if ( !capture.isOpened() )
{
Expand Down
2 changes: 1 addition & 1 deletion modules/fastcv/src/allocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ cv::UMatData* QcAllocator::allocate(int dims, const int* sizes, int type,
{
if( step )
{
if( data0 && step[i] != CV_AUTOSTEP )
if( data0 && step[i] != cv::Mat::AUTO_STEP )
{
CV_Assert(total <= step[i]);
total = step[i];
Expand Down
1 change: 0 additions & 1 deletion modules/fastcv/src/precomp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <opencv2/imgproc.hpp>
#include "opencv2/core/private.hpp"
#include "opencv2/core/utils/logger.hpp"
#include <opencv2/core/core_c.h>
#include <opencv2/fastcv.hpp>
#include <map>
#include <atomic>
Expand Down
1 change: 0 additions & 1 deletion modules/freetype/src/precomp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@

#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/imgproc/imgproc_c.h> // for CV_AA
#include <opencv2/freetype.hpp>
#include "opencv2/opencv_modules.hpp"

Expand Down
1 change: 0 additions & 1 deletion modules/reg/samples/map_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
#ifdef COMPARE_FEATURES
#include <opencv2/xfeatures2d.hpp>
#include <opencv2/calib3d.hpp>
#include <opencv2/calib3d/calib3d_c.h>
using namespace cv::xfeatures2d;
#endif

Expand Down
Loading
Loading