2017-04-17 00:51:51 -0600 commented question How to calculate number of people counting inside/outside in shop? I would like to do something similar to this on youtube - People Counter 2 user danduck101https://www.youtube.com/watch?v=W-gDfr_G7GA&t=1s (link text) 2017-04-15 15:58:45 -0600 commented question How to calculate number of people counting inside/outside in shop? I fixed the code. 2017-04-15 08:49:30 -0600 commented question How to calculate number of people counting inside/outside in shop? I fixed the code. At the moment I think the number of people entering the store and going out, but I would like to know how many people are left in the store at the moment. 2017-04-14 16:24:37 -0600 asked a question People count cross line Hello. How to calculate how many people are in the shop ? Came out 7 people left 5 people in the shop left 2 people. Could you tell me how it can be implemented?﻿ bool checkIfBlobsCrossedTheLine(std::vector &blobs, int &intVerticalLinePosition, int &shopCountL, int &shopCountR, std::ofstream &myfile) { bool blnAtLeastOneBlobCrossedTheLine = 0; for (shop blob : blobs) { if (blob.blnStillBeingTracked == true && blob.centerPositions.size() >= 2) { int prevFrameIndex = (int)blob.centerPositions.size() - 2; int currFrameIndex = (int)blob.centerPositions.size() - 1; //going left if (blob.centerPositions[prevFrameIndex].x > intVerticalLinePosition && blob.centerPositions[currFrameIndex].x <= intVerticalLinePosition) { shopCountL++; time_t now = time(0); char* dt = strtok(ctime(&now), "\n");; std::cout << dt << ",1,0 (Left)" << std::endl; myfile << dt << ",1,0" << std::endl; blnAtLeastOneBlobCrossedTheLine = 1; } // going right if (blob.centerPositions[prevFrameIndex].x < intVerticalLinePosition && blob.centerPositions[currFrameIndex].x >= intVerticalLinePosition) { shopCountR++; time_t now = time(0); char* dt = strtok(ctime(&now), "\n");; std::cout << dt << ",0,1 (Right)" << std::endl; myfile << dt << ",0,1" << std::endl; blnAtLeastOneBlobCrossedTheLine = 2; } } } return blnAtLeastOneBlobCrossedTheLine;  } 2017-04-14 07:10:33 -0600 asked a question How to calculate number of people counting inside/outside in shop? Hello. How to calculate how many people are in the shop a lot ? Came out 7 people left 5 people in the shop left 2 people. Could you tell me how it can be implemented?﻿ #include #include #include #include #include // it may be necessary to change or remove this line if not using Windows #include // file utils #include // timestamp stuff #include "Blob.h" #define SHOW_STEPS // un-comment or comment this line to show steps or not #define FRAME_SCALE 1 // divide frame dimentions by this number // global variables /////////////////////////////////////////////////////////////////////////////// const cv::Scalar SCALAR_BLACK = cv::Scalar(0.0, 0.0, 0.0); const cv::Scalar SCALAR_WHITE = cv::Scalar(255.0, 255.0, 255.0); const cv::Scalar SCALAR_YELLOW = cv::Scalar(0.0, 255.0, 255.0); const cv::Scalar SCALAR_GREEN = cv::Scalar(0.0, 200.0, 0.0); const cv::Scalar SCALAR_RED = cv::Scalar(0.0, 0.0, 255.0); const cv::Scalar SCALAR_BLUE = cv::Scalar(255.0, 0.0, 0.0); // function prototypes //////////////////////////////////////////////////////////////////////////// void matchCurrentFrameBlobsToExistingBlobs(std::vector &existingBlobs, std::vector ¤tFrameBlobs); void addBlobToExistingBlobs(Blob ¤tFrameBlob, std::vector &existingBlobs, int &intIndex); void addNewBlob(Blob ¤tFrameBlob, std::vector &existingBlobs); double distanceBetweenPoints(cv::Point point1, cv::Point point2); void drawAndShowContours(cv::Size imageSize, std::vector > contours, std::string strImageName); void drawAndShowContours(cv::Size imageSize, std::vector blobs, std::string strImageName); bool checkIfBlobsCrossedTheLine(std::vector &blobs, int &intVerticalLinePosition, int &ShopCountL, int &ShopCountR, std::ofstream &myfile); void drawBlobInfoOnImage(std::vector &blobs, cv::Mat &imgFrame2Copy); void drawShopCountOnImage(int &ShopCountL, int &ShopCountR, cv::Mat &imgFrame2Copy); /////////////////////////////////////////////////////////////////////////////////////////////////// int main(void) { cv::VideoCapture capVideo; std::ofstream myfile; // log file cv::Mat imgFrame1; cv::Mat imgFrame2; cv::Mat imgFrame1L; cv::Mat imgFrame2L; std::vector blobs; cv::Point crossingLine[2]; int ShopCountL = 0; int ShopCountR = 0; capVideo.open("input1_2.MOV"); //capVideo.open("rtsp://192.168.1.254/sjcam.mov"); //capVideo.open(1); // log file myfile.open("/tmp/OpenCV-" + std::string() + "-" + std::to_string(time(0)) + ".txt"); std::cout << "Logging to: \"/tmp/OpenCV-" << "-" << std::to_string(time(0)) << ".txt\"" << std::endl; myfile << "\"Timestamp\",\"Left\",\"Right\"" << std::endl; if (!capVideo.isOpened()) { // if unable to open video file std::cout << "error reading video file" << std::endl << std::endl; // show error message _getch(); // it may be necessary to change or remove this line if not using Windows return(0); // and exit program } if (capVideo.get(CV_CAP_PROP_FRAME_COUNT) < 2) { std::cout << "error: video file must have at least two frames"; _getch(); // it may be necessary to change or remove this line if not using Windows return(0); } capVideo.read(imgFrame1L); capVideo.read(imgFrame2L); resize(imgFrame1L, imgFrame1, cv::Size(imgFrame1L.size().width / FRAME_SCALE, imgFrame1L.size().height / FRAME_SCALE)); resize(imgFrame2L, imgFrame2, cv::Size(imgFrame2L.size().width / FRAME_SCALE, imgFrame2L.size().height / FRAME_SCALE)); //int intHorizontalLinePosition = (int)std::round((double)imgFrame1.rows * 0.35); int intVerticalLinePosition = (int)std::round((double)imgFrame1.cols * 0.50); crossingLine[0].y = 0; crossingLine[0].x = intVerticalLinePosition; crossingLine[1].y = imgFrame1.rows - 1; crossingLine ...