8 #ifndef IMPEM2D_IMAGE_PROCESSING_H
9 #define IMPEM2D_IMAGE_PROCESSING_H
11 #include "IMP/em2d/em2d_config.h"
19 IMPEM2D_BEGIN_NAMESPACE
25 double image_pixel_size;
26 double diffusion_beta;
27 double diffusion_timesteps;
28 double fill_holes_stddevs;
29 cv::Mat opening_kernel;
30 double remove_sizing_percentage;
31 int binary_background;
32 int binary_foreground;
37 diffusion_timesteps(200),
38 fill_holes_stddevs(1.0),
39 remove_sizing_percentage (0.1),
43 opening_kernel = cv::Mat::ones(3,3,CV_64FC1);
48 unsigned int diff_timesteps,
53 image_pixel_size(apix),
54 diffusion_beta(diff_beta),
55 diffusion_timesteps(diff_timesteps),
56 fill_holes_stddevs(fh_stddevs),
58 binary_background(background),
59 binary_foreground(foreground) {};
61 void show(std::ostream &out = std::cout)
const {
62 out <<
"Diffusion parameters: " << std::endl;
63 out <<
"image_pixel_size " << image_pixel_size << std::endl;
64 out <<
"diffusion_beta " << diffusion_beta << std::endl;
65 out <<
"diffusion_timesteps " << diffusion_timesteps << std::endl;
66 out <<
"fill_holes_stddevs " << fill_holes_stddevs << std::endl;
67 out <<
"Opening kernel " << opening_kernel.rows
68 <<
"x" << opening_kernel.cols << std::endl;
69 out <<
"binary_background " << binary_background << std::endl;
70 out <<
"binary_foreground " << binary_foreground << std::endl;
82 double cross_correlation;
85 void show(std::ostream &out = std::cout)
const {
86 out <<
"MatchTemplateResult: Pair (" << pair.first <<
"," << pair.second
87 <<
") ccc = " << cross_correlation << std::endl;
102 IMPEM2DEXPORT
void apply_mask(
const cv::Mat &m,
104 const cvIntMat &mask,
121 IMPEM2DEXPORT
double get_mean(
const cv::Mat &mat,
const cvIntMat &mask);
142 IMPEM2DEXPORT
void do_remove_small_objects(cvIntMat &m,
148 IMPEM2DEXPORT
void do_histogram_stretching(cv::Mat &m,
160 const cv::Mat &greyscale,
175 int neighbors_mode=4);
187 cvIntMat &mat_to_label);
196 IMPEM2DEXPORT
void do_segmentation(
const cv::Mat &m,
211 unsigned int time_steps);
236 IMPEM2DEXPORT
void do_fill_holes(
const cv::Mat &m,
248 IMPEM2DEXPORT
void get_domes(cv::Mat &m,cv::Mat &result,
double h) ;
260 IMPEM2DEXPORT
void do_combined_fill_holes_and_threshold(cv::Mat &m,
263 double threshold=0.0);
285 cv::Mat &filtered,
int kernelsize);
305 IMPEM2DEXPORT
void add_noise(cv::Mat &v,
double op1,
double op2,
306 const String &mode =
"uniform",
double df = 3);
326 IMPEM2DEXPORT
void my_meanStdDev(
const cv::Mat &m,
334 IMPEM2DEXPORT
void get_transformed(
const cv::Mat &input,
335 cv::Mat &transformed,
345 IMPEM2DEXPORT
void do_extend_borders(cv::Mat &orig,
355 double threshold=0.0);
367 const cv::Mat &kernel,
368 unsigned int iterations);
375 const cv::Mat &kernel);
390 const IntPair ¢er);
399 const cv::Mat &templ,
408 IMPEM2DEXPORT cv::Mat
crop(
const cv::Mat &m,
409 const IntPair ¢er,
414 IMPEM2D_END_NAMESPACE
void do_morphologic_contrast_enhancement(const cv::Mat &m, cv::Mat &result, const cv::Mat &kernel, unsigned int iterations)
double get_mean(const cv::Mat &mat, const cvIntMat &mask)
Import IMP/kernel/base_types.h in the namespace.
void apply_threshold(cv::Mat &m, cv::Mat &result, double threshold=0.0)
Class to provide all the parameters to the segmentation function.
cvIntMat create_circular_mask(int rows, int cols, int radius)
void apply_variance_filter(Image *input, Image *filtered, int kernelsize)
void apply_diffusion_filter(Image *input, Image *filtered, double beta, double pixelsize, int time_steps)
int do_labeling(const cvIntMat &m, cvIntMat &mat_to_label)
Labeling function for a matrix.
MatchTemplateResults get_best_template_matches(const cv::Mat &m, const cv::Mat &templ, unsigned int n)
#define IMP_VALUES(Name, PluralName)
Define the type for storing sets of values.
inteface with OpenCV Copyright 2007-2013 IMP Inventors. All rights reserved.
Floats get_histogram(Image *img, int bins)
void apply_circular_mask(const cv::Mat &mat, cv::Mat &result, int radius, double value=0.0)
Funtions related with rotations in em2d Copyright 2007-2013 IMP Inventors. All rights reserved...
void crop(Image *img, const IntPair ¢er, int size)
void get_morphologic_gradient(const cv::Mat &m, cv::Mat &result, const cv::Mat &kernel)
void apply_mask(const cv::Mat &m, cv::Mat &result, const cvIntMat &mask, double val)
Applies a binary mask to an image.
void get_domes(cv::Mat &m, cv::Mat &result, double h)
Gets the domes of m with height h.
void do_normalize(Image *im, bool force=false)
void do_dilate_and_shrink_warp(cv::Mat &m, const cv::Mat &greyscale, cv::Mat &kernel)
(U. Adiga, 2005)
void do_resample_polar(Image *im1, Image *im2, const PolarResamplingParameters &polar_params)
double get_overlap_percentage(cv::Mat &m1, cv::Mat &m2, const IntPair ¢er)
void show(Hierarchy h, std::ostream &out=std::cout)
Print out a molecular hierarchy.
void get_diffusion_filtering_partial_derivative(const cv::Mat &m, cv::Mat &der, double dx, double dy, double ang)
void do_morphologic_reconstruction(const cv::Mat &mask, cv::Mat &marker, int neighbors_mode=4)
morphologic grayscale reconstruction (L Vincent, 1993)
std::string String
Basic string value.