void add() { //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- // addition of update to the vector u //--------------------------------------------------------------------- int c, i, j, k, m; for (c = 1; c <= ncells; c++) { for (k = start(3,c); k <= cell_size(3,c)-end(3,c)-1; k++) { for (j = start(2,c); j <= cell_size(2,c)-end(2,c)-1; j++) { for (i = start(1,c); i <= cell_size(1,c)-end(1,c)-1; i++) { for (m = 1; m <= 5; m++) { u(m,i,j,k,c) = u(m,i,j,k,c) + rhs(m,i,j,k,c); } } } } } return; }
Cell * cell_get_next (Cell *in_cell) { if (cell_size(in_cell) == 0) { return NULL; } if (in_cell->next != NULL) { return in_cell->next; } offset ofs = offset_make_relative(cell_get_offset(in_cell), cell_size(in_cell)); if (!offset_is_valid(ofs)) { return NULL; } if (!bin_within(cell_get_bin(in_cell), ofs)) { return NULL; } Cell *next = cell_get(cell_get_hive(in_cell), cell_get_bin(in_cell), ofs); in_cell->next = next; return next; }
static void cell_header_vdump (ustring *in_ustr, Cell *in_cell) { ustr_printf (in_ustr, "== Bin Block (%08x)\n", offset_to_begin (cell_get_offset(in_cell))); ustr_printfa (in_ustr, "Allocated: %d\n", cell_is_allocd (in_cell)); ustr_printfa (in_ustr, "Size: (%d/%#x)\n", cell_size (in_cell), cell_size (in_cell)); }
bool make_mesh::run_impl() { output_parameter_proxy<netgen::mesh> omp(output_mesh); StdCaptureHandle capture_handle; if (omp != input_mesh) omp() = input_mesh(); ::netgen::MeshingParameters mesh_parameters; if (cell_size.valid()) { ::netgen::Point3d pmin; ::netgen::Point3d pmax; omp()().GetBox(pmin, pmax); double bb_volume = std::abs( (pmax.X() - pmin.X()) * (pmax.Y() - pmin.Y()) * (pmax.Z() - pmin.Z()) ); double cell_volume = cell_size()*cell_size()*cell_size(); double max_cell_count = 100000000; if ( cell_volume * max_cell_count < bb_volume ) { warning(1) << "Cell size is too small and might result in too much elements" << std::endl; warning(1) << "Cell size = " << cell_size() << std::endl; warning(1) << "Mesh max cell count = " << max_cell_count << std::endl; warning(1) << "Mesh bounding box = " << pmin << "," << pmax << std::endl; warning(1) << "Mesh bounding box volume = " << bb_volume << std::endl; warning(1) << "Mesh max cell volume = " << cell_volume * max_cell_count << std::endl; } mesh_parameters.maxh = cell_size(); } try { omp()().CalcLocalH(mesh_parameters.grading); MeshVolume (mesh_parameters, omp()()); RemoveIllegalElements (omp()()); OptimizeVolume (mesh_parameters, omp()()); } catch (::netgen::NgException const & ex) { error(1) << "Netgen Error: " << ex.What() << std::endl; return false; } return true; }
void compute_buffer_size(int dim) { //--------------------------------------------------------------------- //--------------------------------------------------------------------- int c, face_size; if (ncells == 1) return; //--------------------------------------------------------------------- // compute the actual sizes of the buffers; note that there is // always one cell face that doesn't need buffer space, because it // is at the boundary of the grid //--------------------------------------------------------------------- west_size = 0; east_size = 0; for (c = 1; c <= ncells; c++) { face_size = cell_size(2,c) * cell_size(3,c) * dim * 2; if (cell_coord(1,c)!=1) west_size = west_size + face_size; if (cell_coord(1,c)!=ncells) east_size = east_size + face_size ; } north_size = 0; south_size = 0; for (c = 1; c <= ncells; c++) { face_size = cell_size(1,c)*cell_size(3,c) * dim * 2; if (cell_coord(2,c)!=1) south_size = south_size + face_size; if (cell_coord(2,c)!=ncells) north_size = north_size + face_size ; } top_size = 0; bottom_size = 0; for (c = 1; c <= ncells; c++) { face_size = cell_size(1,c) * cell_size(2,c) * dim * 2; if (cell_coord(3,c)!=1) bottom_size = bottom_size + face_size; if (cell_coord(3,c)!=ncells) top_size = top_size + face_size ; } start_send_west = 1; start_send_east = start_send_west + west_size; start_send_south = start_send_east + east_size; start_send_north = start_send_south + south_size; start_send_bottom = start_send_north + north_size; start_send_top = start_send_bottom + bottom_size; start_recv_west = 1; start_recv_east = start_recv_west + west_size; start_recv_south = start_recv_east + east_size; start_recv_north = start_recv_south + south_size; start_recv_bottom = start_recv_north + north_size; start_recv_top = start_recv_bottom + bottom_size; return; }
gboolean cell_get_xml_output (const Cell *in_cell, ustring *in_output, gboolean in_verbose) { if (in_verbose) { ustr_printfa (in_output, "<Cell offset=\"%#010x\">\n", offset_to_begin (cell_get_offset((Cell*)in_cell))); ustr_printfa (in_output, " <allocated value =\"%s\"/>\n", cell_is_allocd ((Cell*)in_cell) ? "true" : "false"); ustr_printfa (in_output, " <size value=\"%d\"/>\n", cell_size ((Cell*)in_cell)); ustr_printfa (in_output, " <type value=\"%#06x\" str=\"%s\"/>\n", cell_get_id((Cell*)in_cell), cell_get_id_str((Cell*)in_cell)); ustr_printfa (in_output, " <data>\n"); ustr_hexdumpa(in_output, (const guint8*)get_data_const(in_cell), 0, cell_get_data_length((Cell*)in_cell), TRUE, FALSE); ustr_printfa (in_output, "\n</data>\n"); ustr_printfa (in_output, "</Cell>\n"); } else { ustr_printfa (in_output, "<Cell offset=\"%#010x\"", offset_to_begin (cell_get_offset((Cell*)in_cell))); // ustr_printfa (in_output, ", ptr=\"%p\"", p); ustr_printfa (in_output, ", alloced=\"%s\"", cell_is_allocd ((Cell*)in_cell) ? "Y" : "N"); ustr_printfa (in_output, ", size=\"%d\"", cell_size ((Cell*)in_cell)); ustr_printfa (in_output, ", type_id=\"%#06x\"", get_data_const(in_cell)->head.id); ustr_printfa (in_output, ", type=\"%s\"/>\n", cell_get_id_str((Cell*)in_cell)); } return TRUE; }
void rhs_norm(double rms[]) { //--------------------------------------------------------------------- //--------------------------------------------------------------------- int c, i, j, k, d, m, error; double rms_work[5], add; for (m = 1; m <= 5; m++) { rms_work(m) = 0.0e0; } for (c = 1; c <= ncells; c++) { for (k = start(3,c); k <= cell_size(3,c)-end(3,c)-1; k++) { for (j = start(2,c); j <= cell_size(2,c)-end(2,c)-1; j++) { for (i = start(1,c); i <= cell_size(1,c)-end(1,c)-1; i++) { for (m = 1; m <= 5; m++) { add = rhs(m,i,j,k,c); rms_work(m) = rms_work(m) + add*add; } } } } } RCCE_allreduce((char*)rms_work, (char*)rms, 5, RCCE_DOUBLE, RCCE_SUM, RCCE_COMM_WORLD); for (m = 1; m <= 5; m++) { for (d = 1; d <= 3; d++) { rms(m) = rms(m) / (double)(grid_points(d)-2); } rms(m) = sqrt(rms(m)); } return; }
static gboolean cell_split (Cell *in_cell, guint32 len) { rra_debug("Spliting cell %#010x with length %d", offset_to_begin(cell_get_offset(in_cell)), len); if (cell_is_allocd (in_cell)) { return FALSE; } if (cell_get_data_length (in_cell) < len) { return FALSE; } int new_size = len + sizeof (struct CellHeader); if (new_size % 8) new_size += 8 - (new_size % 8); /* If a secondary cell is large enough split in_cell and make a new * one */ if (cell_size (in_cell) - new_size >= HBB_MIN_LEN) { offset new_ofs = offset_make_relative(cell_get_offset(in_cell), new_size); if (offset_is_valid(new_ofs)) { cell_init(cell_get_hive(in_cell), cell_get_bin(in_cell), new_ofs, cell_size(in_cell) - new_size); get_data(in_cell)->head.size = new_size; in_cell->next = NULL; } } return TRUE; }
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); }
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)); }
void Render::Draw(bool is_small) { if(GetCurRM()->need_reload_shader) { _ReLoadShader(); } if(GetCurRM()->need_reload_color_table) { if(GetCurRM()->txt_color)delete GetCurRM()->txt_color; GetCurRM()->txt_color = new SimText3D(2,TF_WIDTH,MAX_VD_NUMBER,1,4,&GetCurRM()->color_table->x,0,1,GL_FLOAT); //txt_color = new Text(TF_WIDTH,MAX_VD_NUMBER,&CT::color_table->x,4,GL_FLOAT,1); GetCurRM()->need_reload_color_table=0; } vec3 pp,ll,tt; float kf = 0.5f; pp = CT::cam.GetPosition()+CT::cam.GetNav()*kf; if(CT::cam.GetProjection()) { float kff = kf * 0.4142f; ll = CT::cam.GetLeft()*kff*CT::width/(CT::height+0.001f); tt = CT::cam.GetTop()*kff; }else { ll = CT::cam.GetLeft()*CT::cam.GetDistance()*CT::width/(CT::height+0.1f); tt = CT::cam.GetTop()*CT::cam.GetDistance(); } // vec3 bb1=b1*scale,bb2=b2*scale; if(GetCurRM()->need_update_uniforms)_UpdateUniforms(); ShaderProgram*ps = GetCurRM()->sp; ps->Use(); vec3 box1 = b1; vec3 box2 = b2; ps->SetVar("pos",CT::cam.GetPosition()); ps->SetVar("nav",CT::cam.GetNav()); ps->SetVar("top",CT::cam.GetTop()); ps->SetVar("left",CT::cam.GetLeft()); ps->SetVar("screen_width",(float)CT::width); ps->SetVar("screen_height",(float)CT::height); ps->SetVar("box1",box1); ps->SetVar("box2",box2); ps->SetVar("LightDir",LightDir); ps->SetVar("step_length",step_length*((CT::IsFastView()||CT::is_changing)?CT::interaction_quality:1.0f)); ps->SetVar("random_seed",(CT::RenderingType==2) ? vec4(RND01,RND01,RND01,RND01)*2000 : vec4(300)); if(GetCurRM()->txt_color) { //glBindTexture(GL_TEXTURE_2D,txt_color->GetTexture()); ps->SetVar("txt_level_color",GetCurRM()->txt_color->SetID(TF_TXT_ID)); } if(changed_anag) { ps->SetVar("RFrom",anag[0]); ps->SetVar("GFrom",anag[1]); ps->SetVar("BFrom",anag[2]); changed_anag=0; } bool dr=0; for(int i=0;i<MAX_VD_NUMBER;i++) if(CT::GetData(i)->IsLoaded()) { dr=1; std::string idd = "["+str::ToString(i)+"]"; ps->SetVar1("min_level"+idd,GetCurRM()->min_level[i]); ps->SetVar1("max_level"+idd,GetCurRM()->max_level[i]); ps->SetVar1("opacity"+idd,GetCurRM()->opacity[i]); ps->SetVar1("IsoLast"+idd,GetCurRM()->iso_last[i]); ps->SetVar1("QuadLast"+idd,GetCurRM()->quad_last[i]); ps->SetVar1("tf_ww"+idd,GetCurRM()->tf_ww[i]); CS3 cc11 = volume_transform[i]; //cc11 = cc11._1(); // cc11.center = volume_transform[i].center; ps->SetVar1("cs_center"+idd,cc11.center); cc11.x /=cc11.x.lengthSQR(); cc11.y /=cc11.y.lengthSQR(); cc11.z /=cc11.z.lengthSQR(); vec3 vx = vec3(cc11.x.x,cc11.y.x,cc11.z.x); vec3 vy = vec3(cc11.x.y,cc11.y.y,cc11.z.y); vec3 vz = vec3(cc11.x.z,cc11.y.z,cc11.z.z); ps->SetVar1("cs_x"+idd,vx); ps->SetVar1("cs_y"+idd,vy); ps->SetVar1("cs_z"+idd,vz); // ps->SetVar("cs_x"+idd,cc11.x); // ps->SetVar("cs_y"+idd,cc11.y); // ps->SetVar("cs_z"+idd,cc11.z); ivec3 size1 = CT::GetData(i)->GetSize(); vec3 cell_size(1.0f/size1.x,1.0f/size1.y,1.0f/size1.z); ps->SetVar1("cell_size"+idd,cell_size); //ps->SetVar1("f_text"+idd,CT::GetData(i)->SetDataTextureID(VD_TXT_ID+i)); //ps->SetVar1("f_text_tf"+idd,CT::GetTFData(i)->SetDataTextureID(I_TXT_ID+i)); } if(CT::GetData(0)->IsLoaded()) { ps->SetVar1("f_text1",CT::GetData(0)->SetDataTextureID(VD_TXT_ID)); //ps->SetVar1("f_text_tf",CT::GetTFData(0)->SetDataTextureID(I_TXT_ID)); } if(CT::GetData(1)->IsLoaded()) { ps->SetVar1("f_text2",CT::GetData(1)->SetDataTextureID(VD_TXT_ID+1)); } ps->SetVar1("front_dist_txt", rtt_SetID(FRONT_FACE_TXT_ID,rtt_GetTexture(1))); ps->SetVar1("back_dist_txt", rtt_SetID(BACK_FACE_TXT_ID,rtt_GetTexture(2))); glColor3d(1,0,0); if(dr)DrawQuad(pp+ll+tt,pp-ll+tt,pp-ll-tt,pp+ll-tt); //DrawCube(bb1,bb2); //DrawSectOfCube(b1,b2,c->GetPosition()+c->GetNav(),c->GetNav()); ps->UnUse(); }
bool occ_make_mesh::run_impl() { io::FileType ft; if (filetype.valid()) ft = io::from_string( filetype() ); else ft = io::from_filename( filename() ); try { output_parameter_proxy<netgen::mesh> omp(output_mesh); ::netgen::OCCGeometry * geometry; if (ft == io::OCC_STEP) geometry = ::netgen::LoadOCC_STEP( filename().c_str() ); else if (ft == io::OCC_IGES) geometry = ::netgen::LoadOCC_IGES( filename().c_str() ); else { error(1) << "File type \"" << io::to_string(ft) << "\" is not supported" << std::endl; return false; } // http://sourceforge.net/p/netgen-mesher/discussion/905307/thread/7176bc7d/ TopTools_IndexedMapOfShape FMap; FMap.Assign( geometry->fmap ); if (!FMap.Extent()) { std::cout << "Error retrieving Face map... (OpenCascade error)" << endl; return false; } ::netgen::MeshingParameters mp; mp.elementorder = 0; mp.quad = 0; mp.inverttets = 0; mp.inverttrigs = 0; if (cell_size.valid()) { mp.uselocalh = 1; mp.maxh = cell_size(); } mp.curvaturesafety = curvature_safety_factor(); mp.segmentsperedge = segments_per_edge(); mp.grading = grading(); int perfstepsend = 6; omp()().geomtype = ::netgen::Mesh::GEOM_OCC; ::netgen::occparam.resthcloseedgeenable = 0; //mp.closeedgeenable; ::netgen::occparam.resthcloseedgefac = 1.0; //mp.closeedgefact; ::netgen::mparam = mp; omp()().DeleteMesh(); ::netgen::OCCSetLocalMeshSize( *geometry, omp()() ); ::netgen::OCCFindEdges(*geometry, omp()()); ::netgen::OCCMeshSurface(*geometry, omp()(), perfstepsend); omp()().CalcSurfacesOfNode(); ::netgen::MeshVolume(mp, omp()()); ::netgen::RemoveIllegalElements( omp()() ); ::netgen::MeshQuality3d( omp()() ); ::netgen::OptimizeVolume(mp, omp()() ); } catch (::netgen::NgException const & ex) { error(1) << "Netgen Error: " << ex.What() << std::endl; return false; } return true; }
bool adapt_hull::run_impl() { typedef viennagrid::triangular_3d_mesh MeshType; typedef viennagrid::triangular_3d_segmentation SegmentationType; typedef viennagrid::triangular_hull_3d_segmentation OrientedSegmentationType; typedef viennagrid::segmented_mesh<MeshType, SegmentationType> SegmentedMeshType; typedef viennagrid::segmented_mesh<MeshType, OrientedSegmentationType> OrientedSegmentedMeshType; { viennamesh::result_of::const_parameter_handle<OrientedSegmentedMeshType>::type imp = input_mesh.get<OrientedSegmentedMeshType>(); if (imp) { output_parameter_proxy<OrientedSegmentedMeshType> omp(output_mesh); ::vgmodeler::hull_adaptor adaptor; if (cell_size.valid()) adaptor.maxsize() = cell_size(); adaptor.process( imp().mesh, imp().segmentation, omp().mesh, omp().segmentation ); return true; } } // { // viennamesh::result_of::const_parameter_handle<SegmentedMeshType>::type imp = input_mesh.get<SegmentedMeshType>(); // if (imp) // { // output_parameter_proxy<OrientedSegmentedMeshType> omp(output_mesh); // // viennamesh::algorithm_handle segmenting_algo( new hull_segmenting() ); // segmenting_algo->set_input( "mesh", imp ); // segmenting_algo->run(); // // viennamesh::result_of::const_parameter_handle<OrientedSegmentedMeshType>::type tmp = // dynamic_handle_cast<OrientedSegmentedMeshType>(segmenting_algo->get_output("mesh")); // // ::vgmodeler::hull_adaptor adaptor; // if (cell_size.valid()) // adaptor.maxsize() = cell_size(); // adaptor.process( tmp().mesh, tmp().segmentation, omp().mesh, omp().segmentation ); // // return true; // } // } // // { // viennamesh::result_of::const_parameter_handle<MeshType>::type imp = input_mesh.get<MeshType>(); // if (imp) // { // output_parameter_proxy<OrientedSegmentedMeshType> omp(output_mesh); // // viennamesh::algorithm_handle segmenting_algo( new hull_segmenting() ); // segmenting_algo->set_input( "mesh", imp ); // segmenting_algo->run(); // // viennamesh::result_of::const_parameter_handle<OrientedSegmentedMeshType>::type tmp = // dynamic_handle_cast<OrientedSegmentedMeshType>(segmenting_algo->get_output("mesh")); // // ::vgmodeler::hull_adaptor adaptor; // if (cell_size.valid()) // adaptor.maxsize() = cell_size(); // adaptor.process( tmp().mesh, tmp().segmentation, omp().mesh, omp().segmentation ); // // return true; // } // } return false; }
gboolean hcheck_cell_pass(Hive *in_hive, RRACheckData *in_data) { if (in_hive == NULL) { return FALSE; } gboolean ret_val = TRUE; Bin *b; for (b = hive_get_first_bin(in_hive); b != NULL; b = bin_get_next_bin(b)) { offset end_of_bin = offset_make_relative(bin_get_offset(b), bin_size(b) - 1); if (offset_to_begin (end_of_bin) == 0) { rra_check_warning( in_data, _("Bad end offset for end of bin from: %d and %d"), bin_get_offset(b), bin_size(b)); bin_debug_print(b, TRUE); } Cell *last_c = NULL; Cell *c; for (c = bin_first_cell(b); c != NULL; last_c = c, c = cell_get_next(c)) { rra_check_checking(in_data, _("valid size")); if (cell_size(c) < sizeof(guint32) * 2) { rra_check_error(in_data, _("invalid cell size: %d"), cell_size(c)); ret_val = FALSE; } rra_check_checking(in_data, _("last cell correct")); if (cell_get_prev(c) != last_c) { rra_check_error(in_data, _("last cell incorrect")); ret_val = FALSE; } rra_check_checking(in_data, _("cell stays within bin")); offset end_of_cell = offset_make_relative(cell_get_offset(c), cell_size(c) - 1); int cmp_val = offset_compare(end_of_bin, end_of_cell); if (cmp_val < 0) { rra_check_error( in_data, _("cell extends past end of bin: " "Bin(%d) vs Cell(%d) => %d"), offset_to_begin(end_of_bin), offset_to_begin(end_of_cell), cmp_val); ret_val = FALSE; } } } return TRUE; }
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); //------------------------------------------------------------------------------ }
void advance(ptrdiff_t n) { m_proxy.m_ptr += n * cell_size(); }
guint32 cell_get_data_length (Cell *in_cell) { return cell_size (in_cell) - sizeof (struct CellHeader); }