Shop OBEX P1 Docs P2 Docs Learn Events
We need a Test Forum! — Parallax Forums

We need a Test Forum!

ratronicratronic Posts: 1,451
edited 2015-08-06 16:45 in General Discussion
I found my test page!!

ratronic wrote:
testing
/* track largest red object and send serial screen location/area */
#include   /* 110x80 video A = live video plus text info and tracking square, video B = binary masked objects */
#include 
#include

using namespace cv;
using namespace std;

int main() {
  VideoCapture capture(0);
  int fd(serialOpen("/dev/ttyAMA0", 115200));
  int big, fps;
  Mat image, imgCopy, hsv, thresh, threshCopy;
  stringstream ss;
  namedWindow("A");
  namedWindow("B");
  moveWindow("A", 0, 100);
  moveWindow("B", 200, 100);

  while(1) {
    int t = (int)getTickCount();
    capture >> image;
    resize(image, image, Size(200, 140));
    image.copyTo(imgCopy);
//    blur(image, image, Size(4, 4));
    cvtColor(image, hsv, CV_BGR2HSV);
    inRange(hsv, Scalar(0, 40, 40), Scalar(3, 255, 255), thresh);
    thresh.copyTo(threshCopy);
    vector contours;
    vector hierarchy;
    findContours(thresh, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, Point(0, 0));
    vector mu(contours.size());
    int maxArea = 0;
    for (unsigned int cnt(0); cnt < contours.size(); cnt++) {
      int area = contourArea(contours[cnt]);
      mu[cnt] = moments(contours[cnt], false);
      if (area > maxArea) {
        maxArea = area;
        big = cnt;
      }
    }
test1

Comments

  • Just put it general and tag it as forum testing. Maybe the moderators could agree to sink test threads if you put a "sinkme" tag on them. Then they would never percolate up if people decided to comment on your testing.
  • Heater.Heater. Posts: 21,230
    What we need is a method of posting code and quotes and all the other usual stuff without having to learn and/or hack on HTML. It's bad enough having to do that at work! :)

  • Isn't this a test forum?

    Or a forum test, or so?

    Mike
Sign In or Register to comment.