~RLE_Out_Ras_W_Comp(void) { flush_image(); DELETE_VECTOR(_line_lut,0); DELETE_VECTOR(_cpbli ,0); DELETE_VECTOR(_zx ,_pu1.x); DELETE_VECTOR(_wx0 ,_pu1.x); }
void JLWidget::on_pushButton_clicked() { //exusb->ExUSBShow(); //mMediaPlayer->play(); //exusbthread->msleep(1000); //emit exusbthread->GetFrameOK(); flush_image(); jl->test(); }
JLWidget::JLWidget(QWidget *parent) : QWidget(parent), ui(new Ui::JLWidget) { ui->setupUi(this); exusb = new ExUSB(); exusb->start(); exusbthread = new ExUSBThread(exusb); jl = new JLOpenCV(); //img = new QImage(640,480,QImage::Format_RGB32); //connect(exusbthread,SIGNAL(exusbthread->GetFrameOK()),this,SLOT(flush_image)); connect(exusbthread,SIGNAL(GetFrameOK(int)),this,SLOT(flush_image()),Qt::QueuedConnection); //connect(exusbthread,SIGNAL(exusbthread->GetFrameOK(int)),exusbthread,SLOT(test_recv())); //,Qt::QueuedConnection); //connect(this,SIGNAL(flush_image()),exusbthread,SLOT(GetFrameOK()),Qt::DirectConnection); //mVideoWidget.setParent(this); /* mVideoWidget = new QVideoWidget(); mMediaPlayer = new QMediaPlayer; QMediaContent mp = QUrl::fromLocalFile("E:\\zlj_bd.mp4"); mMediaPlayer->setMedia(mp); mMediaPlayer->setVideoOutput(mVideoWidget); //mVideoWidget->setBaseSize(1024,576); mVideoWidget->setGeometry(0,0,1024,576); mVideoWidget->show(); mMediaPlayer->play(); */ // image img = new QImage(640,480,QImage::Format_RGB32); scence = new QGraphicsScene; QPainter mPainter(ui->histwidget); mPainter.setPen(Qt::blue); mPainter.drawText(rect(),Qt::AlignCenter,"Hello WOrld"); // serialport QSerialPort *mPort = new QSerialPort(); mPort->setPortName("COM4"); mPort->setBaudRate(mPort->Baud115200); if (mPort->open(QIODevice::ReadWrite)) { mPort->write("hello"); } }
void RLE_Out_Ras_W_Comp::update(const Pack_Of_Pts * p,const Pack_Of_Pts * v) { const Std_Pack_Of_Pts<INT> * ivals = SAFE_DYNC(const Std_Pack_Of_Pts<INT> *,v); RLE_Pack_Of_Pts * rle_pack = SAFE_DYNC(RLE_Pack_Of_Pts *,const_cast<Pack_Of_Pts *>(p)); INT nb = rle_pack->nb(); if (! nb) return; INT ** vals = ivals->_pts; _dep->verif_values_out(vals,nb); INT ux0 = rle_pack->x0(); INT ux1 = ux0 + nb; INT uy = rle_pack->pt0()[1]; REAL tx = _tr.x; REAL sx = _sc.x; INT out_wx0,out_wx1; // these values may get out ``slightly'' (no more than 1 user pixel) of window interval_user_to_window(out_wx0,out_wx1,ux0,ux1,tx,sx); INT wx0 = std::max(0,out_wx0); INT wx1 = std::min(_sz.x,out_wx1); // An easy way to treat the firt call is to consider that a previous empty segment // was preceding; if (_first) { _first = false; _w_last_x0 = _w_last_x1 = wx0; _u_last_y = uy-1; } // if the curent segment is not a prolongation of previous one if ((_u_last_y != uy) || (_w_last_x1 != wx0)) { flush_image(); _w_last_x0 = wx0; _u_last_y = uy; } _w_last_x1 = wx1; // for optmization purpose, treat separately // the cases : // * sx = 1 (most frequent and fast) // * sx integer (not so rare and quite quick) // * other case (should be less frequent, and more complex to handle) if (sx == 1.0) { // sx = 1 : copy with an eventual offset _dep->lutage (_derd,_cpbli,wx0,wx1, _ddp->lut_compr(),vals,wx0 - out_wx0); } else { _dep->lutage (_derd,_line_lut,0,nb, _ddp->lut_compr(),vals,0); U_INT1 * ddbli = _cpbli + _wx0[ux0] * _byte_pp ; U_INT2 * _tz = _zx+ux0; switch (_derd->_cmod) { case Indexed_Colour : { for (int i=0 ; i<nb ; i++) { INT zx = *(_tz++); INT c = _line_lut[i]; for (INT iz = 0; iz < zx; iz ++) *(ddbli++) = c; } } break; case True_16_Colour : { U_INT2 * ll2= (U_INT2 *) _line_lut; U_INT2 * dd2= (U_INT2 *) ddbli; for (int i=0 ; i<nb ; i++) { INT c = ll2[i]; INT zx = *(_tz++); for (INT iz = 0; iz < zx; iz ++) *(dd2++) = c; } } break; case True_24_Colour : { INT r,g,b; U_INT1 * ll1= _line_lut; INT r_ind = _derd->_r_ind; INT g_ind = _derd->_g_ind; INT b_ind = _derd->_b_ind; for (int i=0 ; i<nb ; i++) { INT zx = *(_tz++); r = ll1[r_ind]; g = ll1[g_ind]; b = ll1[b_ind]; for (INT iz = 0; iz < zx; iz ++) { ddbli[r_ind] = r; ddbli[g_ind] = g; ddbli[b_ind] = b; ddbli += _byte_pp; } ll1 += _byte_pp; } } break; } } }