资源简介
Convert jpeg png or gif to SVG greyscale images
ImageToSVG vectorises greyscale images. It does a reasonable job on continuous tone images though a real good solution is hard.
It takes the number of contours and and a contour accuracy parameter, allowing you to trade off appearance versus SVG image size.
代码片段和文件信息
//
// bezierfit.c
// ansiscratch
//
// Created by Malcolm McLean on 13/07/2015.
// Copyright (c) 2015 Malcolm McLean. All rights reserved.
//
#include
#include
#include
#include “bezierfit.h“
typedef struct
{
double x;
double y;
} Point2;
typedef Point2 Vector2;
static double *g_bezier;
static int g_Nbeziers;
static void FitCurve(Point2 *d int nPts double error);
double *bez_fitpoints(double *x double *y int N double tol int *Nbez)
{
double *answer = 0;
int i;
g_bezier = 0;
g_Nbeziers = 0;
if(N == 0)
{
*Nbez = 0;
return answer;
}
if(N == 1)
{
*Nbez = 1;
answer = malloc(8 * sizeof(double));
for(i=0;i<4;i++)
{
answer[i/2] = x[0];
answer[i/2+1] = y[0];
}
return answer;
}
if(N == 2)
{
answer = malloc(8 * sizeof(double));
answer[0] = x[0]; answer[1] = y[0];
answer[2] = x[0]; answer[3] = y[0];
answer[4] = x[1]; answer[5] = y[1];
answer[6] = x[1]; answer[7] = y[1];
return answer;
}
Point2 *pts = (Point2 *) malloc(N * sizeof(Point2));
for(i=0;i {
pts[i].x = x[i];
pts[i].y = y[i];
}
FitCurve(pts N tol*tol);
answer = g_bezier;
*Nbez = g_Nbeziers;
free(pts);
g_bezier = 0;
g_Nbeziers = 0;
return answer;
out_of_memory:
*Nbez = -1;
return 0;
}
typedef Point2 *BezierCurve;
/* Forward declarations */
static void FitCurve(Point2 *d int nPts double error);
static void FitCubic(Point2 *d int first int last Vector2 tHat1 Vector2 tHat2 double error);
static BezierCurve GenerateBezier(Point2 *d int first int last double *uPrime Vector2 tHat1 Vector2 tHat2);
static double *Reparameterize(Point2 *d int first int last double *u BezierCurve bezCurve);
static double NewtonRaphsonRootFind(BezierCurve Q Point2 P double u);
static Point2 BezierII(int degree Point2 *V double t);
static double B0(double u);
static double B1(double u);
static double B2(double u);
static double B3(double u);
static Vector2 ComputeLeftTangent(Point2 * d int end);
static Vector2 ComputeRightTangent(Point2 * d int end);
static Vector2 ComputeCenterTangent(Point2 *d int center);
static double *ChordLengthParameterize(Point2 *d int first int last);
static double ComputeMaxError(Point2 *d int first int last BezierCurve bezCurve double * u int * splitPoint);
static Vector2 V2AddII(Vector2 a Vector2 b);
static Vector2 V2ScaleIII(Vector2 v double s);
static Vector2 V2SubII(Vector2 a Vector2 b);
/*
static double *Reparameterize();
static double NewtonRaphsonRootFind();
static Point2 BezierII();
static double B0() B1() B2() B3();
static Vector2 ComputeLeftTangent();
static Vector2 ComputeRightTangent();
static Vector2 ComputeCenterTangent();
static double ComputeMaxError();
static double *ChordLengthParameterize();
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2015-07-15 15:36 ImageToSVG\
文件 21418 2015-07-14 04:26 ImageToSVG\bezierfit.c
文件 343 2015-07-14 03:43 ImageToSVG\bezierfit.h
文件 29994 2015-07-14 04:01 ImageToSVG\binaryutils.c
文件 1772 2015-07-14 03:42 ImageToSVG\binaryutils.h
文件 27219 2015-07-14 06:45 ImageToSVG\bmp.c
文件 693 2014-12-29 17:01 ImageToSVG\bmp.h
目录 0 2015-07-14 05:05 ImageToSVG\Debug\
文件 40340 2015-07-14 04:26 ImageToSVG\Debug\bezierfit.obj
文件 47233 2015-07-14 04:01 ImageToSVG\Debug\binaryutils.obj
文件 39953 2015-07-14 05:04 ImageToSVG\Debug\bmp.obj
文件 43397 2015-07-14 05:04 ImageToSVG\Debug\gif.obj
文件 12351 2015-07-14 06:39 ImageToSVG\Debug\greyscaletosvg.obj
文件 2324 2015-07-14 06:39 ImageToSVG\Debug\ImageToSVG.log
目录 0 2015-07-14 06:39 ImageToSVG\Debug\ImageToSVG.tlog\
文件 7302 2015-07-14 06:39 ImageToSVG\Debug\ImageToSVG.tlog\cl.command.1.tlog
文件 18494 2015-07-14 06:39 ImageToSVG\Debug\ImageToSVG.tlog\CL.read.1.tlog
文件 10380 2015-07-14 06:39 ImageToSVG\Debug\ImageToSVG.tlog\CL.write.1.tlog
文件 199 2015-07-14 06:39 ImageToSVG\Debug\ImageToSVG.tlog\ImageToSVG.lastbuildstate
文件 4770 2015-07-14 06:39 ImageToSVG\Debug\ImageToSVG.tlog\li
文件 6000 2015-07-14 06:39 ImageToSVG\Debug\ImageToSVG.tlog\li
文件 2434 2015-07-14 06:39 ImageToSVG\Debug\ImageToSVG.tlog\li
文件 52992 2015-07-14 05:04 ImageToSVG\Debug\jpeg.obj
文件 16702 2015-07-14 05:04 ImageToSVG\Debug\loadimage.obj
文件 262459 2015-07-14 05:04 ImageToSVG\Debug\lodepng.obj
文件 9073 2015-07-14 06:12 ImageToSVG\Debug\main.obj
文件 21925 2015-07-14 05:05 ImageToSVG\Debug\rbtree.obj
文件 76800 2015-07-14 06:39 ImageToSVG\Debug\vc120.idb
文件 118784 2015-07-14 06:39 ImageToSVG\Debug\vc120.pdb
文件 21769 2014-12-29 17:01 ImageToSVG\gif.c
文件 295 2014-12-29 17:01 ImageToSVG\gif.h
............此处省略38个文件信息
- 上一篇:严题集算法设计答案汇总
- 下一篇:山大计算机学院、软件学院《多媒体技术》考试题
相关资源
- Eclipse编译Hive
- c程序将表格数据读取到二维数组
- zencart评论csv批量导入插件
- TOOL0006V3600cracked.zip
- voc.txt
- 泛微软件 e-cology 6.0 泛微软件 e-colog
- 鸿鹄论坛_新版CCIE RS 5.0-LAB大纲详尽解
- 实现canvas 图片拖拽旋转移动 点击转
- Arduino通过RC522实现开门
- 关于禁用weblogic wls-wsat组件的步骤说明
- CryptAPI接口访问CSP
- DCM转jpg的库
- 高斯坐标正反算
- soil库libSOIL.a SOIL.h SOIL.c,包含程序
- Teamcenter BOM功能的二次开发
- 德州技术大学的硕士论文
- halcon倾斜车牌识别源代码
- 5ucms会员系统UTF8版
- ASCII 及UTF-8 与字符互相转换
- Modbus TCP通讯程序
- linux libgcc_s.so.1 libgcc_s-4.4.5-20110214.
- TinyHTTPd for Windows源码
- dxc采集器破解版vip3.0
- opencv中cvHoughCircle同心圆检测完整程序
- DNS解析,gethostbyname的C源码
- lxTraceClearTool-v2.0.zip
- Mscomm32.ocx110634
- uClinux-dist-20070130.tar.tar
- amc.2标准 以太网相关
- VPX 3U模板
评论
共有 条评论