Commit 3452c2e163c94be512236588744d5b9fa38b2e58

Tied some loose ends to get a usable program.
README
(1 / 0)
  
1This mess was written by Sampsa "Tuplanolla" Kiiskinen.
c/azier.c
(5 / 3)
  
33#include <string.h>
44
55#include "azy.h"
6#include "magic.h"
67
78int main(int const off_by_one,
89 char** const mutable_storage) {
1919 if (!azy_create_options(&options,
2020 (char const* const* )&mutable_storage[1],
2121 (size_t )(off_by_one - 1))) {
22 fputs("Failure!\n", stdout);
22 say("Failed somehow.");
2323
2424 return EXIT_FAILURE;
2525 }
2626
27 /*
2728 for (size_t index = 0;
2829 index < options.process_count;
2930 ++index)
3031 printf("options.process[%zu] = \"%s\";\n", index, options.process[index]);
3132 printf("options.result = \"%s\";\n", options.result);
33 */
3234
3335 if (options.action == WORK_FOR_ME) {
3436 struct parameters parameters = azy_default_parameters;
3537 parameters.visible_portion = options.parameters;
38 parameters.sample_span = 1024;
3639 azy_do_everything(options.result, options.process, options.process_count, NULL, &parameters);
3740 } else
3841 azy_usage(mutable_storage[0], stdout);
3942
4043 azy_destroy_options(&options);
41
42 fputs("Success!\n", stdout);
4344
4445 return EXIT_SUCCESS;
4546}
c/azy.c
(10 / 5)
  
108108 .x = (int )value[0],
109109 .y = (int )value[1]
110110 };
111 cvxSeqInsertPoint(result, offset, &point);
111 cvxSeqInsertPoint(result, azy_min(offset, (size_t )result->total), &point);
112112 }
113113
114114 return success;
811811 azy_variance(&bgvar[component], bgs, half_count, get[component], bg[component]);
812812 }
813813 CvScalar rsn; // Result of Serious Negotiations.
814 memcpy(rsn.val, bg, sizeof bg);
814 rsn.val[0] = bg[0];
815 rsn.val[1] = bg[1];
816 rsn.val[2] = bg[2];
815817 say("The background color consensus is (%f, %f, %f).", bg[0], bg[1], bg[2]);
816818 // Discard those that disagree.
817819 for (size_t left = 0, whole = 0;
12021202 double radius;
12031203 say("Guessing extrapolations for areas %f and %f.", ai, ac);
12041204 if (!azy_radius(&radius, &starter, &start_normal, &end_normal, &ender,
1205 ac, ai, 42))
1206 radius = 16; // Eh?
1205 ac, ai, 42) || isnan(radius)) {
1206 statuses[whole] = NOTHING_TO_SEE_HERE;
1207 continue;
1208 }
12071209 say("The radius is %f.", radius);
12081210 // Some heuristic.
12091211 double graybeard = azy_distance(&starter, &ender);
12101212 size_t const dots = (size_t )graybeard;
1213 say("Slicing %zu to %zu from %zu.", end_index, start_index, count);
12111214 CvSlice slice = cvSlice((int )end_index, (int )start_index);
12121215 cvSeqRemoveSlice(blob_contours[whole][half], slice);
12131216 struct position starter_tangent = {
12311231 ender
12321232 };
12331233 // Hoping to get away with this for now...
1234 azy_bezier_all(blob_contours[whole][half], end_index, dots, &points[0], 4);
1234 azy_bezier_all(blob_contours[whole][half], end_index, dots, points, 4);
12351235 // The "right" way.
12361236 /*
12371237 CvSeqWriter writer;
c/makefile
(4 / 2)
  
1111 -Wno-declaration-after-statement -Wno-traditional -Wno-traditional-conversion \
1212 -Wno-float-equal -Wno-unsuffixed-float-constants
1313debug=$(warnings) -DISCUSS -DISPLAY -O0 -g
14deploy=-O3 -s
15CFLAGS=$(debug) \
14# Optimizations cause one problem with casting.
15deploy=-DISCUSS -O0 -s
16# Change this for debug mode.
17CFLAGS=$(deploy) \
1618 -std=c11 \
1719 `pkg-config --cflags opencv`
1820LDLIBS=-lm `pkg-config --libs opencv`
c/makefile.bat
(10 / 5)
  
22
33set cc=gcc
44set warnings=-w
5set debug=%warnings% -DVERBOSE -DVISUAL -g
5set debug=%warnings% -DISCUSS -g
66set deploy=-O3 -s
77set cflags=%debug% ^
88 -IC:\opencv\build\include -LC:\opencv\build\x86\vc12\bin ^
4343 && %cc% %cflags% ^
4444 -c -o azy.o azy.c ^
4545 && %cc% %cflags% ^
46 -o azier azier.o azy.o %ldlibs%
46 -c -o opencvx.o opencvx.c ^
47 && %cc% %cflags% ^
48 -c -o pure.o pure.c ^
49 && %cc% %cflags% ^
50 -o azier azier.o azy.o opencvx.o pure.o %ldlibs%
4751goto :eof
4852
4953:clean
50del azier.exe azier.o azy.o
54del azier.exe azier.o azy.o opencvx.o pure.o
5155goto :eof
5256
5357:test
54azier ^
58azier --parameters 80%% --result a.png --process ^
5559 ../../samples/061-1/l_1396438664_12.png ^
56 ../../samples/061-1/l_1396438664_28.png
60 ../../samples/061-1/l_1396438664_28.png ^
61 ../../samples/061-1/l_1396438664_45.png
5762goto :eof
log/log.tex
(12 / 4)
  
2121\newcommand{\erf}{{\operatorname{erf}}}
2222
2323\begin{document}
24The purpose of this rambling was to clear the thoughts of the author at
25various points during the project.
26It should not be read with high expectations if at all, because
27it may be both offensive \emph{and} wrong.
28
2429\section*{\huge Development Log}
2530The tasks seemed trivial.
2631Detected keypoints from both images with SURF,
415415Those are specified in section 4.2.10 of whatever. \cite{png}
416416The point is that things work out through a stroke of luck.
417417
418Figured out that OpenCV is shit and that working with it is suffering.
418Figured out that OpenCV is terrible and that working with it is suffering.
419419
420420First of all the documentation is useless.
421421For example it does not show where \lstinline{cv::estimateRigidTransform()} is.
441441\begin{lstlisting}
442442OpenCV Error: Assertion failed ((M0.type() == CV_32F || M0.type() == CV_64F) && M0.rows == 3 && M0.cols == 3) in warpPerspective, file /tmp/opencv-2.4.9/modules/imgproc/src/imgwarp.cpp, line 3705
443443\end{lstlisting}
444Very nice.
445\begin{lstlisting}
446main: /usr/local/include/opencv2/core/types_c.h:792: cvmSet: Assertion `type == (((6) & ((1 << 3) - 1)) + (((1)-1) << 3))' failed.
447\end{lstlisting}
444448
445449It is not possible to filter contours as if
446450they were one-dimensional images.
466466Of course not;
467467let's just abort or produce garbage when given two pointers to the same object.
468468
469\lstinline{main: /usr/local/include/opencv2/core/types_c.h:792: cvmSet: Assertion `type == (((6) & ((1 << 3) - 1)) + (((1)-1) << 3))' failed.}
470Fuck you too.
471
472469The worst part is that OpenCV is supposed to be state-of-the-art,
473470a library developed by industry professionals and top-notch research groups,
474471a diamond-like jewel of software engineering,
475472a pinnacle of human achievement ---
476473and it is a piece of shit.
474
475At least OpenCV is fast.
477476
478477Maxima and Axiom, the greatest computer algebra systems in the world,
479478are unable to simplify $\tan(\pi / 10)$.