Hi guys, I wanna resize boundingRect to fix size but I don't get some help after googling it.
Here we go my code:
cv::namedWindow("Frame");
cv::namedWindow("Background Model");
cv::namedWindow("Blob");
cv::VideoCapture cap("skenario c/3.avi");
cv::BackgroundSubtractorMOG2 bgs;
bgs.nmixtures = 3;
bgs.history = 1000;
bgs.bShadowDetection = true;
bgs.nShadowDetection = 0;
bgs.fTau = 0.25;
std::vector<std::vector<cv::Point>> contours;
cv::CascadeClassifier human;
assert(human.load("hogcascade_pedestrians.xml"));
for(;;){
cap >> frame;
cv::GaussianBlur(frame,blurred,cv::Size(3,3),0,0,cv::BORDER_DEFAULT);
bgs.operator()(blurred,fg,0);
bgs.getBackgroundImage(bgmodel);
cv::erode(fg,fg,cv::Mat(),cv::Point(-1,-1),1);
cv::dilate(fg,fg,cv::Mat(),cv::Point(-1,-1),3);
cv::threshold(fg,threshfg,70.0f,255,CV_THRESH_BINARY);
cv::findContours(threshfg,contours,CV_RETR_EXTERNAL,CV_CHAIN_APPROX_SIMPLE);
cv::cvtColor(threshfg,blob,CV_GRAY2RGB);
cv::drawContours(blob,contours,-1,cv::Scalar(255,255,255),CV_FILLED,8);
blob.copyTo(blobarray[(int)cap.get(CV_CAP_PROP_POS_FRAMES)]);
int cmin = 20;
int cmax = 1000;
bool FOD1 = true;
bool FOD2 = true;
std::vector<cv::Rect> rects;
for(int cnum = 0; cnum < contours.size(); cnum++){
if(contours[cnum].size() > cmin && contours[cnum].size() < cmax){
//I WANNA RESIZE HERE:
human.detectMultiScale(frame(cv::boundingRect(contours[cnum])),rects);
I'll appreciate any help here, thanks. :)