예제 #1
0
void MainWindow::facedetect()
{
    if (!loadCheck()) {
        return;
    }

    savePrevStatus();
    
    if (!facedetectDlg) {
        facedetectDlg = new FacedetectDialog(cur_img,this);

        connect(facedetectDlg, SIGNAL(statusChanged()), this, SLOT(disp_image())); 
        connect(facedetectDlg, SIGNAL(dialogClosed()), this, SLOT(clean_facedetect()));
    }
    facedetectDlg->show();
    facedetectDlg->activateWindow();
}
예제 #2
0
void MainWindow::bluropt()
{
    if (!loadCheck()) {
        return;
    }

    savePrevStatus();
    
    if (!blurDlg) {
        blurDlg = new BlurDialog(cur_img, this);

        connect(blurDlg, SIGNAL(statusChanged()), this, SLOT(disp_image()));
        connect(blurDlg, SIGNAL(dialogClosed()), this, SLOT(clean_bluropt()));
    }
    blurDlg->show();
    blurDlg->activateWindow();
}
예제 #3
0
void MainWindow::morphology()
{
    if (!loadCheck()) {
        return;
    }

    savePrevStatus();
    
    if (!morphDlg) {
        morphDlg = new MorphologyDialog(cur_img, this);

        connect(morphDlg, SIGNAL(statusChanged()), this, SLOT(disp_image()));
        connect(morphDlg, SIGNAL(dialogClosed()), this, SLOT(clean_morphology()));
    }
    morphDlg->show();
    morphDlg->activateWindow();
}
예제 #4
0
void MainWindow::houghcheck()
{
    if (!loadCheck()) {
        return;
    }

    savePrevStatus();
    
    if (!houghDlg) {
        houghDlg = new HoughDialog(cur_img, this);

        connect(houghDlg, SIGNAL(statusChanged()), this, SLOT(disp_image()));
        connect(houghDlg, SIGNAL(dialogClosed()), this, SLOT(clean_houghcheck()));
    }
    houghDlg->show();
    houghDlg->activateWindow();
}
예제 #5
0
void MainWindow::powertf()
{
    // img.copyTo(cur_img);
    if (!loadCheck()) {
        return;
    }

    savePrevStatus();
    
    if (!powertfDlg) {
        powertfDlg = new PowertfDialog(cur_img,this);

        connect(powertfDlg, SIGNAL(statusChanged()), this, SLOT(disp_image())); 
        connect(powertfDlg, SIGNAL(powertfClosed()), this, SLOT(clean_powertf()));
    }
    powertfDlg->show();
    powertfDlg->activateWindow();
}
예제 #6
0
int main(int argc, char **argv)
{
    // Setup signal handlers
    setup_sig_handler();

    // Initialize CV images
    int width = 480;
    int height = 640;

    cv::Mat left_image(height, width, CV_8UC3);
    cv::Mat right_image(height, width, CV_8UC3);
    cv::Mat disp_image(height, width, CV_16SC3);

    // Create VidereCamera object
    vc = new VidereCamera();

    // Setup ROS structures
    ros::init(argc, argv, "videre_camera_node", ros::init_options::AnonymousName);
    ros::NodeHandle vc_nh;

    // image_transport deals with image topics
    image_transport::ImageTransport it(vc_nh);
    image_transport::Publisher pub_left = it.advertise("videre_camera/left/image_raw", 1);
    image_transport::Publisher pub_right = it.advertise("videre_camera/right/image_raw", 1);

    // cv_bridge deals with conversion between cv::Mat and sensor_msgs::Image
    cv_bridge::CvImage msg_left;
    cv_bridge::CvImage msg_right;

    // regular publishers for camera info topics
    ros::Publisher pub_info_left = vc_nh.advertise<sensor_msgs::CameraInfo>("videre_camera/left/camera_info", 1);
    ros::Publisher pub_info_right = vc_nh.advertise<sensor_msgs::CameraInfo>("videre_camera/right/camera_info", 1);

    // camera info messages
    sensor_msgs::CameraInfo info_left;
    sensor_msgs::CameraInfo info_right;

    // We can set encoding prior to loop because it doesn't change
    msg_left.encoding = sensor_msgs::image_encodings::BGR8;
    msg_right.encoding = sensor_msgs::image_encodings::BGR8;

    // We can set camera info params prior to loop because they don't change
    info_left.height = vc->cp()->height();
    info_left.width = vc->cp()->width();
    info_left.distortion_model = vc->cp()->distortion_model();
    vc->cp()->left_D(info_left.D);
    vc->cp()->left_K(info_left.K);
    vc->cp()->left_R(info_left.R);
    vc->cp()->left_P(info_left.P);

    info_right.height = vc->cp()->height();
    info_right.width = vc->cp()->width();
    info_right.distortion_model = vc->cp()->distortion_model();
    vc->cp()->right_D(info_right.D);
    vc->cp()->right_K(info_right.K);
    vc->cp()->right_R(info_right.R);
    vc->cp()->right_P(info_right.P);

    // Set frame_ids
    msg_left.header.frame_id = "/videre_camera/left";
    msg_right.header.frame_id = "/videre_camera/left";
    info_left.header.frame_id = "/videre_camera/left";
    info_right.header.frame_id = "/videre_camera/left";

    // TO DO: USE CAMERAINFO_MANAGER

    ros::Rate loop_rate(15);

    while(ros::ok())
    {
        ros::Time ts = ros::Time::now();

        bool got_image = vc->GetData();

        left_image = vc->left();
        right_image = vc->right();

        if(!got_image)
        {
            ROS_INFO("Error in camera_getimagepair, exiting program");
            break;
        }

        // Set image timestamps
        msg_left.header.stamp = ts;
        msg_right.header.stamp = ts;

        // Set image data
        msg_left.image = left_image;
        msg_right.image = right_image;

        // Publish images
        pub_left.publish(msg_left.toImageMsg());
        pub_right.publish(msg_right.toImageMsg());

        // Set camera info timestamps
        info_left.header.stamp = ts;
        info_right.header.stamp = ts;

        // Publish camera info
        pub_info_left.publish(info_left);
        pub_info_right.publish(info_right);

        ros::spinOnce();
        loop_rate.sleep();
    }

    return 0;
}
예제 #7
0
파일: fbgamma.c 프로젝트: kanzure/brlcad
int
main(int argc, char **argv)
{
    int i;
    int onegamma = 0;
    int fbsize = 512;
    int overlay = 0;
    double gamr = 0, gamg = 0, gamb = 0;	/* gamma's */
    double f;
    ColorMap cm;
    FBIO *fbp;

    onegamma = 0;

    /* check for flags */
    bu_opterr = 0;
    while ((i=bu_getopt(argc, argv, options)) != -1) {
	switch (i) {
	    case 'H'	: fbsize = 1024; break;
	    case 'o'	: overlay++; break;
	    case 'i'	: image = !image; break;
	    case 'F'	: framebuffer = bu_optarg; break;
	    default	: bu_exit(1, "%s", usage);
	}
    }

    if (bu_optind == argc - 1) {
	/* single value for all channels */
	f = atof(argv[bu_optind]);
	checkgamma(f);
	gamr = gamg = gamb = 1.0 / f;
	onegamma++;
    } else if (bu_optind == argc - 4) {
	/* different RGB values */
	f = atof(argv[bu_optind]);
	checkgamma(f);
	gamr = 1.0 / f;
	f = atof(argv[bu_optind+1]);
	checkgamma(f);
	gamg = 1.0 / f;
	f = atof(argv[bu_optind+2]);
	checkgamma(f);
	gamb = 1.0 / f;
    } else {
	bu_exit(1, "%s", usage);
    }

    if ((fbp = fb_open(framebuffer, fbsize, fbsize)) == FBIO_NULL) {
	bu_exit(2, "Unable to open framebuffer\n");
    }

    /* draw the gamma image if requested */
    if (image) disp_image(fbp);

    /* get the starting map */
    if (overlay) {
	fb_rmap(fbp, &cm);
    } else {
	/* start with a linear map */
	for (i = 0; i < 256; i++) {
	    cm.cm_red[i] = cm.cm_green[i]
		= cm.cm_blue[i] = i << 8;
	}
    }

    /* apply the gamma(s) */
    for (i = 0; i < 256; i++) {
	if (gamr < 0)
	    cm.cm_red[i] = 65535 * pow((double)cm.cm_red[i] / 65535.0, -1.0/gamr);
	else
	    cm.cm_red[i] = 65535 * pow((double)cm.cm_red[i] / 65535.0, gamr);
	if (onegamma && (overlay == 0)) {
	    cm.cm_green[i] = cm.cm_red[i];
	    cm.cm_blue[i]  = cm.cm_red[i];
	} else {
	    if (gamg < 0)
		cm.cm_green[i] = 65535 * pow((double)cm.cm_green[i] / 65535.0, -1.0/gamg);
	    else
		cm.cm_green[i] = 65535 * pow((double)cm.cm_green[i] / 65535.0, gamg);
	    if (gamb < 0)
		cm.cm_blue[i]  = 65535 * pow((double)cm.cm_blue[i] / 65535.0, -1.0/gamb);
	    else
		cm.cm_blue[i]  = 65535 * pow((double)cm.cm_blue[i] / 65535.0, gamb);
	}
    }

    fb_wmap(fbp, &cm);
    fb_close(fbp);
    return 0;
}