A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.arrayfire.org/docs/image_processing_2brain_segmentation_8cpp-example.htm below:

ArrayFire: image_processing/brain_segmentation.cpp

#include <math.h>

#include <stdio.h>

#include <string.h>

#include "../common/progress.h"

const float h_sx_kernel[] = {1, 2, 1, 0, 0, 0, -1, -2, -1};

const float h_sy_kernel[] = {-1, 0, 1, -2, 0, 2, -1, 0, 1};

}

return f * e;

}

array

I1 = A(span, span, k);

float mx = max<float>(I1);

float mn = min<float>(I1);

float u0 = 0.9 * mx;

float s0 = (mx - mn) / 2;

float u1 = 1.1 * mn;

float s1 = (mx - mn) / 2;

array

L0 = gauss(I1, u0, s0);

array

L11 = gauss(I1, u1, s1);

if (k == 0) {

L10 = L11;

} else {

L10 = L11_old;

L11 = L12_old;

}

if

(k < A.

dims

(2) - 1) {

L12 = gauss(A(span, span, k + 1), u1, s1);

} else {

L12 = L11;

}

L11_old = L11;

L12_old = L12;

array

L1 = (L10 + L11 + L12) / 3;

}

void brain_seg(bool console) {

double time_total = 30;

int slices = 256;

int N = 2 * slices - 1;

timer

t = timer::start();

int iter = 0;

for (int i = 0; !wnd.close(); i++) {

iter++;

int j = i % N;

int k = std::min(j, N - j);

array

Bi = B(span, span, k);

array

Si = segment_volume(B, k);

array

Ei = edges_slice(Si);

if (!console) {

wnd.grid(2, 2);

wnd(0, 0).image(Bi / 255.f, "Input");

wnd(1, 0).image(Ei, "Edges");

wnd(0, 1).image(Mi / 255.f, "Meanshift");

wnd(1, 1).image(Si, "Segmented");

wnd.show();

} else {

}

if (!progress(iter, t, time_total)) break;

if (!(i < 100 * N)) break;

}

}

int main(int argc, char* argv[]) {

int device = argc > 1 ? atoi(argv[1]) : 0;

bool console = argc > 2 ? argv[2][0] == '-' : false;

try {

printf("Brain segmentation example\n");

brain_seg(console);

return 0;

}

Window object to render af::arrays.

A multi dimensional data container.

dim4 dims() const

Get dimensions of the array.

dtype type() const

Get array data type.

const array as(dtype type) const

Casts the array into another data type.

Generic object that represents size and shape.

An ArrayFire exception class.

virtual const char * what() const

Returns an error message for the exception in a string format.

@ AF_COLORMAP_HEAT

Heat map.

AFAPI array abs(const array &in)

C++ Interface to calculate the absolute value.

AFAPI array exp(const array &in)

C++ Interface to evaluate the exponential.

AFAPI array pow(const array &base, const array &exponent)

C++ Interface to raise a base to a power (or exponent).

AFAPI array sqrt(const array &in)

C++ Interface to evaluate the square root.

array constant(T val, const dim4 &dims, const dtype ty=(af_dtype) dtype_traits< T >::ctype)

C++ Interface to generate an array with elements set to a specified value.

AFAPI void setDevice(const int device)

Sets the current device.

AFAPI void sync(const int device=-1)

Blocks until the device is finished processing.

AFAPI array meanShift(const array &in, const float spatial_sigma, const float chromatic_sigma, const unsigned iter, const bool is_color=false)

C++ Interface for mean shift.

AFAPI array loadImage(const char *filename, const bool is_color=false)

C++ Interface for loading an image.

AFAPI array moddims(const array &in, const dim4 &dims)

C++ Interface to modify the dimensions of an input array to a specified shape.

AFAPI array convolve(const array &signal, const array &filter, const convMode mode=AF_CONV_DEFAULT, const convDomain domain=AF_CONV_AUTO)

C++ Interface for convolution any(one through three) dimensional signals.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4