?? imagesegmentation.h
字號:
//Copyright (c) 2004-2005, Baris Sumengen
//All rights reserved.
//
// CIMPL Matrix Performance Library
//
//Redistribution and use in source and binary
//forms, with or without modification, are
//permitted provided that the following
//conditions are met:
//
// * No commercial use is allowed.
// This software can only be used
// for non-commercial purposes. This
// distribution is mainly intended for
// academic research and teaching.
// * Redistributions of source code must
// retain the above copyright notice, this
// list of conditions and the following
// disclaimer.
// * Redistributions of binary form must
// mention the above copyright notice, this
// list of conditions and the following
// disclaimer in a clearly visible part
// in associated product manual,
// readme, and web site of the redistributed
// software.
// * Redistributions in binary form must
// reproduce the above copyright notice,
// this list of conditions and the
// following disclaimer in the
// documentation and/or other materials
// provided with the distribution.
// * The name of Baris Sumengen may not be
// used to endorse or promote products
// derived from this software without
// specific prior written permission.
//
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
//HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
//EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
//NOT LIMITED TO, THE IMPLIED WARRANTIES OF
//MERCHANTABILITY AND FITNESS FOR A PARTICULAR
//PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
//CONTRIBUTORS BE LIABLE FOR ANY
//DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
//EXEMPLARY, OR CONSEQUENTIAL DAMAGES
//(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
//OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
//DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
//HOWEVER CAUSED AND ON ANY THEORY OF
//LIABILITY, WHETHER IN CONTRACT, STRICT
//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
//OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
//OF THIS SOFTWARE, EVEN IF ADVISED OF THE
//POSSIBILITY OF SUCH DAMAGE.
#pragma once
#ifndef IMAGE_SEGMENTATION_H
#define IMAGE_SEGMENTATION_H
#include <cmath>
#include "cimpl.h"
using namespace CIMPL;
#include "cimpltoolboxes.h"
using namespace MathCore;
using namespace Analysis;
using namespace LevelSetMethods;
namespace ImageProcessing
{
//Histogram();
//HistogramEqualize();
// Bunch of filters
// Gaussian
Matrix<float> Gaussian2D(int side, float sigma_x, float angle = 0, float ratio = 1.0);
Matrix<double> Gaussian2D(int side, double sigma_x, double angle = 0, double ratio = 1.0);
// First derivative of Gaussian
Matrix<float> FDGaussian2D(int side, float sigma_x, float angle = 0, float ratio = 1.0);
Matrix<double> FDGaussian2D(int side, double sigma_x, double angle = 0, double ratio = 1.0);
// Second derivative of Gaussian
Matrix<float> SDGaussian2D(int side, float sigma_x, float angle = 0, float ratio = 1.0);
Matrix<double> SDGaussian2D(int side, double sigma_x, double angle = 0, double ratio = 1.0);
// Laplacian of Gaussian
Matrix<float> LOG(int side, float sigma_x, float angle = 0, float ratio = 1.0);
Matrix<double> LOG(int side, double sigma_x, double angle = 0, double ratio = 1.0);
// Difference of offset Gaussians
Matrix<float> DOOG2D(int side, float sigma_x, float offset, float angle = 0, float ratio = 1.0);
Matrix<double> DOOG2D(int side, double sigma_x, double offset, double angle = 0, double ratio = 1.0);
Matrix<float> DOOG2DCentered(int side, float sigma_x, float offset, float angle = 0, float ratio = 1.0);
Matrix<double> DOOG2DCentered(int side, double sigma_x, double offset, double angle = 0, double ratio = 1.0);
// Filter image with these filters
Matrix<float> FilterGaussian2D(Matrix<float>& image, float sigma_x, float angle = 0, float ratio = 1.0);
Matrix<double> FilterGaussian2D(Matrix<double>& image, double sigma_x, double angle = 0, double ratio = 1.0);
// First derivative of Gaussian
Matrix<float> FilterFDGaussian2D(Matrix<float>& image, float sigma_x, float angle = 0, float ratio = 1.0);
Matrix<double> FilterFDGaussian2D(Matrix<double>& image, double sigma_x, double angle = 0, double ratio = 1.0);
// Second derivative of Gaussian
Matrix<float> FilterSDGaussian2D(Matrix<float>& image, float sigma_x, float angle = 0, float ratio = 1.0);
Matrix<double> FilterSDGaussian2D(Matrix<double>& image, double sigma_x, double angle = 0, double ratio = 1.0);
// Laplacian of Gaussian
Matrix<float> FilterLOG(Matrix<float>& image, float sigma_x, float angle = 0, float ratio = 1.0);
Matrix<double> FilterLOG(Matrix<double>& image, double sigma_x, double angle = 0, double ratio = 1.0);
// Difference of offset Gaussians
Matrix<float> FilterDOOG2D(Matrix<float>& image, float sigma_x, float offset, float angle = 0, float ratio = 1.0);
Matrix<double> FilterDOOG2D(Matrix<double>& image, double sigma_x, double offset, double angle = 0, double ratio = 1.0);
Matrix<float> FilterDOOG2DCentered(Matrix<float>& image, float sigma_x, float offset, float angle = 0, float ratio = 1.0);
Matrix<double> FilterDOOG2DCentered(Matrix<double>& image, double sigma_x, double offset, double angle = 0, double ratio = 1.0);
// Several Edge Detectors
// Some filter outputs
//EdgeCanny();
//EdgeNitzberg();
//EdgeEdgeflow();
// non-maxima suppression
Matrix<float> NonMaximaSuppress(Matrix<float>& edgesMain, Matrix<float>& vectorX, Matrix<float>& vectorY);
Matrix<double> NonMaximaSuppress(Matrix<double>& edgesMain, Matrix<double>& vectorX, Matrix<double>& vectorY);
Matrix<int> NonMaximaMask(Matrix<float>& edges, Matrix<float>& vectorX, Matrix<float>& vectorY);
Matrix<int> NonMaximaMask(Matrix<double>& edges, Matrix<double>& vectorX, Matrix<double>& vectorY);
float Direction(float y, float x);
double Direction(double y, double x);
//Threshold();
// hystherisys threshold (see Canny)
//HystThreshold();
// Edge tracing from non-maxima suppressed or thresholded edges.
//TraceEdges();
// Peron-Malik's Anisotropic diffusion
Matrix<float>& PMAnisoDiff(Matrix<float>& image, float K, int iterations);
Matrix<double>& PMAnisoDiff(Matrix<double>& image, double K, int iterations);
MatrixList<float>& PMAnisoDiff(MatrixList<float>& image, float K, int iterations);
MatrixList<double>& PMAnisoDiff(MatrixList<double>& image, double K, int iterations);
// Texture
//GaborFilters();
//GaborFilterOutputs();
// Edgeflow
// both grayscale and multi-valued
MatrixList<float> EdgeflowVectorField(Matrix<float>& image, int angles, float sigma, float offset, float ratio = 1.0, bool normalized = true);
//MatrixList<double> EdgeflowVectorField(Matrix<double>& image, int angles, double sigma, double offset, double ratio = 1.0, bool normalized = true);
MatrixList<float> EdgeflowVectorField(MatrixList<float>& image, int angles, float sigma, float offset, float ratio, bool normalized);
Matrix<int> CreateFlowImage(Matrix<float>& xFlow, Matrix<float>& yFlow);
// Edgeflow-based Anisotropic diffusion
Matrix<float>& EFAnisoDiff(Matrix<float>& image, Matrix<float>& u, Matrix<float>& v, Matrix<float>& g, int iterations);
Matrix<double>& EFAnisoDiff(Matrix<double>& image, Matrix<double>& u, Matrix<double>& v, Matrix<double>& g, int iterations);
MatrixList<float>& EFAnisoDiff(MatrixList<float>& image, Matrix<float>& u, Matrix<float>& v, Matrix<float>& g, int iterations);
MatrixList<double>& EFAnisoDiff(MatrixList<double>& image, Matrix<double>& u, Matrix<double>& v, Matrix<double>& g, int iterations);
Matrix<int> GetEgdes(Matrix<float> &grads, Matrix<int> &thick, Matrix<int> &suppressed);
float Angle(float x1, float y1, float x2, float y2);
void RGB2Lab(double R, double G, double B, double &L, double &a, double &b);
void Lab2RGB(double L, double a, double b, double &R, double &G, double &B);
MatrixList<float> RGB2Lab(MatrixList<float> input);
MatrixList<float> Lab2RGB(MatrixList<float> input);
Matrix<int> SegmentEF(Matrix<float> &im, bool normalized, float initScale, float scaleJump, float endScale,
float angleLimit, float ratioLimit, float smoothWeighting, float stopError, int accuracy);
Matrix<int> SegmentEF(MatrixList<float> &im, bool normalized, float initScale, float scaleJump, float endScale,
float angleLimit, float ratioLimit, float smoothWeighting, float stopError, int accuracy);
// Curve evolution stuff
// GPAC
};
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -