Blame view

old version/test_main - Copy.cpp 1.39 KB
b71cc8bb   Tianshu Cheng   mPb using 3 channels
1
2
3
4
5
  #include <stim/image/image.h>
  #include <cmath>
  #include <stim/visualization/colormap.h>
  #include <stim/image/image_contour_detection.h>
  #include <iostream>
6dcc460e   Tianshu Cheng   cPb+tPb
6
7
  #include <stim/visualization/colormap.h>
  
7fab7a98   Tianshu Cheng   a neat version of...
8
  /// calculate the mPb given a multi-channel image
b71cc8bb   Tianshu Cheng   mPb using 3 channels
9
  
abaf5630   David Mayerich   fixed the signed/...
10
  int main()
b71cc8bb   Tianshu Cheng   mPb using 3 channels
11
  {
7fab7a98   Tianshu Cheng   a neat version of...
12
  	stim::image<float> img;                             // generate an image object
6dcc460e   Tianshu Cheng   cPb+tPb
13
  	//stim::image<float> img_r; 
7fab7a98   Tianshu Cheng   a neat version of...
14
  
6dcc460e   Tianshu Cheng   cPb+tPb
15
16
  	//img.load("slice00_500_500.bmp");					// load the input image
  	img.load("101087_square.bmp");					// load the input image
7fab7a98   Tianshu Cheng   a neat version of...
17
18
19
20
21
22
  	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
6dcc460e   Tianshu Cheng   cPb+tPb
23
24
25
26
  
  	//img_r = img.rotate(45, w/2, h/2);
  	//stim::cpu2image(img_r.data(), "data_output/rotate_0915.bmp", w, h, stim::cmBrewer);  
  
7fab7a98   Tianshu Cheng   a neat version of...
27
28
29
30
31
32
33
  	 
  	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
b71cc8bb   Tianshu Cheng   mPb using 3 channels
34
  
abaf5630   David Mayerich   fixed the signed/...
35
  	return 0;
b71cc8bb   Tianshu Cheng   mPb using 3 channels
36
  
abaf5630   David Mayerich   fixed the signed/...
37
  }