test_main - Copy.cpp
1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <stim/image/image.h>
#include <cmath>
#include <stim/visualization/colormap.h>
#include <stim/image/image_contour_detection.h>
#include <iostream>
#include <stim/visualization/colormap.h>
/// calculate the mPb given a multi-channel image
int main()
{
stim::image<float> img; // generate an image object
//stim::image<float> img_r;
//img.load("slice00_500_500.bmp"); // load the input image
img.load("101087_square.bmp"); // load the input image
img = img.channel(0); // get the first channel of black-and-white image
unsigned int w = img.width(); // get the width of picture
unsigned int h = img.height(); // get the height of picture
int c = img.channels(); // get the number if channels of picture
int s = 3; // set the number of scales
//img_r = img.rotate(45, w/2, h/2);
//stim::cpu2image(img_r.data(), "data_output/rotate_0915.bmp", w, h, stim::cmBrewer);
int r[3] = {3,5,10}; // set an array of radii for different scaled discs(filters)
float alpha[3] = {1,1,1}; // set an array of weights for different scaled discs(filters)
unsigned int theta_n = 8; // set the number of angles used for computing the gradient
stim::image<float> mPb; // allocate the space for mPb
mPb = func_mPb(img, theta_n, r, alpha, s); // calculate the mPb
return 0;
}