这篇教程C++ surf函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中surf函数的典型用法代码示例。如果您正苦于以下问题:C++ surf函数的具体用法?C++ surf怎么用?C++ surf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了surf函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: subdividet/* and draw the resulting triangles */void subdividet(GLfloat u1[2], GLfloat u2[2], GLfloat u3[2], float cutoff, int depth){ GLfloat v1[3], v2[3], v3[3], n1[3], n2[3], n3[3]; GLfloat u12[2], u23[2], u31[2]; int i; if(depth == MAXDEPTH || (curv(u1) < cutoff && curv(u2) < cutoff && curv(u3) < cutoff)){ surf(u1,v1,n1); surf(u2,v2,n2); surf(u3,v3,n3); glBegin(GL_TRIANGLES); glNormal3fv(n1); glVertex3fv(v1); //glNormal3fv(n2); glVertex3fv(v2); //glNormal3fv(n3); glVertex3fv(v3); glEnd(); return; } for(i=0;i<2;i++){ u12[i]=(u1[i]+u2[i])/2.0; u23[i]=(u2[i]+u3[i])/2.0; u31[i]=(u1[i]+u3[i])/2.0; } subdividet(u1,u12,u31,cutoff,depth+1); subdividet(u2,u23,u12,cutoff,depth+1); subdividet(u3,u31,u23,cutoff,depth+1); subdividet(u12,u23,u31,cutoff,depth+1);}
开发者ID:Shanni,项目名称:OpenGL_Projects,代码行数:32,
示例2: surfvoid*nsThebesRenderingContext::GetNativeGraphicData(GraphicDataType aType){ if (aType == NATIVE_GDK_DRAWABLE) { if (mWidget) return mWidget->GetNativeData(NS_NATIVE_WIDGET); } if (aType == NATIVE_THEBES_CONTEXT) return mThebes; if (aType == NATIVE_CAIRO_CONTEXT) return mThebes->GetCairo();#ifdef XP_WIN if (aType == NATIVE_WINDOWS_DC) { nsRefPtr<gfxASurface> surf(mThebes->CurrentSurface()); if (!surf || surf->CairoStatus()) return nsnull; return static_cast<gfxWindowsSurface*>(static_cast<gfxASurface*>(surf.get()))->GetDC(); }#endif#ifdef XP_OS2 if (aType == NATIVE_OS2_PS) { nsRefPtr<gfxASurface> surf(mThebes->CurrentSurface()); if (!surf || surf->CairoStatus()) return nsnull; return (void*)(static_cast<gfxOS2Surface*>(static_cast<gfxASurface*>(surf.get()))->GetPS()); }#endif return nsnull;}
开发者ID:MozillaOnline,项目名称:gecko-dev,代码行数:31,
示例3: main// mainint main( int argc, char** argv ) { cv::Mat img_1 = cv::imread( argv[1], CV_LOAD_IMAGE_GRAYSCALE ); cv::Mat img_2 = cv::imread( argv[2], CV_LOAD_IMAGE_GRAYSCALE ); if( !img_1.data || !img_2.data ) { return -1; } //-- Step 1: Detect the keypoints and generate their descriptors using SURF int minHessian = 400; cv::SURF surf( minHessian ); std::vector<cv::KeyPoint> keypoints_1, keypoints_2; cv::Mat descriptors_1, descriptors_2; surf( img_1, cv::Mat(), keypoints_1, descriptors_1, false ); surf( img_2, cv::Mat(), keypoints_2, descriptors_2, false ); //-- Step 3: Matching descriptor vectors with a brute force matcher cv::BFMatcher matcher( cv::NORM_L2, false ); std::vector< cv::DMatch > matches; matcher.match( descriptors_1, descriptors_2, matches ); //-- Draw matches cv::Mat img_matches; cv::drawMatches( img_1, keypoints_1, img_2, keypoints_2, matches, img_matches ); //-- Show detected matches imshow("Matches", img_matches ); cv::waitKey(0); return 0; }
开发者ID:yycho0108,项目名称:LearnOpenCV,代码行数:35,
示例4: process void process( FrameData &frameData ) { for( int i=0; i<(int)frameData.images.size(); i++) { Image *image = frameData.images[i].get(); vector<FrameData::DetectedFeature> &detectedFeatures = frameData.detectedFeatures[_stepName]; IplImage* gs = cvCreateImage(cvSize(image->width,image->height), IPL_DEPTH_8U, 1); for (int y = 0; y < image->height; y++) memcpy( &gs->imageData[y*gs->widthStep], &image->data[y*image->width], image->width ); cv::SURF surf(Threshold); vector<float> descriptors; vector<cv::KeyPoint> keypoints; surf( cv::Mat(cv::Ptr<IplImage>(gs)), cv::Mat(), keypoints, descriptors); int nDesc = detectedFeatures.size(); detectedFeatures.resize(detectedFeatures.size() + keypoints.size()); for(int j=0; j<(int)keypoints.size(); j++) { detectedFeatures[nDesc].imageIdx = i; detectedFeatures[nDesc].descriptor.resize(64); for (int x=0; x<64; x++) detectedFeatures[nDesc].descriptor[x] = descriptors[j*64+x]; detectedFeatures[nDesc].coord2D[0] = keypoints[j].pt.x; detectedFeatures[nDesc].coord2D[1] = keypoints[j].pt.y; nDesc++; } } }
开发者ID:jypuigbo,项目名称:robocup-code,代码行数:33,
示例5: detectSURFPointsint detectSURFPoints(const ImgG& img, Mat_d& surfPts, std::vector<float>& surfDesc, double hessianThreshold) { KpVec surfPtsVec; cv::SURF surf(hessianThreshold, 4, 2, false); cv::Mat cvImg(img.rows, img.cols, CV_8UC1, img.data); surf(cvImg, cv::Mat(), surfPtsVec, surfDesc); KpVec2Mat(surfPtsVec, surfPts); return surf.descriptorSize();}
开发者ID:jackyspeed,项目名称:LibVisualSLAM,代码行数:10,
示例6: Errorvoid Texture2dData::store(const util::Path& file) const { log::log(MSG(info) << "Saving texture data to " << file); if (this->info.get_format() != pixel_format::rgba8) { throw Error(MSG(err) << "Storing 2D textures into files is unimplemented. PRs welcome :D"); } auto size = this->info.get_size();// If an older SDL2 is used, we have to specify the format manually.#ifndef SDL_PIXELFORMAT_RGBA32 uint32_t rmask, gmask, bmask, amask;#if SDL_BYTEORDER == SDL_BIG_ENDIAN rmask = 0xff000000; gmask = 0x00ff0000; bmask = 0x0000ff00; amask = 0x000000ff;#else // little endian, like x86 rmask = 0x000000ff; gmask = 0x0000ff00; bmask = 0x00ff0000; amask = 0xff000000;#endif std::unique_ptr<SDL_Surface, decltype(&SDL_FreeSurface)> surf( SDL_CreateRGBSurfaceFrom( // const_cast is okay, because the surface doesn't modify data const_cast<void*>(static_cast<void const*>(this->data.data())), size.first, size.second, 32, this->info.get_row_size(), rmask, gmask, bmask, amask ), &SDL_FreeSurface );#else std::unique_ptr<SDL_Surface, decltype(&SDL_FreeSurface)> surf( SDL_CreateRGBSurfaceWithFormatFrom( // const_cast is okay, because the surface doesn't modify data const_cast<void*>(static_cast<void const*>(this->data.data())), size.first, size.second, 32, this->info.get_row_size(), SDL_PIXELFORMAT_RGBA32 ), &SDL_FreeSurface );#endif // Call sdl_image for saving the screenshot to PNG std::string path = file.resolve_native_path_w(); IMG_SavePNG(surf.get(), path.c_str());}
开发者ID:SFTtech,项目名称:openage,代码行数:55,
示例7: mainint main(){ curve::NURBS<3> cur; cur.pushControlPoint( geom::Vector3f( 0, 0, 0 ) ); cur.pushControlPoint( geom::Vector3f( 1, 0, 0 ) ); cur.pushControlPoint( geom::Vector3f( 1, 1, 0 ) ); cur.pushControlPoint( geom::Vector3f( 0, 1, 0 ) ); std::cout << cur( 0.5 ) << std::endl; surface::Tube<float> surf( cur, frame::Frenet<float>() ); std::cout << surf( 0.5, 0 ) << std::endl; return 0;}
开发者ID:charlyisidore,项目名称:GeomLibC--,代码行数:13,
示例8: surfvoid Feature::SURFExtractor_GPU(vector<cv::KeyPoint> &feature_pts, vector_eigen_vector3f &feature_pts_3d, cv::Mat &feature_descriptors, const cv::Mat &imgRGB, const cv::Mat &imgDepth){ cv::Mat grey; cv::cvtColor(imgRGB, grey, CV_BGR2GRAY); //cv::gpu::printShortCudaDeviceInfo(cv::gpu::getDevice()); cv::gpu::GpuMat gpuRGB, gpuKeypoints, gpuDescriptors; gpuRGB.upload(grey); cv::gpu::SURF_GPU surf; surf(gpuRGB, cv::gpu::GpuMat(), gpuKeypoints, gpuDescriptors); vector<cv::KeyPoint> fpts; cv::Mat descriptors; surf.downloadKeypoints(gpuKeypoints, fpts); gpuDescriptors.download(descriptors); for (int i = 0; i < fpts.size(); i++) { if (imgDepth.at<ushort>(cvRound(fpts[i].pt.y), cvRound(fpts[i].pt.x)) == 0) continue; feature_pts.push_back(fpts[i]); Eigen::Vector3f pt = ConvertPointTo3D(fpts[i].pt.x, fpts[i].pt.y, imgDepth); feature_pts_3d.push_back(pt); feature_descriptors.push_back(descriptors.row(i)); }}
开发者ID:weeks-yu,项目名称:WReg,代码行数:29,
示例9: parentVolumevoid Installer<UserData>::install(DetElement component, PlacedVolume pv) { Volume comp_vol = pv.volume(); if ( comp_vol.isSensitive() ) { Volume mod_vol = parentVolume(component); DD4hep::Geometry::PolyhedraRegular comp_shape(comp_vol.solid()), mod_shape(mod_vol.solid()); if ( !comp_shape.isValid() || !mod_shape.isValid() ) { invalidInstaller("Components and/or modules are not Trapezoid -- invalid shapes"); } else if ( !handleUsingCache(component,comp_vol) ) { DetElement par = component.parent(); const TGeoHMatrix& m = par.worldTransformation(); double dz = m.GetTranslation()[2]; const double* trans = placementTranslation(component); double half_mod_thickness = (mod_shape->GetZ(1)-mod_shape->GetZ(0))/2.0; double half_comp_thickness = (comp_shape->GetZ(1)-comp_shape->GetZ(0))/2.0; double si_position = trans[2]+half_mod_thickness; double outer_thickness = half_mod_thickness - si_position; double inner_thickness = half_mod_thickness + si_position; Vector3D u(1.,0.,0.), v(0.,1.,0.), n(0.,0.,1.), o(100.,100.,0.); std::cout << " Module: " << mod_shape.toString() << std::endl; std::cout << " Component: " << comp_shape.toString() << std::endl; std::cout << "dz:" << dz << " Si-pos:" << si_position << " Mod-thickness:" << half_mod_thickness << " Comp-thickness:" << half_comp_thickness << std::endl; VolPlane surf(comp_vol,Type(Type::Sensitive,Type::Measurement1D), inner_thickness, outer_thickness, u, v, n, o); addSurface(component,surf); } }}
开发者ID:vvolkl,项目名称:DD4hep,代码行数:32,
示例10: DEF_TESTDEF_TEST(PremulAlphaRoundTrip, reporter) { const SkImageInfo info = SkImageInfo::MakeN32Premul(256, 256); sk_sp<SkSurface> surf(SkSurface::MakeRaster(info)); test_premul_alpha_roundtrip(reporter, surf.get());}
开发者ID:03050903,项目名称:skia,代码行数:7,
示例11: surfpcs_addlcstatic void surfpcs_addlc(surfpcs *s,const char *x,unsigned int n) /* modified from Dan's surfpcs_add by skipping ' ' & '/t' and */ /* case-independence */{ unsigned char ch; int i; while (n--) { ch = *x++; if (ch == ' ' || ch == '/t') continue; if (ch >= 'A' && ch <= 'Z') data[end[s->todo++]] = ch - 'A' + 'a'; else data[end[s->todo++]] = ch; if (s->todo == 32) { s->todo = 0; if (!++s->in[8]) if (!++s->in[9]) if (!++s->in[10]) ++s->in[11]; surf(s->out,s->in,s->seed); for (i = 0;i < 8;++i) s->sum[i] += s->out[i]; } }}
开发者ID:kunishi,项目名称:qmail-hg,代码行数:25,
示例12: surfvoid Foam::surfaceToPoint::combine(topoSet& set, const bool add) const{ cpuTime timer; triSurface surf(surfName_); Info<< " Read surface from " << surfName_ << " in = "<< timer.cpuTimeIncrement() << " s" << endl << endl; // Construct search engine on surface triSurfaceSearch querySurf(surf); if (includeInside_ || includeOutside_) { boolList pointInside(querySurf.calcInside(mesh_.points())); forAll(pointInside, pointI) { bool isInside = pointInside[pointI]; if ((isInside && includeInside_) || (!isInside && includeOutside_)) { addOrDelete(set, pointI, add); } }
开发者ID:Unofficial-Extend-Project-Mirror,项目名称:foam-extend-foam-extend-3.2,代码行数:25,
示例13: ex Mm ex() { begin_scope #line 1 "d:/matcom45/ex.m" call_stack_begin; #line 1 "d:/matcom45/ex.m" // nargin, nargout entry code double old_nargin=nargin_val; if (!nargin_set) nargin_val=0.0; nargin_set=0; double old_nargout=nargout_val; if (!nargout_set) nargout_val=0.0; nargout_set=0; // translated code #line 2 "d:/matcom45/ex.m"_ subplot(121.0); #line 3 "d:/matcom45/ex.m"_ surf((CL(peaks(25.0)))); #line 4 "d:/matcom45/ex.m"_ subplot(122.0); #line 5 "d:/matcom45/ex.m"_ pcolor((CL(peaks(25.0)))); call_stack_end; // nargin, nargout exit code nargin_val=old_nargin; nargout_val=old_nargout; // function exit code return x_M; end_scope }
开发者ID:hunterzhang86,项目名称:code,代码行数:32,
示例14: DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTSDEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SpecialSurface_Gpu1, reporter, ctxInfo) { sk_sp<SkSpecialSurface> surf(SkSpecialSurface::MakeRenderTarget(ctxInfo.grContext(), kSmallerSize, kSmallerSize, kSkia8888_GrPixelConfig)); test_surface(surf, reporter, 0);}
开发者ID:C-Tillion,项目名称:skia,代码行数:7,
示例15: onDraw virtual void onDraw(SkCanvas* canvas) { SkAutoTUnref<SkSurface> surf(compat_surface(canvas, this->getISize(), this->isCanvasDeferred())); surf->getCanvas()->drawColor(SK_ColorWHITE); this->drawContent(surf->getCanvas()); surf->draw(canvas, 0, 0, NULL); }
开发者ID:Adenilson,项目名称:skia,代码行数:7,
示例16: DEF_TESTDEF_TEST(SpecialSurface_Raster, reporter) { SkImageInfo info = SkImageInfo::MakeN32(kSmallerSize, kSmallerSize, kOpaque_SkAlphaType); sk_sp<SkSpecialSurface> surf(SkSpecialSurface::MakeRaster(info)); test_surface(surf, reporter, 0);}
开发者ID:aseprite,项目名称:skia,代码行数:7,
示例17: DEF_GPUTEST_FOR_RENDERING_CONTEXTSDEF_GPUTEST_FOR_RENDERING_CONTEXTS(PremulAlphaRoundTrip_Gpu, reporter, ctxInfo) { const SkImageInfo info = SkImageInfo::MakeN32Premul(256, 256); sk_sp<SkSurface> surf(SkSurface::MakeRenderTarget(ctxInfo.grContext(), SkBudgeted::kNo, info)); test_premul_alpha_roundtrip(reporter, surf.get());}
开发者ID:03050903,项目名称:skia,代码行数:8,
示例18: surfFoam::autoPtr< Foam::UnsortedMeshedSurface<Face> >Foam::UnsortedMeshedSurface<Face>::New(const fileName& name, const word& ext){ if (debug) { Info<< "UnsortedMeshedSurface::New(const fileName&, const word&) : " "constructing UnsortedMeshedSurface" << endl; } typename fileExtensionConstructorTable::iterator cstrIter = fileExtensionConstructorTablePtr_->find(ext); if (cstrIter == fileExtensionConstructorTablePtr_->end()) { // no direct reader, use the parent if possible wordHashSet supported = ParentType::readTypes(); if (supported.found(ext)) { // create indirectly autoPtr<UnsortedMeshedSurface<Face> > surf ( new UnsortedMeshedSurface<Face> ); surf().transfer(ParentType::New(name, ext)()); return surf; } // nothing left but to issue an error supported += readTypes(); FatalErrorIn ( "UnsortedMeshedSurface<Face>::New" "(const fileName&, const word&) : " "constructing UnsortedMeshedSurface" ) << "Unknown file extension " << ext << nl << nl << "Valid types are:" << nl << supported << exit(FatalError); } return autoPtr<UnsortedMeshedSurface<Face> >(cstrIter()(name));}
开发者ID:degirmen,项目名称:openfoam-extend-OpenFOAM-1.6-ext,代码行数:45,
示例19: lockint msh::ApplicationSession::configure_surface(mf::SurfaceId id, MirSurfaceAttrib attrib, int value){ std::unique_lock<std::mutex> lock(surfaces_mutex); std::shared_ptr<mf::Surface> surf(checked_find(id)->second); return surf->configure(attrib, value);}
开发者ID:TomasMM,项目名称:emir,代码行数:9,
示例20: mainintmain(int argc, char* argv[]){ try { const toptions& options = toptions::parse(argc, argv); surface surf(make_neutral_surface( IMG_Load(options.input_filename.c_str()))); if(!surf) { std::cerr << "Error: Failed to load input file C++ surface_from_resource函数代码示例 C++ supportsFocus函数代码示例
|