void Game::rescaleGame(Field &field){ sf::Vector2u win_size(width*field.getDrawTileSize(), height*field.getDrawTileSize()); sf::VideoMode desk_VM(sf::VideoMode::getDesktopMode()); desk_VM.height -= 100; desk_VM.width -= 10; if (win_size.y > desk_VM.height) { float scale = (float)desk_VM.height/(float)win_size.y; field.setDrawScale(scale); win_size.x = width*field.getDrawTileSize(); win_size.y = height*field.getDrawTileSize(); } if (win_size.x > desk_VM.width) { float scale = (float)desk_VM.width/(float)win_size.x; field.setDrawScale(scale); win_size.x = width*field.getDrawTileSize(); win_size.y = height*field.getDrawTileSize(); } win.close(); VMode.width = win_size.x; VMode.height = win_size.y; win.create(VMode, "Minesweeper - SFML"); win.setFramerateLimit(30); }
ImageImPro* HOGDetectorGPU::detectPeople(ImageImPro* ptrImage){ ImageImPro* ptrGrayInput = ptrImage->getGrayScale(); GpuMat* ptrGpuMatInput = ptrGrayInput->getGPUMat(); Mat* ptrMatOutput = ptrGrayInput->getMat(); vector<float> detector; vector<Rect> found; Size win_size(48, 96); //creates a HOG Descriptor generator with the given window size gpu::HOGDescriptor gpu_hog(win_size); //gets the coefficients of the SVM trained to detect pedestrians with a window size of 48x96 detector = gpu::HOGDescriptor::getPeopleDetector48x96(); gpu_hog.setSVMDetector(detector); double hitThreshold = 0.0; Size sizeWinStride(8,8); double scale0 = 1.05; int groupThreshold = 1; gpu_hog.detectMultiScale(*ptrGpuMatInput, found, hitThreshold, sizeWinStride, Size(0,0), scale0, groupThreshold); for(int i = 0; i < (int)found.size(); ++i){ Rect current = found[i]; rectangle(*ptrMatOutput, current.tl(), current.br(), CV_RGB(0, 255, 0), 3); } ImageImPro* ptrOutput = new ImageImPro_OpenCvImpl(ptrMatOutput); delete ptrGpuMatInput; delete ptrMatOutput; delete ptrGrayInput; return ptrOutput; }
mp_size_t mpn_powm_sec_itch (mp_size_t bn, mp_size_t en, mp_size_t n) { int windowsize; mp_size_t redcify_itch, itch; windowsize = win_size (en * GMP_NUMB_BITS); /* slight over-estimate of exp */ itch = 4 * n + (n << windowsize); redcify_itch = 2 * bn + n + 1; /* The 6n is due to the placement of reduce scratch 6n into the start of the scratch area. */ return MAX (itch, redcify_itch + 6 * n); }
custHOG::custHOG() { imageSize = 128; // has to be <= than the image size !!!!! // Detection window size. Align to block size and block stride. cv::Size win_size(imageSize, imageSize); // Block size in pixels. cv::Size block_size(32, 32); // Block stride. It must be a multiple of cell size. cv::Size block_stride(16, 16); // Cell size. cv::Size cell_size(16, 16); // Number of bins. Only 9 bins per cell are supported for now. int nbins(3); // Didnt find Usage in Source Code // Theoretically Aperture Size of a Sobel Operator int derivAperture(1); // Gaussian smoothing window parameter. double win_sigma(-1); int histogramNormType(cv::HOGDescriptor::L2Hys); // L2-Hys normalization method shrinkage. double threshold_L2hys(0.2); // Flag to specify whether the gamma correction preprocessing is required or not. bool gamma_correction(true); // Maximum number of detection window increases. int nlevels(cv::HOGDescriptor::DEFAULT_NLEVELS); //hog = cv::HOGDescriptor(win_size,block_size,block_stride,cell_size,nbins,derivAperture,win_sigma,_histogramNormType,threshold_L2hys,gamma_correction,nlevels); hog = cv::HOGDescriptor(win_size,block_size,block_stride, cell_size, nbins, derivAperture,win_sigma, histogramNormType, threshold_L2hys, gamma_correction, nlevels); }
//More eficient version, designed for video processing Mat* HOGDetectorGPU::detectPeople(Mat* ptrMat){ Mat* ptrMatImage = ptrMat; gpu::GpuMat gpuMat; gpuMat.upload(*ptrMatImage); vector<float> detector; vector<Rect> found; Size win_size(48, 96); gpu::HOGDescriptor gpu_hog(win_size); //Sets the svm trained to detect people detector = gpu::HOGDescriptor::getPeopleDetector48x96(); gpu_hog.setSVMDetector(detector); double hitThreshold = 0.9; Size sizeWinStride(8,8); double scale0 = 1.05; int groupThreshold = 2; gpu_hog.detectMultiScale(gpuMat, found, hitThreshold, sizeWinStride, Size(0,0), scale0, groupThreshold); for(int i = 0; i < (int)found.size(); ++i){ Rect current = found[i]; rectangle(*ptrMatImage, current.tl(), current.br(), CV_RGB(0, 255, 0), 3); } return ptrMatImage; }
CUDA_TEST_P(Hog_var, HOG) { cv::cuda::GpuMat _img(c_img); cv::cuda::GpuMat d_img; int win_stride_width = 8;int win_stride_height = 8; int win_width = 16; int block_width = 8; int block_stride_width = 4;int block_stride_height = 4; int cell_width = 4; int nbins = 9; Size win_stride(win_stride_width, win_stride_height); Size win_size(win_width, win_width * 2); Size block_size(block_width, block_width); Size block_stride(block_stride_width, block_stride_height); Size cell_size(cell_width, cell_width); cv::Ptr<cv::cuda::HOG> gpu_hog = cv::cuda::HOG::create(win_size, block_size, block_stride, cell_size, nbins); gpu_hog->setNumLevels(13); gpu_hog->setHitThreshold(0); gpu_hog->setWinStride(win_stride); gpu_hog->setScaleFactor(1.05); gpu_hog->setGroupThreshold(8); gpu_hog->compute(_img, d_img); vector<float> gpu_desc_vec; ASSERT_TRUE(gpu_desc_vec.empty()); cv::Mat R(d_img); cv::HOGDescriptor cpu_hog(win_size, block_size, block_stride, cell_size, nbins); cpu_hog.nlevels = 13; vector<float> cpu_desc_vec; ASSERT_TRUE(cpu_desc_vec.empty()); cpu_hog.compute(c_img, cpu_desc_vec, win_stride, Size(0,0)); }
/* rp[n-1..0] = bp[bn-1..0] ^ ep[en-1..0] mod mp[n-1..0] Requires that mp[n-1..0] is odd. FIXME: is this true? Requires that ep[en-1..0] is > 1. Uses scratch space at tp of 3n+1 limbs. */ void mpn_powm_sec (mp_ptr rp, mp_srcptr bp, mp_size_t bn, mp_srcptr ep, mp_size_t en, mp_srcptr mp, mp_size_t n, mp_ptr tp) { mp_limb_t minv; int cnt; mp_bitcnt_t ebi; int windowsize, this_windowsize; mp_limb_t expbits; mp_ptr pp, this_pp; long i; int cnd; ASSERT (en > 1 || (en == 1 && ep[0] > 0)); ASSERT (n >= 1 && ((mp[0] & 1) != 0)); count_leading_zeros (cnt, ep[en - 1]); ebi = (mp_bitcnt_t) en * GMP_LIMB_BITS - cnt; windowsize = win_size (ebi); binvert_limb (minv, mp[0]); minv = -minv; pp = tp + 4 * n; this_pp = pp; this_pp[n] = 1; redcify (this_pp, this_pp + n, 1, mp, n, tp + 6 * n); this_pp += n; redcify (this_pp, bp, bn, mp, n, tp + 6 * n); /* Precompute powers of b and put them in the temporary area at pp. */ for (i = (1 << windowsize) - 2; i > 0; i--) { mpn_mul_basecase (tp, this_pp, n, pp + n, n); this_pp += n; mpn_redc_1_sec (this_pp, tp, mp, n, minv); } expbits = getbits (ep, ebi, windowsize); if (ebi < windowsize) ebi = 0; else ebi -= windowsize; #if WANT_CACHE_SECURITY mpn_tabselect (rp, pp, n, 1 << windowsize, expbits); #else MPN_COPY (rp, pp + n * expbits, n); #endif while (ebi != 0) { expbits = getbits (ep, ebi, windowsize); this_windowsize = windowsize; if (ebi < windowsize) { this_windowsize -= windowsize - ebi; ebi = 0; } else ebi -= windowsize; do { mpn_local_sqr (tp, rp, n, tp + 2 * n); mpn_redc_1_sec (rp, tp, mp, n, minv); this_windowsize--; } while (this_windowsize != 0); #if WANT_CACHE_SECURITY mpn_tabselect (tp + 2*n, pp, n, 1 << windowsize, expbits); mpn_mul_basecase (tp, rp, n, tp + 2*n, n); #else mpn_mul_basecase (tp, rp, n, pp + n * expbits, n); #endif mpn_redc_1_sec (rp, tp, mp, n, minv); } MPN_COPY (tp, rp, n); MPN_ZERO (tp + n, n); mpn_redc_1_sec (rp, tp, mp, n, minv); cnd = mpn_sub_n (tp, rp, mp, n); /* we need just retval */ mpn_subcnd_n (rp, rp, mp, n, !cnd); }
void cv::viz::InteractorStyle::OnKeyDown() { CV_Assert("Interactor style not initialized. Please call Initialize() before continuing" && init_); FindPokedRenderer(Interactor->GetEventPosition()[0], Interactor->GetEventPosition()[1]); // Save the initial windows width/height if (win_size_[0] == -1 || win_size_[1] == -1) win_size_ = Vec2i(Interactor->GetRenderWindow()->GetSize()); bool alt = Interactor->GetAltKey() != 0; std::string key(Interactor->GetKeySym()); if (key.find("XF86ZoomIn") != std::string::npos) zoomIn(); else if (key.find("XF86ZoomOut") != std::string::npos) zoomOut(); switch (Interactor->GetKeyCode()) { case 'h': case 'H': { std::cout << "| Help:\n" "-------\n" " p, P : switch to a point-based representation\n" " w, W : switch to a wireframe-based representation (where available)\n" " s, S : switch to a surface-based representation (where available)\n" "\n" " j, J : take a .PNG snapshot of the current window view\n" " k, K : export scene to Wavefront .obj format\n" " ALT + k, K : export scene to VRML format\n" " c, C : display current camera/window parameters\n" " f, F : fly to point mode, hold the key and move mouse where to fly\n" "\n" " e, E : exit the interactor\n" " q, Q : stop and call VTK's TerminateApp\n" "\n" " +/- : increment/decrement overall point size\n" " +/- [+ ALT] : zoom in/out \n" "\n" " r, R [+ ALT] : reset camera [to viewpoint = {0, 0, 0} -> center_{x, y, z}]\n" "\n" " ALT + s, S : turn stereo mode on/off\n" " ALT + f, F : switch between maximized window mode and original size\n" "\n" << std::endl; break; } // Switch representation to points case 'p': case 'P': { vtkSmartPointer<vtkActorCollection> ac = CurrentRenderer->GetActors(); vtkCollectionSimpleIterator ait; for (ac->InitTraversal(ait); vtkActor* actor = ac->GetNextActor(ait); ) for (actor->InitPathTraversal(); vtkAssemblyPath* path = actor->GetNextPath(); ) { vtkActor* apart = vtkActor::SafeDownCast(path->GetLastNode()->GetViewProp()); apart->GetProperty()->SetRepresentationToPoints(); } break; } // Save a PNG snapshot case 'j': case 'J': saveScreenshot(cv::format("screenshot-%d.png", (unsigned int)time(0))); break; // Export scene as in obj or vrml format case 'k': case 'K': { String format = alt ? "scene-%d.vrml" : "scene-%d"; exportScene(cv::format(format.c_str(), (unsigned int)time(0))); break; } // display current camera settings/parameters case 'c': case 'C': { vtkSmartPointer<vtkCamera> cam = Interactor->GetRenderWindow()->GetRenderers()->GetFirstRenderer()->GetActiveCamera(); Vec2d clip(cam->GetClippingRange()); Vec3d focal(cam->GetFocalPoint()), pos(cam->GetPosition()), view(cam->GetViewUp()); Vec2i win_pos(Interactor->GetRenderWindow()->GetPosition()); Vec2i win_size(Interactor->GetRenderWindow()->GetSize()); double angle = cam->GetViewAngle () / 180.0 * CV_PI; String data = cv::format("clip(%f,%f) focal(%f,%f,%f) pos(%f,%f,%f) view(%f,%f,%f) angle(%f) winsz(%d,%d) winpos(%d,%d)", clip[0], clip[1], focal[0], focal[1], focal[2], pos[0], pos[1], pos[2], view[0], view[1], view[2], angle, win_size[0], win_size[1], win_pos[0], win_pos[1]); std::cout << data.c_str() << std::endl; break; } case '=': { zoomIn(); break; } case 43: // KEY_PLUS { if (alt) zoomIn(); else { vtkSmartPointer<vtkActorCollection> ac = CurrentRenderer->GetActors(); vtkCollectionSimpleIterator ait; for (ac->InitTraversal(ait); vtkActor* actor = ac->GetNextActor(ait); ) for (actor->InitPathTraversal(); vtkAssemblyPath* path = actor->GetNextPath(); ) { vtkActor* apart = vtkActor::SafeDownCast(path->GetLastNode()->GetViewProp()); float psize = apart->GetProperty()->GetPointSize(); if (psize < 63.0f) apart->GetProperty()->SetPointSize(psize + 1.0f); } } break; } case 45: // KEY_MINUS { if (alt) zoomOut(); else { vtkSmartPointer<vtkActorCollection> ac = CurrentRenderer->GetActors(); vtkCollectionSimpleIterator ait; for (ac->InitTraversal(ait); vtkActor* actor = ac->GetNextActor(ait); ) for (actor->InitPathTraversal(); vtkAssemblyPath* path = actor->GetNextPath(); ) { vtkActor* apart = vtkActor::SafeDownCast(path->GetLastNode()->GetViewProp()); float psize = apart->GetProperty()->GetPointSize(); if (psize > 1.0f) apart->GetProperty()->SetPointSize(psize - 1.0f); } } break; } // Switch between maximize and original window size case 'f': case 'F': { if (alt) { Vec2i screen_size(Interactor->GetRenderWindow()->GetScreenSize()); Vec2i win_size(Interactor->GetRenderWindow()->GetSize()); // Is window size = max? if (win_size == max_win_size_) { Interactor->GetRenderWindow()->SetSize(win_size_.val); Interactor->GetRenderWindow()->SetPosition(win_pos_.val); Interactor->GetRenderWindow()->Render(); Interactor->Render(); } // Set to max else { win_pos_ = Vec2i(Interactor->GetRenderWindow()->GetPosition()); win_size_ = win_size; Interactor->GetRenderWindow()->SetSize(screen_size.val); Interactor->GetRenderWindow()->Render(); Interactor->Render(); max_win_size_ = Vec2i(Interactor->GetRenderWindow()->GetSize()); } } else { AnimState = VTKIS_ANIM_ON; Interactor->GetPicker()->Pick(Interactor->GetEventPosition()[0], Interactor->GetEventPosition()[1], 0.0, CurrentRenderer); vtkSmartPointer<vtkAbstractPropPicker> picker = vtkAbstractPropPicker::SafeDownCast(Interactor->GetPicker()); if (picker) if (picker->GetPath()) Interactor->FlyTo(CurrentRenderer, picker->GetPickPosition()); AnimState = VTKIS_ANIM_OFF; } break; } // 's'/'S' w/out ALT case 's': case 'S': { if (alt) { vtkSmartPointer<vtkRenderWindow> window = Interactor->GetRenderWindow(); if (!window->GetStereoRender()) { static Vec2i red_blue(4, 3), magenta_green(2, 5); window->SetAnaglyphColorMask (stereo_anaglyph_mask_default_ ? red_blue.val : magenta_green.val); stereo_anaglyph_mask_default_ = !stereo_anaglyph_mask_default_; } window->SetStereoRender(!window->GetStereoRender()); Interactor->Render(); } else Superclass::OnKeyDown(); break; } case 'o': case 'O': { vtkSmartPointer<vtkCamera> cam = CurrentRenderer->GetActiveCamera(); cam->SetParallelProjection(!cam->GetParallelProjection()); CurrentRenderer->Render(); break; } // Overwrite the camera reset case 'r': case 'R': { if (!alt) { Superclass::OnKeyDown(); break; } WidgetActorMap::iterator it = widget_actor_map_->begin(); // it might be that some actors don't have a valid transformation set -> we skip them to avoid a seg fault. for (; it != widget_actor_map_->end(); ++it) { vtkProp3D * actor = vtkProp3D::SafeDownCast(it->second); if (actor && actor->GetUserMatrix()) break; } vtkSmartPointer<vtkCamera> cam = CurrentRenderer->GetActiveCamera(); // if a valid transformation was found, use it otherwise fall back to default view point. if (it != widget_actor_map_->end()) { vtkMatrix4x4* m = vtkProp3D::SafeDownCast(it->second)->GetUserMatrix(); cam->SetFocalPoint(m->GetElement(0, 3) - m->GetElement(0, 2), m->GetElement(1, 3) - m->GetElement(1, 2), m->GetElement(2, 3) - m->GetElement(2, 2)); cam->SetViewUp (m->GetElement(0, 1), m->GetElement(1, 1), m->GetElement(2, 1)); cam->SetPosition(m->GetElement(0, 3), m->GetElement(1, 3), m->GetElement(2, 3)); } else { cam->SetPosition(0, 0, 0); cam->SetFocalPoint(0, 0, 1); cam->SetViewUp(0, -1, 0); } // go to the next actor for the next key-press event. if (it != widget_actor_map_->end()) ++it; else it = widget_actor_map_->begin(); CurrentRenderer->SetActiveCamera(cam); CurrentRenderer->ResetCameraClippingRange(); CurrentRenderer->Render(); break; } case 'q': case 'Q': { Interactor->ExitCallback(); return; } default: { Superclass::OnKeyDown(); break; } } KeyboardEvent event(KeyboardEvent::KEY_DOWN, Interactor->GetKeySym(), Interactor->GetKeyCode(), getModifiers()); if (keyboardCallback_) keyboardCallback_(event, keyboard_callback_cookie_); Interactor->Render(); }
/* rp[n-1..0] = bp[bn-1..0] ^ ep[en-1..0] mod mp[n-1..0] Requires that mp[n-1..0] is odd. Requires that ep[en-1..0] is > 1. Uses scratch space tp[3n..0], i.e., 3n+1 words. */ void mpn_powm_sec (mp_ptr rp, mp_srcptr bp, mp_size_t bn, mp_srcptr ep, mp_size_t en, mp_srcptr mp, mp_size_t n, mp_ptr tp) { mp_limb_t mip[2]; int cnt; long ebi; int windowsize, this_windowsize; mp_limb_t expbits; mp_ptr pp, this_pp, last_pp; long i; int redc_x; TMP_DECL; ASSERT (en > 1 || (en == 1 && ep[0] > 1)); ASSERT (n >= 1 && ((mp[0] & 1) != 0)); TMP_MARK; count_leading_zeros (cnt, ep[en - 1]); ebi = en * GMP_LIMB_BITS - cnt; windowsize = win_size (ebi); if (BELOW_THRESHOLD (n, REDC_2_THRESHOLD)) { binvert_limb (mip[0], mp[0]); mip[0] = -mip[0]; redc_x = 1; } #if defined (HAVE_NATIVE_mpn_addmul_2) else { mpn_binvert (mip, mp, 2, tp); mip[0] = -mip[0]; mip[1] = ~mip[1]; redc_x = 2; } #endif #if 0 mpn_binvert (mip, mp, n, tp); redc_x = 0; #endif pp = TMP_ALLOC_LIMBS (n << windowsize); this_pp = pp; this_pp[n] = 1; redcify (this_pp, this_pp + n, 1, mp, n); this_pp += n; redcify (this_pp, bp, bn, mp, n); /* Precompute powers of b and put them in the temporary area at pp. */ for (i = (1 << windowsize) - 2; i > 0; i--) { last_pp = this_pp; this_pp += n; mpn_mul_n (tp, last_pp, pp + n, n); MPN_REDC_X (this_pp, tp, mp, n, mip); } expbits = getbits (ep, ebi, windowsize); ebi -= windowsize; if (ebi < 0) ebi = 0; MPN_COPY (rp, pp + n * expbits, n); while (ebi != 0) { expbits = getbits (ep, ebi, windowsize); ebi -= windowsize; this_windowsize = windowsize; if (ebi < 0) { this_windowsize += ebi; ebi = 0; } do { mpn_sqr_n (tp, rp, n); MPN_REDC_X (rp, tp, mp, n, mip); this_windowsize--; } while (this_windowsize != 0); #if WANT_CACHE_SECURITY mpn_tabselect (tp + 2*n, pp, n, 1 << windowsize, expbits); mpn_mul_n (tp, rp, tp + 2*n, n); #else mpn_mul_n (tp, rp, pp + n * expbits, n); #endif MPN_REDC_X (rp, tp, mp, n, mip); } MPN_COPY (tp, rp, n); MPN_ZERO (tp + n, n); MPN_REDC_X (rp, tp, mp, n, mip); if (mpn_cmp (rp, mp, n) >= 0) mpn_sub_n (rp, rp, mp, n); TMP_FREE; }
CUDA_TEST_P(Hog_var_cell, HOG) { cv::cuda::GpuMat _img(c_img); cv::cuda::GpuMat _img2(c_img2); cv::cuda::GpuMat _img3(c_img3); cv::cuda::GpuMat _img4(c_img4); cv::cuda::GpuMat d_img; ASSERT_FALSE(_img.empty()); ASSERT_TRUE(d_img.empty()); int win_stride_width = 8;int win_stride_height = 8; int win_width = 48; int block_width = 16; int block_stride_width = 8;int block_stride_height = 8; int cell_width = 8; int nbins = 9; Size win_stride(win_stride_width, win_stride_height); Size win_size(win_width, win_width * 2); Size block_size(block_width, block_width); Size block_stride(block_stride_width, block_stride_height); Size cell_size(cell_width, cell_width); cv::Ptr<cv::cuda::HOG> gpu_hog = cv::cuda::HOG::create(win_size, block_size, block_stride, cell_size, nbins); gpu_hog->setNumLevels(13); gpu_hog->setHitThreshold(0); gpu_hog->setWinStride(win_stride); gpu_hog->setScaleFactor(1.05); gpu_hog->setGroupThreshold(8); gpu_hog->compute(_img, d_img); //------------------------------------------------------------------------------ cv::cuda::GpuMat d_img2; ASSERT_TRUE(d_img2.empty()); int win_stride_width2 = 8;int win_stride_height2 = 8; int win_width2 = 48; int block_width2 = 16; int block_stride_width2 = 8;int block_stride_height2 = 8; int cell_width2 = 4; Size win_stride2(win_stride_width2, win_stride_height2); Size win_size2(win_width2, win_width2 * 2); Size block_size2(block_width2, block_width2); Size block_stride2(block_stride_width2, block_stride_height2); Size cell_size2(cell_width2, cell_width2); cv::Ptr<cv::cuda::HOG> gpu_hog2 = cv::cuda::HOG::create(win_size2, block_size2, block_stride2, cell_size2, nbins); gpu_hog2->setWinStride(win_stride2); gpu_hog2->compute(_img, d_img2); //------------------------------------------------------------------------------ cv::cuda::GpuMat d_img3; ASSERT_TRUE(d_img3.empty()); int win_stride_width3 = 9;int win_stride_height3 = 9; int win_width3 = 54; int block_width3 = 18; int block_stride_width3 = 9;int block_stride_height3 = 9; int cell_width3 = 6; Size win_stride3(win_stride_width3, win_stride_height3); Size win_size3(win_width3, win_width3 * 2); Size block_size3(block_width3, block_width3); Size block_stride3(block_stride_width3, block_stride_height3); Size cell_size3(cell_width3, cell_width3); cv::Ptr<cv::cuda::HOG> gpu_hog3 = cv::cuda::HOG::create(win_size3, block_size3, block_stride3, cell_size3, nbins); gpu_hog3->setWinStride(win_stride3); gpu_hog3->compute(_img2, d_img3); //------------------------------------------------------------------------------ cv::cuda::GpuMat d_img4; ASSERT_TRUE(d_img4.empty()); int win_stride_width4 = 16;int win_stride_height4 = 16; int win_width4 = 64; int block_width4 = 32; int block_stride_width4 = 16;int block_stride_height4 = 16; int cell_width4 = 8; Size win_stride4(win_stride_width4, win_stride_height4); Size win_size4(win_width4, win_width4 * 2); Size block_size4(block_width4, block_width4); Size block_stride4(block_stride_width4, block_stride_height4); Size cell_size4(cell_width4, cell_width4); cv::Ptr<cv::cuda::HOG> gpu_hog4 = cv::cuda::HOG::create(win_size4, block_size4, block_stride4, cell_size4, nbins); gpu_hog4->setWinStride(win_stride4); gpu_hog4->compute(_img3, d_img4); //------------------------------------------------------------------------------ cv::cuda::GpuMat d_img5; ASSERT_TRUE(d_img5.empty()); int win_stride_width5 = 16;int win_stride_height5 = 16; int win_width5 = 64; int block_width5 = 32; int block_stride_width5 = 16;int block_stride_height5 = 16; int cell_width5 = 16; Size win_stride5(win_stride_width5, win_stride_height5); Size win_size5(win_width5, win_width5 * 2); Size block_size5(block_width5, block_width5); Size block_stride5(block_stride_width5, block_stride_height5); Size cell_size5(cell_width5, cell_width5); cv::Ptr<cv::cuda::HOG> gpu_hog5 = cv::cuda::HOG::create(win_size5, block_size5, block_stride5, cell_size5, nbins); gpu_hog5->setWinStride(win_stride5); gpu_hog5->compute(_img3, d_img5); //------------------------------------------------------------------------------ }