Ejemplo n.º 1
0
void CorrectPerspective::UpdateEditor(cv::String windowName, cv::Mat source)
{
	m_editorSourceImageSize.x = source.cols;
	m_editorSourceImageSize.y = source.rows;
	//cv::Mat displayImage = source.clone();

	cv::Mat displayImage(cv::Size(m_editorSourceImageSize.x * 2, m_editorSourceImageSize.y * 2), CV_8UC3, cv::Scalar(0, 0, 0));

	cv::Mat dst = displayImage(cv::Rect(m_editorSourceImageSize.x / 2, 
										m_editorSourceImageSize.y / 2,
										m_editorSourceImageSize.x,
										m_editorSourceImageSize.y
										));
	source.copyTo(dst);

	cv::line(displayImage, m_points[0], m_points[1], cv::Scalar(255, 255, 255), 1, CV_AA, 0);
	cv::line(displayImage, m_points[0], m_points[2], cv::Scalar(0, 255, 255), 1, CV_AA, 0);
	cv::line(displayImage, m_points[2], m_points[3], cv::Scalar(0, 0, 255), 1, CV_AA, 0);
	cv::line(displayImage, m_points[3], m_points[1], cv::Scalar(255, 0, 255), 1, CV_AA, 0);

	//cv::resize(displayImage, displayImage, cv::Size(displayImage.cols / 2, displayImage.rows / 2));

    cv::setMouseCallback(windowName, CorrectPerspective::CallBackFunc, this);

	m_editorSourceImageSize *= 2;

	imshow(windowName, displayImage);
}
Ejemplo n.º 2
0
/**
 * Reculer le vidéo lentement
 * @brief MainWindow::on_backwardButton_clicked
 */
void MainWindow::on_backwardButton_clicked()
{
    //QImage img;
    vector<Point2f> vlist;
    myPlayer->Stop();
    double framecourant = myPlayer->getCurrentFrame();
    if(framecourant > 0){
        Mat img = myPlayer->showImage(--framecourant);
        //Modifier ListWidget
        if(this->flagVisualier == true){
            myPlayer->drawTrack(framecourant,img);
            QImage qimg = QImage((unsigned char*) img.data, img.cols, img.rows, QImage::Format_RGB888);
            //Modifier ListWidget
            QStringList list = myPlayer->getStrList();
            ui->listWidget->clear();
            ui->listWidget->addItems(list);
            displayImage(qimg, framecourant, "");
        }
        if(this->flagTraiter == true){
            QImage qimg = QImage((unsigned char*) img.data, img.cols, img.rows, QImage::Format_RGB888);
            displayImage(qimg, framecourant, "");
        }
    }

}
Ejemplo n.º 3
0
void ColibriMainWindow::computeImage(IplImage * iplImage) {
	if(!iplImage) return;

#ifndef NO_PLUGIN
//	fprintf(stderr, "[Colibri] %s:%d : process sequence '%s' on image (%dx%dx%d)\n",
//			__func__, __LINE__,
//			mFilterManager.getPluginSequenceFile(),
//			iplImage->width, iplImage->height, iplImage->depth
//			);

	// Process this image with filters
	int retproc = mFilterManager.processImage(iplImage, &mOutputImage);
#else
	/// \todo port to Win32
	int retproc = -1; // do not display this result (because mOutputImage is null
#endif
	// Display image as output
	if(retproc > 0 && mOutputImage)
	{
		displayImage(mOutputImage);
	}
	else
	{
		displayImage(iplImage);
	}
}
Ejemplo n.º 4
0
void loop() {
    displayImage("parrot.bmp");
    HAL_Delay(5000);
    displayImage("dolphin.bmp");
    HAL_Delay(5000);
    displayImage("monkey.bmp");
    HAL_Delay(5000);
}
Ejemplo n.º 5
0
void ImageViewWidget::displayMat(cv::Mat frame, bool scale)
{
    if(frame.channels()==3){
        cv::Mat3b im;// = frame;
        frame.convertTo(im,CV_8UC3);
        displayImage(im,scale);
    }else{
        cv::Mat_<double> im;// = frame;
        frame.convertTo(im,CV_64F);
        displayImage(im,scale);
    }
}
Ejemplo n.º 6
0
void PDFViewerWindow::renderedThumbnailIncoming(QSharedPointer< RenderedPage > renderedThumbnail)
{
  if ( !m_enabled )
    return;
  
  /* If a thumbnail for the page we're waiting for is incoming and we have no page at all, its better than nothing */
  if ( renderedThumbnail->getPageNumber() == currentPageNumber
    && currentImage.isNull() )
  {
    QImage myHalf;
    if ( myPart == PagePart::LeftHalf )
    {
      myHalf = renderedThumbnail->getImage().copy(0, 0, renderedThumbnail->getImage().width()/2, renderedThumbnail->getImage().height());
    }
    else if ( myPart == PagePart::RightHalf )
    {
      myHalf = renderedThumbnail->getImage().copy(renderedThumbnail->getImage().width()/2, 0, renderedThumbnail->getImage().width()/2, renderedThumbnail->getImage().height());
    }
    else if ( myPart == PagePart::FullPage )
    {
      myHalf = renderedThumbnail->getImage();
    }
    displayImage(myHalf);
  }
  
  addThumbnail(renderedThumbnail->getPageNumber(), renderedThumbnail->getImage());
}
Ejemplo n.º 7
0
Archivo: store.c Proyecto: pierz/vic
/* store one frame or one field */
void store_one (char *outname, unsigned char *src[], int offset, int incr, int height)
{
  switch (outtype)
  {
    case T_YUV:
      store_yuv (outname, src, offset, incr, height);
      break;
    case T_YUV_CONC:
      store_yuv_append (outname, src, offset, incr, height);
      break;
    case T_SIF:
      store_sif (outname, src, offset, incr, height);
      break;
    case T_TGA:
      store_ppm_tga (outname, src, offset, incr, height, 1);
      break;
    case T_PPM:
      store_ppm_tga (outname, src, offset, incr, height, 0);
      break;
#ifdef DISPLAY
    case T_X11:
      if (enhancement_layer_num == 1)
        dither (src);
      break;
#endif
#ifdef WINDOWS
    case T_WIN:
      if (enhancement_layer_num == 1)
        displayImage (src[0], src[2], src[1]);
      break;
#endif
    default:
      break;
  }
}
Ejemplo n.º 8
0
/**
 * Appelle le fonction to show video and show data in ListWidget
 * @brief MainWindow::updatePlayerUI
 * @param img: image to display
 * @param tmpInfo: information of coordinates
 */
void MainWindow::updatePlayerUI(QImage img, QString tmpInfo)
{
    if (!img.isNull())
    {
        displayImage(img, myPlayer->getCurrentFrame(),tmpInfo);
    }
}
Ejemplo n.º 9
0
/**
 * Mouse pressed, show the coordiantes and draw a point at that position
 * @brief MainWindow::myMousePressed
 * @param x
 * @param y
 */
void MainWindow::myMousePressed(int x, int y)
{
    myPlayer->Stop();
    this->flagmovepresse = false;
    double framecourant = myPlayer->getCurrentFrame();
    org = myPlayer->getcurrentImage(framecourant);
    org.copyTo(img);//Copy the original images to 'img'
    sprintf_s(temp,"(%d,%d)",x,y);

    //Get width and height of the original video
    imgheight = myPlayer->getFrameHeight();
    imgwidth = myPlayer->getFrameWidth();
    //Get width and height of the VideoLabel
    labelheight = ui->VideoLbl->size().height();
    labelwidth = ui->VideoLbl->size().width();
    //Get width and height scale
    heightscale = imgheight/labelheight;
    widthscale = imgwidth/labelwidth;
    //Le coordiante of point in the original image
    pre_pt = Point(x*widthscale,y*heightscale);

    putText(img,temp,pre_pt,FONT_HERSHEY_SIMPLEX,0.8,Scalar(255,0,0,0),2,8);//Display coordinates in the window
    circle(img,pre_pt,2,Scalar(255,0,0,0),CV_FILLED,CV_AA,0);//draw circle
    QImage qimg = QImage((const unsigned char*)(img.data),
                  img.cols,img.rows,QImage::Format_RGB888);
    displayImage(qimg,framecourant,"");
    ui->statusBar->showMessage(QString("Mouse press (%1,%2)").arg(x).arg(y));
}
// play video stream
void DisplayOpencvStream::playVideo()
{
    cv::VideoCapture capture;

    bool isStream = capture.open(videoStreamUrl);

    cv::Mat rgb;

    cv::Mat resizedRgb;

    while (isStream && cv::waitKey(40)!=27)
    {
        bool isFrame = capture.read(rgb);

        if (isFrame)
        {
            cv::resize(rgb,resizedRgb,cv::Size(0.25*rgb.cols,0.25*rgb.rows));

            cv::imshow(videoStreamUrl,resizedRgb);

            displayImage(resizedRgb);
        }
    }

    cv::destroyWindow(videoStreamUrl);
}
Ejemplo n.º 11
0
void ossimQtSingleImageWindow::openImage()
{
    QString caption = "iview : open image";
    QString directory;
    if (!theLastOpenedDirectory.empty())
    {
        if (theLastOpenedDirectory.exists())
        {
            directory = theLastOpenedDirectory.c_str();
        }
    }

    QFileDialog* fd = new QFileDialog( this, caption, directory );
    fd->setFileMode( QFileDialog::ExistingFile );

    ossimFilename fileName;

    if ( fd->exec() == QDialog::Accepted )
    {
        fileName = fd->selectedFile().ascii();
        theLastOpenedDirectory = fileName.path();
    }

    delete fd;
    fd = 0;

    if (fileName.empty())
    {
        return;
    }

    displayImage(fileName);
}
Ejemplo n.º 12
0
void DataInspectionDialog::onImageBoxChange(int index)
{
    if (index != imageIndex) {
        imageIndex = index;
        displayImage();
    }
}
Ejemplo n.º 13
0
/**
* Slot called when a http request is complete
* @param requestId - The id of the http request
* @param error - Boolean denoting success of http request
*/
void eVisImageDisplayWidget::displayUrlImage( int requestId, bool error )
{
  //only process if no error and the request id matches the request id stored in displayUrlImage
  if ( !error && requestId == mCurrentHttpImageRequestId )
  {
    //reset to be beginning of the buffer
    mHttpBuffer->seek( 0 );
    //load the image data from the buffer
    mImageLoaded = mImage->loadFromData( mHttpBuffer->buffer() );

    mCurrentZoomStep = 0;
    pbtnZoomOut->setEnabled( false );
    pbtnZoomFull->setEnabled( false );
    if ( mImageLoaded )
    {
      pbtnZoomIn->setEnabled( true );
    }
    else
    {
      pbtnZoomIn->setEnabled( false );
    }
  }

  setScalers();

  displayImage();
}
Ejemplo n.º 14
0
void QNode::takePicture(int nrPicture, QString url, bool display)
{
    bool running = true;
    int picture_taken = 0;
    QString tmpUrl;
    while(running)
    {
        if(picture_flag)
        {
            tmpUrl = url;
            tmpUrl.append("_");
            tmpUrl.append(QString::number(picture_taken+1));
            tmpUrl.append(".pcd");
            //take picture here
            if(rgb_enabled){
                pcl::io::savePCDFileASCII(tmpUrl.toUtf8().constData(), cloudRGB);
                picture_taken = picture_taken + 1;
            }
            else{
                pcl::io::savePCDFileASCII(tmpUrl.toUtf8().constData(), cloud);
                picture_taken = picture_taken + 1;
            }
            picture_flag = false;
        }
        if(picture_taken == nrPicture)
        {
            running = false;
        }
    }
    if(display){
        Q_EMIT displayImage(tmpUrl);
    }
}
Ejemplo n.º 15
0
void ImageViewWidget::displayImage(cv::Mat_<double> image, bool scale)
{
    double inScale = 1.0;

    origW = image.cols;
    origH = image.rows;
    QImage dest(image.cols, image.rows, QImage::Format_ARGB32);
    for (int y = 0; y < image.rows; ++y) {
            const double *srcrow = image[y];
            QRgb *destrow = (QRgb*)dest.scanLine(y);
            for (int x = 0; x < image.cols; ++x) {
                    int color = 255u-(unsigned int)(srcrow[x] * inScale);
                    uint ucolor;
                    if(color<0) ucolor = 0;
                    else if(color>255) ucolor = 255;
                    else ucolor = 255-color;
                    destrow[x] = qRgba(ucolor, ucolor, ucolor, 255);
            }
    }

    if(scale){
        dest = dest.scaled(size(),Qt::KeepAspectRatio,
                           hq? Qt::SmoothTransformation : Qt::FastTransformation);
    }

    displayImage(dest);
}
Ejemplo n.º 16
0
void Matrix::importImage(const QString& fn)
{
	QImage image(fn);
    if (image.isNull())
        return;

	x_start = 0.0;
	x_end = image.width() - 1.0;
	y_start = 0.0;
	y_end = image.height() - 1.0;

	double *buffer = d_matrix_model->dataCopy();
	if (buffer){
    	d_undo_stack->push(new MatrixSetImageCommand(d_matrix_model, image, d_view_type, 0,
							numRows() - 1, 0, numCols() - 1, buffer, tr("Import Image") + " \"" + fn + "\""));
		emit modifiedWindow(this);
		modifiedData(this);
	} else if (ignoreUndo()){
		d_matrix_model->setImage(image);
		setViewType(ImageView, false);
		displayImage(image);
		emit modifiedWindow(this);
		modifiedData(this);
	}

	setWindowLabel(fn);
}
Ejemplo n.º 17
0
// Attempts to recognize the plate.  Returns a confidence level.  Updates teh "stateCode" variable 
// with the value of the country/state
int StateIdentifier::recognize(Mat img, char* stateCode)
{

  timespec startTime;
  getTime(&startTime);
  
  cvtColor(img, img, CV_BGR2GRAY);
  
  resize(img, img, getSizeMaintainingAspect(img, config->stateIdImageWidthPx, config->stateIdimageHeightPx));
  
  Mat plateImg(img.size(), img.type());
  //plateImg = equalizeBrightness(img);
  img.copyTo(plateImg);
  
  Mat debugImg(plateImg.size(), plateImg.type());
  plateImg.copyTo(debugImg);
  vector<int> matchesArray(featureMatcher->numTrainingElements());
  
  
  RecognitionResult result = featureMatcher->recognize(plateImg, true, &debugImg, true, matchesArray );
  
  if (this->config->debugStateId)
  {
    
    
    displayImage(config, "State Identifier1", plateImg);
    displayImage(config, "State Identifier", debugImg);
    cout << result.haswinner << " : " << result.confidence << " : " << result.winner << endl;
  }
  
  
  if (config->debugTiming)
  {
    timespec endTime;
    getTime(&endTime);
    cout << "State Identification Time: " << diffclock(startTime, endTime) << "ms." << endl;
  }
  
  
  if (result.haswinner == false)
    return 0;
  
  strcpy(stateCode, result.winner.c_str());
  
  
  return result.confidence;
}
Ejemplo n.º 18
0
void Matrix::setDefaultColorMap()
{
	d_color_map_type = Default;
	d_color_map = applicationWindow()->d_3D_color_map;
	if (d_view_type == ImageView)
		displayImage(d_matrix_model->renderImage());
	emit modifiedWindow(this);
}
Ejemplo n.º 19
0
void Matrix::setGrayScale()
{
    d_color_map_type = GrayScale;
	d_color_map = QwtLinearColorMap(Qt::black, Qt::white);
	if (d_view_type == ImageView)
		displayImage(d_matrix_model->renderImage());
	emit modifiedWindow(this);
}
Ejemplo n.º 20
0
/**
* Slot called when the pbtnZoomFull button is pressed
*/
void eVisImageDisplayWidget::on_pbtnZoomFull_clicked()
{
  pbtnZoomOut->setEnabled( false );
  pbtnZoomFull->setEnabled( false );
  pbtnZoomIn->setEnabled( true );
  mCurrentZoomStep = 0;
  displayImage();
}
Ejemplo n.º 21
0
void showImage ( const NICE::ColorImage& image,
                 const std::string& title,
                 const bool copy ) {
  // display image and wait for the user to close
  // the window
  displayImage ( &image, title, copy );
  QtFramework::exec ( false );
}
Ejemplo n.º 22
0
void PartyMenu::display()
{
    SDL_SetAlpha(cursor, SDL_SRCALPHA, 0);
    SDL_Rect cursorCoordinates;
    cursorCoordinates.x=cursorXPosition;
    cursorCoordinates.y=cursorYPosition;

    SDL_BlitSurface(background,NULL,SDL_GetVideoSurface(),NULL);
    displayImage(characterPane,85+charPaneXVariation,78);
    displayCharacterData();
    displayImage(menuPane,983,40+menuPaneYVariation);
    if(cursorOpaque)
    {
        SDL_BlitSurface(cursor,NULL,SDL_GetVideoSurface(),&cursorCoordinates);
    }
    displayMenuList();
    text.displayWord("01234567890 9999 9999",500,300);
}
Ejemplo n.º 23
0
void Matrix::setColorMap(const QwtLinearColorMap& map)
{
	d_color_map_type = Custom;
	d_color_map = map;
	if (d_view_type == ImageView)
		displayImage(d_matrix_model->renderImage());

	emit modifiedWindow(this);
}
Ejemplo n.º 24
0
void MainWindow::on_videoSlider_sliderReleased()
{
    vector<Point2f> vlist;
    Mat img = myPlayer->showImage(postionSlider);
    if(this->flagVisualier == true){
        myPlayer->drawTrack(postionSlider,img);
        QImage qimg = QImage((unsigned char*) img.data, img.cols, img.rows, QImage::Format_RGB888);
        //Modifier ListWidget
        QStringList list = myPlayer->getStrList();
        ui->listWidget->clear();
        ui->listWidget->addItems(list);
        displayImage(qimg, postionSlider, "");
    }
    if(this->flagTraiter == true){
        QImage qimg = QImage((unsigned char*) img.data, img.cols, img.rows, QImage::Format_RGB888);
        displayImage(qimg, postionSlider, "");
    }
}
Ejemplo n.º 25
0
void imageViewer::setParam(QString templateFn,bool usesTemplate,int width,int height)
{
  targetWidth=width;
  targetHeight=height;
  templateFileName=templateFn;
  useTemplate=usesTemplate;
  applyTemplate();
  displayImage();
}
Ejemplo n.º 26
0
int main(int argc, char *argv[]) {
    union REGS regs;
    byte breakout = 0;
    int i,j,f,k=0;
    long oldCount = 0;
    int width = 320;
    int height = 200;
    int comp = 0;
    int req_comp = 0;
    int pixel_pos = 0;

    char str1[] = "hello, synctracker!\n";
    byte *image_pixelbuffer = malloc(320 * 200);
    byte *image_palettebuffer = malloc(256 * 3);


    /* Unbuffer stdout: */
    setbuf(stdout, NULL);

    /* Prevent warnings: */
    argc = argc;
    argv = argv;

    start = *my_clock;

    system("cls");
    printf("Please wait...");
    connectToCOM1();

    loader();

    /* Play the tune */
    if ( (playHandle = MIDASplayModule(module, TRUE)) == 0 ) {
        MIDASerror();
    }
    startTime = 0;
    currentTime = 0;
    prevTime = 0;
    passedTime = 0;

    set_mode(VGA_256_COLOR_MODE);
    while ( !kbhit() ) {
        currentTime = frameCount / 60.0f;
        passedTime = frameCount - prevTime;
        prevTime = currentTime;

        displayImage(background);
        demo();
        wait_for_retrace();
        UpdateInfo();
    }

    midasMagicDies();
    set_mode(TEXT_MODE);
    return 0;
}
Ejemplo n.º 27
0
void ModelMaker::checkReady()
{
    
    QString error="ERROR:  ";
    QString colour="red"; // you can use also QColor
    QString fonttemplate = "<font color='%1'>%2</font>";
    QString notprepared="<b>Not Ready!</b>  <i>Please choose a...</i> <br>";
    
    if (videopath==nopath)
        notprepared= notprepared+" ||   Video Source   ||   ";
    if (bgpath==nopath)
        notprepared= notprepared+"  ||    Background Image  ||  ";
    if (bgpath!=nopath && videopath!=nopath){

        //TODO Check to make sure that video and background are SAME SIZE!

        colour="green"; // you can use also QColor
        QString text="<b>Ready to Make a Model</b> ";
        fonttemplate = tr("<font color='%1'>%2</font>");
        ui->messagelabel->setText(fonttemplate.arg( colour, text ));
        ui->seekbar->setEnabled(true);
        ui->subviewButton->setEnabled(true);
        ui->playButton->setEnabled(true);
        ui->playButton->setText("Play");
        ui->paintwidget->setToolTip("Left click to add mask points | Right click to close masking shape");
        paintCanvas->drawingPolygon = true;
        startpainter();
        capture.release();
        capture.open(videopath.toStdString());
        bgimg = imread(bgpath.toStdString(),1);
        currentimg=bgimg.clone();
        displayImage(bgimg);
        current = QString::number(capture.get(CV_CAP_PROP_POS_FRAMES));
        isReady=true;
        ui->seekbar->setRange(0,capture.get(CV_CAP_PROP_FRAME_COUNT)-1);
        
        
        xscale=1.0;
        yscale=1.0;
        
        xscale=    capture.get(CV_CAP_PROP_FRAME_WIDTH)/ui->imagelabel->width();
        yscale=    capture.get(CV_CAP_PROP_FRAME_HEIGHT)/ui->imagelabel->height();
        
        ui->imagelabel->resize(ui->frame->width(),ui->frame->height());
        ui->paintwidget->resize(ui->frame->width(),ui->frame->height());
        
        
    }else{
        colour="red"; // you can use also QColor
        QString text=notprepared;
        fonttemplate = tr("<font color='%1'>%2</font>");
        ui->messagelabel->setText(fonttemplate.arg( colour, text ));
        everythingok=false;
    }
}
Ejemplo n.º 28
0
void QVTKImageWidget::displaySelectedImage(int idx)
{
    if (!imageStack.empty())
        {
            if (idx >= 0 && idx < (int) imageStack.size())
                {
                    imageDisplayedIndex = idx;
                    displayImage(imageStack[imageDisplayedIndex]);
                }
        }
}
Ejemplo n.º 29
0
void QVTKImageWidget::
setAndDisplayMultipleImages(std::vector<vtkSmartPointer<vtkImageData> > imageStack)
{
    if (imageStack.size() > 0)
        {
            this->imageStack.clear();
            this->imageStack = imageStack;
            displayImage(imageStack.at(imageDisplayedIndex));
        }
    isImageStackLoaded = true;
}
Ejemplo n.º 30
0
  // Attempts to recognize the plate.  Returns a confidence level.  Updates the region code and confidence
  // If region is found, returns true.
  bool StateIdentifier::recognize(PipelineData* pipeline_data)
  {
    timespec startTime;
    getTime(&startTime);

    Mat plateImg = Mat(pipeline_data->grayImg, pipeline_data->regionOfInterest);

    resize(plateImg, plateImg, getSizeMaintainingAspect(plateImg, config->stateIdImageWidthPx, config->stateIdimageHeightPx));


    Mat debugImg(plateImg.size(), plateImg.type());
    plateImg.copyTo(debugImg);
    vector<int> matchesArray(featureMatcher->numTrainingElements());

    RecognitionResult result = featureMatcher->recognize(plateImg, true, &debugImg, true, matchesArray );

    if (this->config->debugStateId)
    {
      displayImage(config, "State Identifier1", plateImg);
      displayImage(config, "State Identifier", debugImg);
      cout << result.haswinner << " : " << result.confidence << " : " << result.winner << endl;
    }

    if (config->debugTiming)
    {
      timespec endTime;
      getTime(&endTime);
      cout << "State Identification Time: " << diffclock(startTime, endTime) << "ms." << endl;
    }

    if (result.haswinner == false)
      return 0;

    pipeline_data->region_code = result.winner;
    pipeline_data->region_confidence = result.confidence;

    if (result.confidence >= 10)
      return true;

    return false;
  }