JWS C Library
C language utility library
edge.h
Go to the documentation of this file.
00001 /*
00002  * This work is licensed under a Creative Commons 
00003  * Attribution-Noncommercial-Share Alike 3.0 United States License.
00004  * 
00005  *    http://creativecommons.org/licenses/by-nc-sa/3.0/us/
00006  * 
00007  * You are free:
00008  * 
00009  *    to Share - to copy, distribute, display, and perform the work
00010  *    to Remix - to make derivative works
00011  * 
00012  * Under the following conditions:
00013  * 
00014  *    Attribution. You must attribute the work in the manner specified by the
00015  *    author or licensor (but not in any way that suggests that they endorse you
00016  *    or your use of the work).
00017  * 
00018  *    Noncommercial. You may not use this work for commercial purposes.
00019  * 
00020  *    Share Alike. If you alter, transform, or build upon this work, you may
00021  *    distribute the resulting work only under the same or similar license to
00022  *    this one.
00023  * 
00024  * For any reuse or distribution, you must make clear to others the license
00025  * terms of this work. The best way to do this is by including this header.
00026  * 
00027  * Any of the above conditions can be waived if you get permission from the
00028  * copyright holder.
00029  * 
00030  * Apart from the remix rights granted under this license, nothing in this
00031  * license impairs or restricts the author's moral rights.
00032  */
00033 
00034 
00050 #ifndef EDGE_H 
00051 #define EDGE_H 
00052 
00053 
00054 #include <jwsc/config.h>
00055 
00056 #include <stdlib.h>
00057 #include <inttypes.h>
00058 
00059 #include "jwsc/base/error.h"
00060 #include "jwsc/image/image.h"
00061 #include "jwsc/matrix/matrix.h"
00062 
00063 
00064 #ifdef __cplusplus
00065 namespace jwsc {
00066 extern "C" {
00067 #endif
00068 
00069 
00071 typedef struct
00072 {
00074     uint32_t col;
00075 
00077     uint32_t row;
00078 
00080     float dcol;
00081 
00083     float drow;
00084 
00086     float mag;
00087 }
00088 Edge_point_f;
00089 
00090 
00091 
00093 typedef struct
00094 {
00096     uint32_t num_rows;
00097 
00099     uint32_t num_cols;
00100 
00102     uint32_t num_edges;
00103 
00105     uint32_t total_num_pts;
00106 
00108     uint32_t* num_pts;
00109 
00111     Edge_point_f** pts;
00112 }
00113 Edge_set_f;
00114 
00115 
00116 
00117 
00126 Error* detect_image_edge_set_f
00127 (
00128     Edge_set_f**   edges_out,
00129     const Image_f* img,
00130     float          sigma, 
00131     float          begin_thresh, 
00132     float          end_thresh,
00133     uint32_t       padding
00134 );
00135 
00137 Error* DEPRECATED_detect_image_edge_set_f
00138 (
00139     Edge_set_f**   r_edges_out,
00140     Edge_set_f**   g_edges_out,
00141     Edge_set_f**   b_edges_out,
00142     const Image_f* img,
00143     float          sigma, 
00144     float          begin_thresh, 
00145     float          end_thresh,
00146     uint32_t       padding
00147 );
00148 
00165 Error* detect_matrix_edge_set_f
00166 (
00167     Edge_set_f**    edges_out,
00168     const Matrix_f* m,
00169     float           sigma, 
00170     float           begin_thresh, 
00171     float           end_thresh,
00172     uint32_t        padding
00173 );
00174 
00188 void free_edge_set_f(Edge_set_f* edges);
00189 
00206 void remove_short_edges_f(Edge_set_f* edges, uint32_t min_len);
00207 
00225 void break_edges_at_corners_f
00226 (
00227     Edge_set_f* edges, 
00228     float       thresh, 
00229     uint32_t    num_avg
00230 );
00231 
00245 void sample_edge_set_f
00246 (
00247     Edge_set_f**      edges_out, 
00248     const Edge_set_f* edges_in, 
00249     float             p
00250 );
00251 
00265 Error* color_edge_set_f
00266 (
00267     Image_f**         img_out,
00268     const Image_f*    img_in,
00269     const Edge_set_f* edges, 
00270     const Pixel_f*    pxl
00271 );
00272 
00289 Error* randomly_color_edge_set_f
00290 (
00291     Image_f**         img_out,
00292     const Image_f*    img_in,
00293     const Edge_set_f* edges
00294 );
00295 
00309 Error* color_edge_points_f
00310 (
00311     Image_f**           img_out,
00312     const Image_f*      img_in,
00313     const Edge_point_f* pts, 
00314     uint32_t            num_pts,
00315     const Pixel_f*      pxl
00316 );
00317 
00334 Error* randomly_color_edge_points_f
00335 (
00336     Image_f**           img_out,
00337     const Image_f*      img_in,
00338     const Edge_point_f* pts, 
00339     uint32_t            num_pts
00340 );
00341 
00355 Error* read_edge_set_f
00356 (
00357     Edge_set_f** edges_out,
00358     const char*  fname
00359 );
00360 
00374 Error* write_edge_set_f
00375 (
00376     const Edge_set_f* edges,
00377     const char*       fname
00378 );
00379 
00383 #ifdef __cplusplus
00384 }
00385 }
00386 #endif
00387 
00388 
00389 #endif