예제 #1
0
void ScribbleArea::segment() {
	segAlgorithm seg;
	seg.setImgPath(imagePath.toStdString());
	seg.setDepthPath(depthPath.toStdString());
	seg.setMethodType(method.toStdString());
	seg.setSeedImage(QImage2CvMat(seedImage));

	seg.segmentation();

	segTime += seg.getSegTime();
	++count;
	segImage = cvMat2QImage(seg.getSegImage()).convertToFormat(QImage::Format_RGB32);
	image = cvMat2QImage(seg.getShowImage());
	update();
}
예제 #2
0
파일: main.cpp 프로젝트: ngzHappy/OCVT0
static inline void run(MainWindow * window ) {

    QImage image0("images:000000");

    const float width_image_=image0.width();
    const float height_image_=image0.height();

    auto len_ =maxLength(width_image_,height_image_ );

    const float diff_width_image_=0.0f;
    const float diff_height_image_=len_/2;

    std::vector< cv::Point2f > from_{ {0,4},{4,0},{0,0} };
    std::vector< cv::Point2f > to_{
        {2+diff_width_image_,diff_height_image_+2},
        {2+diff_width_image_,diff_height_image_-2},
        {diff_width_image_,diff_height_image_}
    };

    cv::Mat atmax_ = cv::getAffineTransform(from_,to_);

    auto cvImage0=qImage2CVmat(image0);
    cv::Mat ans( len_,len_,atmax_.type() );
    cv::warpAffine(cvImage0.first,ans,atmax_,{len_,len_});

    window->insertImage( cvMat2QImage(ans).first.copy() )
        ->setWindowTitle(QObject::trUtf8(u8"变换后图像"));
    window->insertImage(image0)
        ->setWindowTitle(QObject::trUtf8(u8"原始图像"));
}
예제 #3
0
void OpenNIListener::visualize_images(cv::Mat visual_image, cv::Mat depth_image){
  if(ParameterServer::instance()->get<bool>("visualize_mono_depth_overlay")){
    cv::Mat visual_edges = cv::Mat( visual_image.rows, visual_image.cols, CV_8UC1); 
    cv::Mat depth_edges  = cv::Mat( depth_image.rows, depth_image.cols, CV_8UC1); 
    overlay_edges(visual_image, depth_image, visual_edges, depth_edges);
    Q_EMIT newDepthImage(cvMat2QImage(depth_image,depth_image, depth_image+visual_edges, 1)); //show registration by edge overlay
    cv::Mat monochrome; 
    if(visual_image.type() != CV_8UC1) {
      monochrome = cv::Mat( visual_image.rows, visual_image.cols, CV_8UC1); 
      cv::cvtColor(visual_image, monochrome, CV_RGB2GRAY);
    } else {
      monochrome = visual_image; 
    }
    Q_EMIT newVisualImage(cvMat2QImage(monochrome, monochrome + depth_edges, monochrome, 0)); //visual_idx=0
  } else { // No overlay
    Q_EMIT newVisualImage(cvMat2QImage(visual_image, 0)); //visual_idx=0
    Q_EMIT newDepthImage(cvMat2QImage(depth_image, 1)); 
  }
}
예제 #4
0
void OpencvWidget::getFrame(Mat* mat)
{
	this->Image = *mat;
	this->MatRows = mat->rows;
	this->MatCols = mat->cols;

	Mat CameraImg = Mat(MatRows, MatCols , CV_8UC3);
	this->ShowWindow->setPixmap(QPixmap::fromImage(cvMat2QImage(this->Image)));
	
	return;
}
예제 #5
0
파일: main.cpp 프로젝트: ngzHappy/OCVT0
static inline void run(MainWindow * window ) {

    QImage image0("images:000005");

    auto mat=qImage2CVmat(image0);

    cv::Mat ans;
    cv::linearPolar(mat.first,ans,
        cv::Point2f( mat.second.width() ,mat.second.height()/2 ),
        mat.second.width()  ,
        cv::InterpolationFlags::INTER_LINEAR);

    window->insertImage(image0)
        ->setWindowTitle(QObject::trUtf8(u8"原始图像"));

    window->insertImage( cvMat2QImage(ans).first.copy() )
        ->setWindowTitle(QObject::trUtf8(u8"变换后图像"));

}