18 #ifndef PIC_ALGORITHMS_SEGMENTATION_TMO_APPROX_HPP 19 #define PIC_ALGORITHMS_SEGMENTATION_TMO_APPROX_HPP 21 #include "../util/array.hpp" 22 #include "../util/std_util.hpp" 24 #include "../algorithms/superpixels_slic.hpp" 26 #include "../filtering/filter_luminance.hpp" 27 #include "../filtering/filter_iterative.hpp" 28 #include "../filtering/filter_bilateral_2ds.hpp" 58 float nLevels = log10f(maxVal) - log10f(minVal) + 1.0f;
59 float nLayer = ((maxVal - minVal) / nLevels) / 4.0f;
61 int iterations =
MAX(
int(sqrtf(area)) / 2, 1);
70 printf(
"Layer: %f iterations: %d\n", nLayer, iterations);
78 sp.
execute(imgIn, nSuperPixels);
138 #pragma omp parallel for 140 float L =
Arrayf::dot(weights, &data[i], channels) + 1e-7f;
141 imgOut->
data[i / 3] = floorf(log10f(
L));
144 delete_vec_s<float>(weights);
147 imgOut->
Write(
"Segmentation.pfm");
Definition: filter_luminance.hpp:28
int size() const
size computes the number of values.
Definition: image.hpp:481
float * data
data is the main buffer where pixel values are stored.
Definition: image.hpp:91
int channels
Definition: image.hpp:80
T * delete_s(T *data)
delete_s
Definition: std_util.hpp:123
The Slic class.
Definition: superpixels_slic.hpp:37
float heightf
Definition: image.hpp:84
The Segmentation class.
Definition: segmentation_tmo_approx.hpp:35
Image * L
Definition: segmentation_tmo_approx.hpp:40
float * getMinVal(BBox *box, float *ret)
getMinVal computes the minimum value for the current Image.
~Segmentation()
Definition: segmentation_tmo_approx.hpp:99
Image * ProcessAux(Image *imgIn, bool bBilateral, int nSuperPixels=4096)
ProcessAux.
Definition: segmentation_tmo_approx.hpp:51
static Image * execute(Image *imgIn, Image *imgOut, LUMINANCE_TYPE type=LT_CIE_LUMINANCE)
execute
Definition: filter_luminance.hpp:166
Image * Process(ImageVec imgIn, Image *imgOut)
Process.
Definition: filter_npasses.hpp:310
Segmentation()
Segmentation.
Definition: segmentation_tmo_approx.hpp:89
FilterBilateral2DS * fltBil
Definition: segmentation_tmo_approx.hpp:39
float widthf
Definition: image.hpp:84
static T dot(T *data0, T *data1, int n)
dot
Definition: array.hpp:281
The Image class stores an image as buffer of float.
Definition: image.hpp:60
void execute(Image *img, int nSuperPixels=64)
execute
Definition: superpixels_slic.hpp:302
PIC_INLINE ImageVec Single(Image *img)
Single creates an std::vector which contains img; this is for filters input.
Definition: image_vec.hpp:36
The FilterIterative class.
Definition: filter_iterative.hpp:28
Image * imgIn_flt
Definition: segmentation_tmo_approx.hpp:40
Definition: bilateral_separation.hpp:25
bool isValid()
isValid checks if the current image is valid, which means if they have an allocated buffer or not...
static float * computeWeights(LUMINANCE_TYPE type, int channels, float *weights)
computeWeights
Definition: filter_luminance.hpp:83
#define MAX(a, b)
Definition: math.hpp:73
float * getMaxVal(BBox *box, float *ret)
getMaxVal computes the maximum value for the current Image.
int width
Definition: image.hpp:80
int height
Definition: image.hpp:80
FilterIterative * fltIt
Definition: segmentation_tmo_approx.hpp:38
bool Write(std::string nameFile, LDR_type typeWrite, int writerCounter)
Write saves an Image into a file on the disk.
Image * getMeanImage(Image *imgOut)
getMeanImage
Definition: superpixels_slic.hpp:437
Image * Process(Image *imgIn, Image *imgOut)
Process.
Definition: segmentation_tmo_approx.hpp:113
The FilterBilateral2DS class.
Definition: filter_bilateral_2ds.hpp:36
float perCent
Definition: segmentation_tmo_approx.hpp:42