diff options
Diffstat (limited to 'amc.patch')
-rw-r--r-- | amc.patch | 316 |
1 files changed, 0 insertions, 316 deletions
diff --git a/amc.patch b/amc.patch index a7bab9e7561b..39c6389eff33 100644 --- a/amc.patch +++ b/amc.patch @@ -1,295 +1,3 @@ - -diff --git a/Makefile.conf b/Makefile.conf -index b5e8552..5d706d0 100644 ---- a/Makefile.conf -+++ b/Makefile.conf -@@ -33,7 +33,7 @@ LATEX_FREE=0 - # directory for executable - BINDIR=/usr/bin - # directory for perl modules --PERLDIR=/usr/share/perl5 -+PERLDIR=/usr/share/perl5/vendor_perl - # directory for some AMC executables, not to be used by end-user - MODSDIR=/usr/lib/AMC - # directory for LaTeX style file -@@ -77,7 +77,7 @@ DOCBOOK_DTD=http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd - - # BUILD : options to compile with netpbm / opencv libraries - --GCC_NETPBM=-lnetpbm -+GCC_NETPBM=-I /usr/include/netpbm -lnetpbm - - # INFO IN DESKTOP FILE - -diff --git a/AMC-detect.cc b/AMC-detect.cc -index 79f07e7..f25c2be 100644 ---- a/AMC-detect.cc -+++ b/AMC-detect.cc -@@ -79,8 +79,10 @@ int processing_error = 0; - #define GET_PIXEL(src,x,y) *((uchar*)(src.data+src.step*(y)+src.channels()*(x))) - #define PIXEL(src,x,y) GET_PIXEL(src,x,y)>100 - --#define BLEU CV_RGB(38,69,223) --#define ROSE CV_RGB(223,38,203) -+#define RGB_COLOR(r,g,b) cv::Scalar((b),(g),(r),0) -+ -+#define BLEU RGB_COLOR(38,69,223) -+#define ROSE RGB_COLOR(223,38,203) - - #define SWAP(x,y,tmp) tmp=x;x=y;y=tmp - #define SGN_ROT (1-2*upside_down) -@@ -186,7 +188,6 @@ void load_image(cv::Mat &src,char *filename, - } - } else { - printf("! LOAD : Error loading scan file in ANYCOLOR [%s]\n", filename); -- printf("! OpenCV error string: %s\n", cvErrorStr(cvGetErrStatus())); - processing_error = 3; - return; - } -@@ -194,7 +195,6 @@ void load_image(cv::Mat &src,char *filename, - printf(": loading %s ...\n", filename); - if((src=imread(filename, cv::IMREAD_GRAYSCALE)).data == NULL) { - printf("! LOAD : Error loading scan file in GRAYSCALE [%s]\n", filename); -- printf("! OpenCV error string: %s\n", cvErrorStr(cvGetErrStatus())); - processing_error = 3; - return; - } -@@ -219,17 +219,17 @@ void load_image(cv::Mat &src,char *filename, - void pre_traitement(cv::Mat &src,int lissage_trous,int lissage_poussieres) { - printf("Morph: +%d -%d\n", lissage_trous, lissage_poussieres); - cv::Mat trous = cv::getStructuringElement( -- CV_SHAPE_ELLIPSE, -+ cv::MORPH_ELLIPSE, - cv::Size(1 + 2 * lissage_trous, 1 + 2 * lissage_trous), - cv::Point(lissage_trous, lissage_trous)); - - cv::Mat poussieres = cv::getStructuringElement( -- CV_SHAPE_ELLIPSE, -+ cv::MORPH_ELLIPSE, - cv::Size(1 + 2 * lissage_poussieres, 1 + 2 * lissage_poussieres), - cv::Point(lissage_poussieres, lissage_poussieres)); - -- cv::morphologyEx(src, src, CV_MOP_CLOSE, trous); -- cv::morphologyEx(src, src, CV_MOP_OPEN, poussieres); -+ cv::morphologyEx(src, src, cv::MORPH_CLOSE, trous); -+ cv::morphologyEx(src, src, cv::MORPH_OPEN, poussieres); - - trous.release(); - poussieres.release(); -@@ -495,7 +495,7 @@ void calage(cv::Mat src, cv::Mat illustr, - int n_min_cc, - double* coins_x, double *coins_y, - cv::Mat &dst,int view=0) { -- CvPoint coins_int[4]; -+ cv::Point coins_int[4]; - int n_cc; - - /* computes target min and max size */ -@@ -517,7 +517,7 @@ void calage(cv::Mat src, cv::Mat illustr, - - if(view == 2) { - /* prepares *dst from a copy of the scan (after pre-processing). */ -- dst = cv::Mat(cv::Size(src.rows, src.cols), CV_MAKETYPE(IPL_DEPTH_8U, 3)); -+ dst = cv::Mat(cv::Size(src.rows, src.cols), CV_MAKETYPE(CV_8U, 3)); - - // cvConvertImage(src, *dst) is not needed anymore as 'src' and 'dst' have - // the same type. -@@ -531,7 +531,7 @@ void calage(cv::Mat src, cv::Mat illustr, - // CvSeq* contour = 0; - vector<vector<cv::Point> > contours; - vector<cv::Vec4i> hierarchy; // unused; but could be used in drawContours -- cv::findContours(src, contours, hierarchy, CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE); -+ cv::findContours(src, contours, hierarchy, cv::RETR_CCOMP, cv::CHAIN_APPROX_SIMPLE); - - #ifdef OPENCV_21 - if(view == 1) { -@@ -568,17 +568,17 @@ void calage(cv::Mat src, cv::Mat illustr, - if(view == 1) { - /* draws the connected component, and the enclosing rectangle, - with a random color. */ -- cv::Scalar color = CV_RGB(rand() & 255, rand() & 255, rand() & 255); -+ cv::Scalar color = RGB_COLOR(rand() & 255, rand() & 255, rand() & 255); - cv::rectangle(dst, cv::Point(rect.x,rect.y), cv::Point(rect.x+rect.width,rect.y+rect.height), color); -- cv::drawContours(dst, contours, i, color, CV_FILLED); -+ cv::drawContours(dst, contours, i, color, cv::FILLED); - } - #endif - if(view==2) { - /* draws the connected component, and the enclosing rectangle, - in green. */ -- cv::Scalar color = CV_RGB(60,198,127); -+ cv::Scalar color = RGB_COLOR(60,198,127); - cv::rectangle(dst, cv::Point(rect.x,rect.y), cv::Point(rect.x+rect.width,rect.y+rect.height), color); -- cv::drawContours(dst, contours, i, color, CV_FILLED); -+ cv::drawContours(dst, contours, i, color, cv::FILLED); - } - } - } -@@ -600,21 +600,21 @@ void calage(cv::Mat src, cv::Mat illustr, - #ifdef OPENCV_21 - /* draws a rectangle to see the corner marks positions on the scan. */ - for(int i = 0; i < 4; i++) { -- cv::line(dst, coins_int[i], coins_int[(i+1)%4], CV_RGB(255,255,255), 1, CV_AA); -+ cv::line(dst, coins_int[i], coins_int[(i+1)%4], RGB_COLOR(255,255,255), 1, cv::LINE_AA); - } - #endif - } - if(view==2) { - /* draws a rectangle to see the corner marks positions on the scan. */ - for(int i = 0; i < 4; i++) { -- cv::line(dst, coins_int[i], coins_int[(i+1)%4], CV_RGB(193,29,27), 1, CV_AA); -+ cv::line(dst, coins_int[i], coins_int[(i+1)%4], RGB_COLOR(193,29,27), 1, cv::LINE_AA); - } - } - - if(illustr.data!=NULL) { - /* draws a rectangle to see the corner marks positions on the scan. */ - for(int i = 0; i < 4; i++) { -- cv::line(illustr, coins_int[i], coins_int[(i+1)%4], BLEU, 1, CV_AA); -+ cv::line(illustr, coins_int[i], coins_int[(i+1)%4], BLEU, 1, cv::LINE_AA); - } - } - } else { -@@ -779,14 +779,14 @@ void mesure_case(cv::Mat src, cv::Mat illustr,int illustr_mode, - int i, ok; - double delta; - double o_x, o_y; -- CvScalar pixel; -+ cv::Scalar pixel; - - double ov_r, ov_r2, ov_dir, ov_center, ov_x0, ov_x1, ov_y0, ov_y1; - - int tx = src.cols; - int ty = src.rows; - -- CvPoint coins_int[4]; -+ cv::Point coins_int[4]; - - static char* zoom_file = NULL; - -@@ -808,7 +808,7 @@ void mesure_case(cv::Mat src, cv::Mat illustr,int illustr_mode, - if(illustr_mode == ILLUSTR_BOX) { - /* draws the box on the illustrated image (for zoom) */ - for(int i = 0; i < 4; i++) { -- cv::line(illustr, coins_int[i], coins_int[(i+1)%4], BLEU, 1, CV_AA); -+ cv::line(illustr, coins_int[i], coins_int[(i+1)%4], BLEU, 1, cv::LINE_AA); - } - } - -@@ -954,7 +954,7 @@ void mesure_case(cv::Mat src, cv::Mat illustr,int illustr_mode, - #ifdef OPENCV_21 - if(view == 1) { - for(int i = 0; i < 4; i++) { -- cv::line(dst, coins_int[i], coins_int[(i+1)%4], CV_RGB(255,255,255), 1, CV_AA); -+ cv::line(dst, coins_int[i], coins_int[(i+1)%4], RGB_COLOR(255,255,255), 1, cv::LINE_AA); - } - } - #endif -@@ -963,7 +963,7 @@ void mesure_case(cv::Mat src, cv::Mat illustr,int illustr_mode, - if(illustr_mode == ILLUSTR_BOX) { - /* draws the measuring box on the illustrated image (for zoom) */ - for(int i = 0; i < 4; i++) { -- cv::line(illustr, coins_int[i], coins_int[(i+1)%4], ROSE, 1, CV_AA); -+ cv::line(illustr, coins_int[i], coins_int[(i+1)%4], ROSE, 1, cv::LINE_AA); - } - } - -@@ -982,15 +982,19 @@ void mesure_case(cv::Mat src, cv::Mat illustr,int illustr_mode, - z_xmin, z_ymin, z_xmax - z_xmin, z_ymax - z_ymin); - cv::Mat roi = illustr(cv::Rect(z_xmin, z_ymin, z_xmax - z_xmin, z_ymax - z_ymin)); - -- if(cv::imwrite(zoom_file, roi -+ bool result = false; -+ try { -+ result = cv::imwrite(zoom_file, roi - #if OPENCV_20 -- , save_options -+ , save_options - #endif -- ) != 1) { -- printf("! ZOOMS : Zoom save error\n"); -- } else { -- printf("ZOOM %d-%d.png\n", question, answer); -+ ); -+ } catch(const cv::Exception& ex) { -+ printf("! ZOOMS : Zoom save error: %s\n", ex.what()); - } -+ if(result) -+ printf("ZOOM %d-%d.png\n", question, answer); -+ - } else { - printf("! ZOOMFN : Zoom file name error\n"); - } -@@ -1119,8 +1123,6 @@ int main(int argc, char** argv) - illustr = cv::imread(scan_file, cv::IMREAD_COLOR); - if(illustr.data == NULL) { - printf("! LOAD : Error loading scan file with color mode [%s]\n", scan_file); -- printf("! OpenCV error string: %s\n", cvErrorStr(cvGetErrStatus())); -- - processing_error = 4; - } else { - printf(": Image background loaded\n"); -@@ -1134,8 +1136,6 @@ int main(int argc, char** argv) - src_calage = src.clone(); - if(src_calage.data == NULL) { - printf("! LOAD : Error cloning image\n"); -- printf("! OpenCV error string: %s\n", cvErrorStr(cvGetErrStatus())); -- - processing_error = 5; - } - } -@@ -1292,7 +1292,7 @@ int main(int argc, char** argv) - fh = src.rows / 50.0; - textpos.x = 10; - textpos.y = (int)(1.6 * fh); -- cv::putText(illustr, text, textpos, cv::FONT_HERSHEY_PLAIN, fh/14, BLEU, 1+(int)(fh/20), CV_AA); -+ cv::putText(illustr, text, textpos, cv::FONT_HERSHEY_PLAIN, fh/14, BLEU, 1+(int)(fh/20), cv::LINE_AA); - } else { - printf(": %s\n", commande); - printf("! SYNERR : Syntax error\n"); -@@ -1309,9 +1309,9 @@ int main(int argc, char** argv) - #ifdef OPENCV_21 - #ifdef AMC_DETECT_HIGHGUI - if(view == 1) { -- cvNamedWindow("Source", CV_WINDOW_NORMAL); -+ cvNamedWindow("Source", cv::WINDOW_NORMAL); - cvShowImage("Source", src); -- cvNamedWindow("Components", CV_WINDOW_NORMAL); -+ cvNamedWindow("Components", cv::WINDOW_NORMAL); - cvShowImage("Components", dst); - cvWaitKey(0); - -@@ -1322,24 +1322,17 @@ int main(int argc, char** argv) - - if(illustr.data && strlen(out_image_file) > 1) { - printf(": Saving layout image to %s\n", out_image_file); -- if(cv::imwrite(out_image_file, illustr -+ try { -+ cv::imwrite(out_image_file, illustr - #if OPENCV_20 -- , save_options -+ , save_options - #endif -- ) != 1) { -- int error = cvGetErrStatus(); -- const char * errorMessage = NULL; -- if (error) { -- errorMessage = cvErrorStr(error); -- } else { -- error = errno; -- errorMessage = strerror(error); -- } -- printf("! LAYS : Layout image save error: %s\n", errorMessage); -+ ); -+ } catch(const cv::Exception& ex) { -+ printf("! LAYS : Layout image save error: %s\n", ex.what()); - } - } - -- - illustr.release(); - src.release(); - diff --git a/Makefile b/Makefile index c701eae..4ceef6e 100644 --- a/Makefile @@ -304,27 +12,3 @@ index c701eae..4ceef6e 100644 +GCC_OPENCV_LIBS ?= $(shell pkg-config --libs opencv4) GCC_PDF ?= $(shell pkg-config --cflags --libs cairo pangocairo poppler-glib) GCC_POPPLER ?= $(shell pkg-config --cflags --libs poppler-glib gio-2.0) - -@@ -249,9 +249,9 @@ endif - install -d -m 0755 $(USER_GROUP) $(DESTDIR)/$(ICONSDIR) - install -m 0644 $(USER_GROUP) icons/*.svg $(DESTDIR)/$(ICONSDIR) - ifneq ($(APPICONDIR),) -- install -d -m 0755 $(USER_GROUP) $(DESTDIR)/$(APPICONDIR)/scalable/apps -- install -m 0644 $(USER_GROUP) $(MAIN_LOGO).svgz $(DESTDIR)/$(APPICONDIR)/scalable/apps -- $(foreach SIZE, $(APPICONSIZES),\ -+# install -d -m 0755 $(USER_GROUP) $(DESTDIR)/$(APPICONDIR)/scalable/apps -+# install -m 0644 $(USER_GROUP) $(MAIN_LOGO).svgz $(DESTDIR)/$(APPICONDIR)/scalable/apps -+# $(foreach SIZE, $(APPICONSIZES),\ - install -d -m 0755 $(USER_GROUP) $(DESTDIR)/$(APPICONDIR)/$(SIZE)x$(SIZE)/apps ; \ - install -m 0644 $(USER_GROUP) -T $(MAIN_LOGO)-$(SIZE).png $(DESTDIR)/$(APPICONDIR)/$(SIZE)x$(SIZE)/apps/auto-multiple-choice.png ; ) - endif -@@ -299,7 +299,7 @@ endif - install -m 0644 $(USER_GROUP) doc/*.1 $(DESTDIR)/$(MAN1DIR) - endif - --install: install_nodoc install_doc ; -+install: install_nodoc; - - # Test - - |