boost::shared_ptr<std::vector<float> > morphology(boost::shared_ptr<std::vector<float>> image, int w, int h, const int *strct, int strct_size, Morphology type, boost::shared_ptr<std::vector<float>> out_image) { uint size = w*h; if(out_image == nullptr || out_image->size() != size) { out_image = boost::make_shared<std::vector<float>>(size, 0); } //float * img = &out_image->at(0); // Calculate the gradient magnitude for(int x = 0; x < w; x++){ for(int y = 0; y < h; y++){ morph_op(&(*image)[0], w, h, &(*out_image)[0], x, y, strct, strct_size, type); } } return out_image; }
void Y_morph_dilation(int argc) { morph_op(argc, 1); }
void Y_morph_erosion(int argc) { morph_op(argc, 0); }