void operator()(assertion_set & s, model_converter_ref & mc) { mc = 0; if (s.inconsistent()) return; as_st_report report("add-bounds", s); bound_manager bm(m); expr_fast_mark1 visited; add_bound_proc proc(bm, s, m_lower, m_upper); unsigned sz = s.size(); for (unsigned i = 0; i < sz; i++) quick_for_each_expr(proc, visited, s.form(i)); visited.reset(); report_st_progress(":added-bounds", proc.m_num_bounds); TRACE("add_bounds", s.display(tout););
JNIEXPORT void JNICALL Java_com_mapswithme_maps_bookmarks_data_Bookmark_nativeSetBookmarkParams( JNIEnv * env, jobject thiz, jint cat, jlong bmk, jstring name, jstring type, jstring descr) { Bookmark const * p = getBookmark(cat, bmk); // initialize new bookmark BookmarkData bm(jni::ToNativeString(env, name), jni::ToNativeString(env, type)); bm.SetDescription(descr ? jni::ToNativeString(env, descr) : p->GetDescription()); g_framework->ReplaceBookmark(BookmarkAndCategory(bmk, cat), bm); }
QBitmap &QBitmap::operator=(const QPixmap &pixmap) { if (pixmap.isNull()) { // a null pixmap QBitmap bm(0, 0); QBitmap::operator=(bm); } else if (pixmap.depth() == 1) { // 1-bit pixmap QPixmap::operator=(pixmap); // shallow assignment } else { // n-bit depth pixmap QImage image; image = pixmap.toImage(); // convert pixmap to image *this = fromImage(image); // will dither image } return *this; }
HRESULT BitmapUtil::SaveBitmap(HBITMAP hBitmap, LPCTSTR pszFileName) { ULONG_PTR dwToken = 0; Gdiplus::GdiplusStartupInput input; Gdiplus::GdiplusStartupOutput output; Gdiplus::Status status = Gdiplus::GdiplusStartup( &dwToken, &input, &output ); if( status != Gdiplus::Ok ) { return E_FAIL; } { USES_CONVERSION; UINT nEncoders; UINT nBytes; status = Gdiplus::GetImageEncodersSize( &nEncoders, &nBytes ); if( status != Gdiplus::Ok ) { return E_FAIL; } Gdiplus::ImageCodecInfo* pEncoders = static_cast< Gdiplus::ImageCodecInfo* >( _alloca( nBytes ) ); status = Gdiplus::GetImageEncoders( nEncoders, nBytes, pEncoders ); if( status != Gdiplus::Ok ) { return E_FAIL; } CLSID clsidEncoder = CLSID_NULL; // Determine clsid from extension clsidEncoder = FindCodecForExtension( ::PathFindExtension( pszFileName ), pEncoders, nEncoders ); if( clsidEncoder == CLSID_NULL ) { return E_FAIL; } Gdiplus::Bitmap bm( hBitmap, NULL ); status = bm.Save( T2CW( pszFileName ), &clsidEncoder, NULL ); if( status != Gdiplus::Ok ) { return E_FAIL; } } Gdiplus::GdiplusShutdown( dwToken ); return S_OK; }
void QTodoClock::updateMask() // paint clock mask { QBitmap bm( size() ); bm.fill( color0 ); //transparent QPainter paint; paint.begin( &bm, this ); paint.setBrush( color1 ); // use non-transparent color paint.setPen( color1 ); drawClock( &paint ); paint.end(); setMask( bm ); }
bond_member interface_factory::new_bond_member_interface( const vapi_payload_sw_interface_slave_details& vd) { std::shared_ptr<bond_member> sp; std::string name = reinterpret_cast<const char*>(vd.interface_name); handle_t hdl(vd.sw_if_index); bond_member::mode_t mode = bond_member::mode_t::from_numeric_val(vd.is_passive); bond_member::rate_t rate = bond_member::rate_t::from_numeric_val(vd.is_long_timeout); std::shared_ptr<interface> itf = interface::find(hdl); bond_member bm(*itf, mode, rate); return (bm); }
int main(int argc, char *argv[]) { if (argc != 3) { std::cout << "Usage: test_cpu path/to/image_left path/to/image_right" << std::endl; return 0; } int dim = 5, maxDisp = 16; bool norm = true; std::unique_ptr<unsigned char[]> output; gcvl::BlockMatching bm(argv[1], argv[2], output); #ifdef BENCHMARK FILE *outfile; outfile = fopen("timing_omp.txt", "w"); // using absolute path name of file if (outfile == NULL) { printf("Unable to open file\n"); } for (int i = AGG_DIM_START; i < AGG_DIM_END; i+=2) { for (int j = MAX_DISP_START; j < MAX_DISP_END; j*=2) { bm.setAggDim(i); bm.setMaxDisp(j); bm.setNormalize(false); double time = bm.compute(); fprintf(outfile, "%d,%d,%f\n", i, j, time); } } fclose(outfile); #else bm.setAggDim(dim); bm.setMaxDisp(maxDisp); bm.setNormalize(norm); bm.compute(); #endif /*cv::Mat out(bm.getHeight(), bm.getWidth(), CV_8UC1, output.get()); //cv::namedWindow( "Source Image", cv::WINDOW_AUTOSIZE );// Create a window for display. //cv::imshow( "Source Image", image ); cv::namedWindow( "Disparity Map", cv::WINDOW_AUTOSIZE );// Create a window for display. cv::imshow( "Disparity Map", out ); cv::waitKey(0);*/ return 0; }
void QwtPicker::PrivateData::PickerWidget::updateMask() { QBitmap bm(width(), height()); bm.fill(Qt::color0); QPainter painter(&bm); if ( d_type == RubberBand ) { QPen pen = d_picker->rubberBandPen(); pen.setColor(Qt::color1); painter.setPen(pen); d_picker->drawRubberBand(&painter); } if ( d_type == Text ) { QPen pen = d_picker->trackerPen(); pen.setColor(Qt::color1); painter.setPen(pen); d_picker->drawTracker(&painter); } painter.end(); #if QT_VERSION < 0x040000 QWidget *w = parentWidget(); const bool doUpdate = w->isUpdatesEnabled(); const Qt::BackgroundMode bgMode = w->backgroundMode(); w->setUpdatesEnabled(false); if ( bgMode != Qt::NoBackground ) w->setBackgroundMode(Qt::NoBackground); #endif const QRegion r(bm); setMask(r); #if QT_VERSION < 0x040000 if ( bgMode != Qt::NoBackground ) w->setBackgroundMode(bgMode); w->setUpdatesEnabled(doUpdate); #endif setShown(!r.isEmpty()); }
NaviMainFrame::NaviMainFrame() : wxFrame((wxFrame*) NULL, wxID_ANY, wxT("Navi")), m_noteBook(NULL), m_taskBarIcon(NULL) { // create our menu here initMenu(); // navigation up top (play pause buttons) wxPanel* panelMain = new wxPanel(this); wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL); panelMain->SetSizer(sizer); m_navigation = new NavigationContainer(panelMain, this); // bottom part: wxPanel* p = createBottom(panelMain); // Add the components to the sizer. Add a border of 5 px so the widgets aren't // 'attached' to the edges of the wxFrame itself (looks neater). // add navigation to the sizer sizer->Add(m_navigation, wxSizerFlags().Expand().Border(wxALL, 5)); // add the bottom pieces to the sizer. Note that we user a proportion of 1 here to max // it out all the way to the bottom. sizer->Add(p, wxSizerFlags(1).Expand().Border(wxALL, 5)); CreateStatusBar(); // create the track status handler event handling stuff. This thing // is created on the heap, without a parent wxWindow. this pointer is // given still though, but by destroying this frame, the trackstatushandler // instance will not be destroyed automatically. Not that it matters, // since after we destroyed this frame, the program should end anyway. m_trackStatusHandler = new TrackStatusHandler(this); // Push that event handler, otherwise events will not be propagated to // this new track status handler. PushEventHandler(m_trackStatusHandler); // create a systray icon. bool trayEnabled; wxConfigBase::Get()->Read(Preferences::MINIMIZE_TO_TRAY, &trayEnabled, false); if (trayEnabled) { m_taskBarIcon = new SystrayIcon(this); wxBitmap bm(wxT("./data/icons/navi.png"), wxBITMAP_TYPE_PNG); wxIcon icon; icon.CopyFromBitmap(bm); m_taskBarIcon->SetIcon(icon, wxT("Navi - Hey, listen!")); } }
void TestKoDocumentRdf::testRememberNewInlineRdfObject() { KoDocumentRdf rdfDoc; QTextDocument doc; QTextCursor cur(&doc); KoBookmark bm(cur); bm.setName("test"); KoTextInlineRdf inlineRdf(&doc, &bm); inlineRdf.setXmlId(inlineRdf.createXmlId()); rdfDoc.rememberNewInlineRdfObject(&inlineRdf); Q_ASSERT(&inlineRdf == rdfDoc.findInlineRdfByID(inlineRdf.xmlId())); }
void NaviMainFrame::onAbout(wxCommandEvent& event) { wxAboutDialogInfo info; info.SetName(wxT("Navi")); info.SetVersion(wxT("0.1a")); info.SetDescription(wxT("Hey, listen! Hello! Hey, listen!\nNavi is a directory based music player for Linux.")); info.AddArtist(wxT("James 'adamorjames' Corley")); info.AddDeveloper(wxT("Kevin 'Azzkikr' Pors")); info.SetWebSite(wxT("http://github.com/krpors/navi")); wxBitmap bm(wxT("./data/icons/navi.png"), wxBITMAP_TYPE_PNG); wxIcon icon; icon.CopyFromBitmap(bm); info.SetIcon(icon); wxAboutBox(info); }
HBITMAP g_create_hbitmap_from_data(const album_art_data_ptr & data, t_size & cx, t_size & cy, COLORREF cr_back, bool b_reflection) { HBITMAP ret = NULL; pfc::com_ptr_t<mmh::win32::IStream_memblock> pStream = new mmh::win32::IStream_memblock((const t_uint8*)data->get_ptr(), data->get_size()); //m_image.release(); //flush_cached_bitmap(); { Gdiplus::Bitmap bm(pStream.get_ptr()); pStream.release(); if (bm.GetLastStatus() == Gdiplus::Ok) { ret = g_create_hbitmap_from_image(bm, cx, cy, cr_back, b_reflection); } } return ret; }
void operator()(goal_ref const & g, goal_ref_buffer & result) { tactic_report report("add-bounds", *g); bound_manager bm(m); expr_fast_mark1 visited; add_bound_proc proc(bm, *(g.get()), m_lower, m_upper); unsigned sz = g->size(); for (unsigned i = 0; i < sz; i++) quick_for_each_expr(proc, visited, g->form(i)); visited.reset(); g->inc_depth(); result.push_back(g.get()); if (proc.m_num_bounds > 0) g->updt_prec(goal::UNDER); report_tactic_progress(":added-bounds", proc.m_num_bounds); TRACE("add_bounds", g->display(tout););
// Returns the weight of the match int weighted_bm() { fill_n(matchR, R, -1); fill_n(matchedL, L, 0); fill_n(*hadj, MAX_R*MAX_L, 0); fill_n(slackR, R, 0); for(int l = 0; l < L; l++) { int rmin = 0; for(int r = 1; r < R; r++) if(cost[l][rmin] > cost[l][r]) rmin = r; slackL[l] = cost[l][rmin]; hadj[l][rmin] = 1; } for(;;) { fill_n(reachedL, L, 0); fill_n(reachedR, R, 0); if(bm()) break; int m = infty; for(int l = 0; l < L; l++) for(int r = 0; r < R; r++) if(reachedL[l] && !reachedR[r] && !hadj[l][r]) m = min(m, cost[l][r] - slackL[l] - slackR[r]); for(int l = 0; l < L; l++) if(reachedL[l]) slackL[l] += m; for(int r = 0; r < R; r++) if(reachedR[r]) slackR[r] -= m; for(int l = 0; l < L; l++) for(int r = 0; r < R; r++) if((reachedL[l] && !reachedR[r]) || (!reachedL[l] && reachedR[r])) hadj[l][r] = slackL[l] + slackR[r] == cost[l][r]; } int sum = 0; for(int r = 0; r < R; r++) if(matchR[r] >= 0) sum += cost[matchR[r]][r]; return sum; }
/* * Class: org_coolreader_crengine_ReaderView * Method: getCurrentPageBookmarkInternal * Signature: ()Lorg/coolreader/crengine/Bookmark; */ JNIEXPORT jobject JNICALL Java_org_coolreader_crengine_ReaderView_getCurrentPageBookmarkInternal (JNIEnv *_env, jobject _this) { CRJNIEnv env(_env); ReaderViewNative * p = getNative(_env, _this); if ( !p->_docview->isDocumentOpened() ) return NULL; DocViewCallback callback( _env, p->_docview, _this ); CRLog::trace("getCurrentPageBookmarkInternal: calling getBookmark()"); ldomXPointer ptr = p->_docview->getBookmark(); if ( ptr.isNull() ) return JNI_FALSE; CRBookmark bm(ptr); lString16 comment; lString16 titleText; lString16 posText; bm.setType( bmkt_pos ); if ( p->_docview->getBookmarkPosText( ptr, titleText, posText ) ) { bm.setTitleText( titleText ); bm.setPosText( posText ); } bm.setStartPos( ptr.toString() ); int pos = ptr.toPoint().y; int fh = p->_docview->getDocument()->getFullHeight(); int percent = fh > 0 ? (int)(pos * (lInt64)10000 / fh) : 0; if ( percent<0 ) percent = 0; if ( percent>10000 ) percent = 10000; bm.setPercent( percent ); bm.setCommentText( comment ); jclass cls = _env->FindClass("org/coolreader/crengine/Bookmark"); jmethodID mid = _env->GetMethodID(cls, "<init>", "()V"); jobject obj = _env->NewObject(cls, mid); CRObjectAccessor acc(_env, obj); CRStringField(acc,"startPos").set(bm.getStartPos()); CRStringField(acc,"endPos").set(bm.getEndPos()); CRStringField(acc,"titleText").set(bm.getTitleText()); CRStringField(acc,"posText").set(bm.getPosText()); CRStringField(acc,"commentText").set(bm.getCommentText()); CRIntField(acc,"percent").set(bm.getPercent()); //CRIntField(acc,"page").set(bm.getPageNum()); CRIntField(acc,"type").set(bm.getType()); CRLongField(acc,"timeStamp").set((lInt64)bm.getTimestamp()*1000); return obj; }
void stereo_vision::stereo_correspondence(cv::Mat left, cv::Mat right) { // cv::cvtColor(leftar,left_gray,CV_RGB2GRAY,1); // qDebug("hello"); // cv::cvtColor(rightar,right_gray,CV_RGB2GRAY,1); // qDebug("left image data: %d %d ", left_gray.channels(), left_gray.size().width); // sbm(left_gray,right_gray,depth_map); // cv::normalize(depth_map,depth_map,128,255,CV_MINMAX); cv::cvtColor(left,left_gray, CV_RGB2GRAY); cv::cvtColor(right,right_gray, CV_RGB2GRAY); bm(left_gray, right_gray, depth_map_raw); // depth_map_raw.convertTo(depth_map, CV_8U); cv::normalize(depth_map_raw, depth_map, 0,255, cv::NORM_MINMAX, CV_8UC1); cv::cvtColor(depth_map, depth_map, CV_GRAY2BGR); };
void SessionForm::SetTaskbarIcon(const std::wstring &icon) { if (!nbase::FilePathIsExist(icon, false)) return; if (icon_handle_) { ::DestroyIcon(icon_handle_); } Gdiplus::Bitmap bm(icon.c_str()); bm.GetHICON(&icon_handle_); if (icon_handle_) { ::SendMessage(this->GetHWND(), WM_SETICON, (WPARAM)TRUE, (LPARAM)icon_handle_); ::SendMessage(this->GetHWND(), WM_SETICON, (WPARAM)FALSE, (LPARAM)icon_handle_); } }
inline void LoadGdiplusImage(const void *mem, size_t len, const FuncT &func) { HGLOBAL hGlobal = ::GlobalAlloc(GMEM_MOVEABLE, len); void *pData = ::GlobalLock(hGlobal); memcpy(pData, mem, len); ::GlobalUnlock(hGlobal); IStream *pStream = NULL; if( ::CreateStreamOnHGlobal(hGlobal,TRUE, &pStream) == S_OK ) { std::auto_ptr<Bitmap> bm(Bitmap::FromStream(pStream)); func(bm.get()); pStream->Release(); } ::GlobalFree(hGlobal); }
BluemonkeySink::BluemonkeySink(AbstractRoutingEngine* e, map<string, string> config): QObject(0), AbstractSource(e, config), agent(nullptr), engine(nullptr), mSilentMode(false) { irc = new IrcCommunication(config, this); QTimer::singleShot(1,this,SLOT(reloadEngine())); auth = new Authenticate(config, this); connect(irc, &IrcCommunication::message, [&](QString sender, QString prefix, QString codes ) { if(codes.startsWith("authenticate")) { int i = codes.indexOf("authenticate"); QString pin = codes.mid(i+13); pin = pin.trimmed(); if(!auth->authorize(prefix, pin)) irc->respond(sender,"failed"); qDebug()<<sender; } else if(codes.startsWith("bluemonkey")) { if(!auth->isAuthorized(prefix)) { if(!mSilentMode) irc->respond(sender, "denied"); return; } QString bm("bluemonkey"); codes = codes.mid(bm.length()+1); QString response = engine->evaluate(codes).toString(); if(!mSilentMode || response != "undefined" ) irc->respond(sender, response); } }); }
CMimeItem::CMimeItem(const char *mime) { fMime.SetTo(mime); memset(fIcon, B_TRANSPARENT_8_BIT, 256); memset(fIconSelected, B_TRANSPARENT_8_BIT, 256); BBitmap bm(BRect(0, 0, 15, 15), B_COLOR_8_BIT); if (fMime.GetIcon(&bm, B_MINI_ICON) != B_OK) { try { char p[PATH_MAX]; if (find_directory(B_SYSTEM_TEMP_DIRECTORY, 0, true, p, PATH_MAX) == B_OK) { BDirectory tmpdir; FailOSErr(tmpdir.SetTo(p)); time_t t; time(&t); sprintf(p, "tmp.pe_is_looking_for_a_mime_icon:%ld", t); BFile f; FailOSErr(tmpdir.CreateFile(p, &f)); BNodeInfo ni; FailOSErr(ni.SetTo(&f)); FailOSErr(ni.SetType(mime)); FailOSErr(ni.GetTrackerIcon(&bm, B_MINI_ICON)); } } catch (HErr& e) { } } for (int i = 0; i < 16; i++) { unsigned char *ba = (unsigned char *)((unsigned char *)bm.Bits() + bm.BytesPerRow() * i); memcpy(fIcon + i * 16, ba, 16); for (int j = 0; j < 16; j++) if (ba[j] < 255) fIconSelected[j + i * 16] = gSelectedMap[ba[j]]; } } /* CMimeItem::CMimeItem */
/*! Reimplementation of QWidget::updateMask(). Draws the mask of the slider when transparency is required. \sa QWidget::setAutoMask() */ void QSlider::updateMask() { QBitmap bm( size() ); bm.fill( color0 ); { QPainter p( &bm, this ); QRect sliderR = sliderRect(); QColorGroup g(color1, color1, color1, color1, color1, color1, color1, color1, color0); int mid = tickOffset + thickness()/2; if ( ticks & Above ) mid += style().sliderLength() / 8; if ( ticks & Below ) mid -= style().sliderLength() / 8; if ( orient == Horizontal ) { style().drawSliderGrooveMask(&p, 0, tickOffset, width(), thickness(), mid, Horizontal ); } else { style().drawSliderGrooveMask( &p, tickOffset, 0, thickness(), height(), mid, Vertical ); } style().drawSliderMask( &p, sliderR.x(), sliderR.y(), sliderR.width(), sliderR.height(), orient, ticks & Above, ticks & Below ); int interval = tickInt; if ( interval <= 0 ) { interval = lineStep(); if ( positionFromValue( interval ) - positionFromValue( 0 ) < 3 ) interval = pageStep(); } if ( ticks & Above ) drawTicks( &p, g, 0, tickOffset - 2, interval ); if ( ticks & Below ) { int avail = (orient == Horizontal) ? height() : width(); avail -= tickOffset + thickness(); drawTicks( &p, g, tickOffset + thickness() + 1, avail - 2, interval ); } } setMask( bm ); }
bool test(ui t) { ui tmp; int count,i; for(i=0;i<len && prime[i]<=t/prime[i];i++) if(t % prime[i] == 0) { if((t-1)%(prime[i]-1)) return false; tmp = t; count = 0; while(tmp % prime[i] == 0) { tmp /= prime[i]; count++; if(count >= 2) return false; } } for(i=2;i<t;i++) { tmp = bm(i,t,t); if(tmp == i) return true; } return false; }
EditorView::EditorView(QWidget *parent) : QGraphicsView(parent), pendown_(NOTDOWN), isdragging_(NOTRANSFORM), dragbtndown_(NOTRANSFORM), outlinesize_(10), dia_(20), enableoutline_(true), showoutline_(true), zoom_(100), rotate_(0) { viewport()->setAcceptDrops(true); setAcceptDrops(true); // Draw the crosshair cursor QBitmap bm(32,32); bm.clear(); QPainter bmp(&bm); bmp.setPen(Qt::color1); bmp.drawLine(16,0,16,32); bmp.drawLine(0,16,32,16); QBitmap mask = bm; bmp.setPen(Qt::color0); bmp.drawPoint(16,16); cursor_ = QCursor(bm, mask); viewport()->setCursor(cursor_); }
CanvasView::CanvasView(QWidget *parent) : QGraphicsView(parent), _pendown(NOTDOWN), _isdragging(NOTRANSFORM), _dragbtndown(NOTRANSFORM), _outlinesize(10), _dia(20), _enableoutline(true), _showoutline(true), _zoom(100), _rotate(0), _scene(0), _locked(false) { viewport()->setAcceptDrops(true); setAcceptDrops(true); // Draw the crosshair cursor QBitmap bm(32,32); bm.clear(); QPainter bmp(&bm); bmp.setPen(Qt::color1); bmp.drawLine(16,0,16,32); bmp.drawLine(0,16,32,16); QBitmap mask = bm; bmp.setPen(Qt::color0); bmp.drawPoint(16,16); _cursor = QCursor(bm, mask); viewport()->setCursor(_cursor); }
static QBitmap createSrcBitmap( int size, int border ) { // create the source bitmap that looks like // (for size=4 and border=2): // // // 1111 // 1111 // 0000 // 0000 // // // If \a border is 0, the bitmap does not have a mask, otherwise the inner // part is masked. // \a size specifies the size of the inner (i.e. masked) part. It should be // a multiple of 2. int size2 = size/2; int totalSize = 2 * ( size2 + border ); QBitmap bm( totalSize, totalSize ); QPainter painter; painter.begin( &bm ); painter.setPen( QPen( Qt::color0, 1 ) ); painter.setBrush( Qt::color0 ); painter.drawRect( border, size2+border, size, size2 ); painter.setPen( QPen( Qt::color1, 1 ) ); painter.setBrush( Qt::color1 ); painter.drawRect( border, border, size, size2 ); painter.end(); if ( border > 0 ) { QBitmap mask( totalSize, totalSize, TRUE ); QPainter painter; painter.begin( &mask ); painter.setPen( QPen( Qt::color1, 1 ) ); painter.setBrush( Qt::color1 ); painter.drawRect( border, border, size, size ); painter.end(); bm.setMask( mask ); } return bm; }
static QBitmap createDestBitmap() { // create a bitmap that looks like: // (0 is color0 and 1 is color1) // 00001111 // 00001111 // 00001111 // 00001111 // 00001111 // 00001111 // 00001111 // 00001111 QBitmap bm( 8, 8 ); QPainter painter; painter.begin( &bm ); painter.setPen( QPen( Qt::color0, 4 ) ); painter.drawLine( 2, 0, 2, 8 ); painter.setPen( QPen( Qt::color1, 4 ) ); painter.drawLine( 6, 0, 6, 8 ); painter.end(); return bm; }
manager::~manager() { blend_mode bm(blend_stack.top()); blend_stack.pop(); if(bm.blend_enabled) { glEnable(GL_BLEND); } else { glDisable(GL_BLEND); } glBlendFunc(bm.blend_src_mode, bm.blend_dst_mode); glActiveTexture(active_texture_unit.top()); active_texture_unit.pop(); active_shader_program->shader()->disable_vertex_attrib(-1); if(shader_stack.empty() == false) { active_shader_program = shader_stack.top(); shader_stack.pop(); } else { active_shader_program = tex_shader_program; } glUseProgram(active_shader_program->shader()->get()); }
IdentityMatrix<TYPE> & IdentityMatrix<TYPE>::operator=(const BaseMatrix<TYPE> &bm) { if (&bm == this) { return *this; } assert(bm.BandWidth().Evalued()); assert(bm.BandWidth().Upper() == bm.BandWidth().Lower() && bm.BandWidth().Lower() == 0); int n = bm.Nrows(); if (bm.Search(*this) == 0) { Resize(n); operator()(1, 1) = bm(1, 1); } else { IdentityMatrix<TYPE> t; t = bm; this->Swap(t); } return *this; }
void bruteDepthMapBM(cv::Mat const &left_c, cv::Mat const &right_c) { cv::StereoBM bm; static int frame_num = 0; frame_num += 1; cv::Mat left, right; cv::cvtColor(left_c, left, CV_RGB2GRAY); cv::cvtColor(right_c, right, CV_RGB2GRAY); for(int sadSize = 5; sadSize < 20; sadSize += 2) { for(int uniquenessRatio = 5; uniquenessRatio < 25; uniquenessRatio += 5) { for (int speckleWindowSize = 50; speckleWindowSize < 200; speckleWindowSize += 25) { bm.state->preFilterCap = 31; //bm.state->SADWindowSize = 9; bm.state->SADWindowSize = sadSize; bm.state->minDisparity = 0; bm.state->numberOfDisparities = ((left.cols/8) + 15) & -16; bm.state->textureThreshold = 10; //bm.state->uniquenessRatio = 15; bm.state->uniquenessRatio = uniquenessRatio; //bm.state->speckleWindowSize = 100; bm.state->speckleWindowSize = speckleWindowSize; bm.state->speckleRange = 32; bm.state->disp12MaxDiff = 1; cv::Mat res; bm(left, right, res); char buf[512]; sprintf(buf, "dumps/num%d_sadsize%d_uniq%d_speckle%d.jpg", frame_num, sadSize, uniquenessRatio, speckleWindowSize); cv::imwrite(buf, res); cv::imshow("", normalize(res)); cv::waitKey(1); } } } }
void PluginWidgetAndroid::draw(SkCanvas* canvas) { if (NULL == m_flipPixelRef || !m_flipPixelRef->isDirty()) { return; } SkAutoFlipUpdate update(m_flipPixelRef); const SkBitmap& bitmap = update.bitmap(); const SkRegion& dirty = update.dirty(); ANPEvent event; SkANP::InitEvent(&event, kDraw_ANPEventType); event.data.drawContext.model = m_drawingModel; SkANP::SetRect(&event.data.drawContext.clip, dirty.getBounds()); switch (m_drawingModel) { case kBitmap_ANPDrawingModel: { WebCore::PluginPackage* pkg = m_pluginView->plugin(); NPP instance = m_pluginView->instance(); if (SkANP::SetBitmap(&event.data.drawContext.data.bitmap, bitmap) && pkg->pluginFuncs()->event(instance, &event)) { if (canvas) { SkBitmap bm(bitmap); bm.setPixelRef(m_flipPixelRef); canvas->drawBitmap(bm, SkIntToScalar(m_x), SkIntToScalar(m_y), NULL); } } break; } default: break; } }