From 8b9902ac6e239bd36681a2997ee1bdfa4239a5d8 Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Sun, 25 Jun 2006 09:54:28 +0200 Subject: Stich -> Stitch and hook new files in Makefile.am --- src/Stitch.cxx | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/Stitch.cxx (limited to 'src/Stitch.cxx') diff --git a/src/Stitch.cxx b/src/Stitch.cxx new file mode 100644 index 0000000..0cfa4b5 --- /dev/null +++ b/src/Stitch.cxx @@ -0,0 +1,43 @@ +// +// Stitch routines. +// +// Copyright 2006 by Johannes Hofmann +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Library General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +// USA. +// + +#include +#include +#include +#include + +#include "Stitch.H" + +Stitch::Stitch() { + + +} + +Stitch::~Stitch() { + + +} + + +int +Stitch::resample(Fl_Stitch_Display * + +} -- cgit v1.2.3 From 7d900b4ede22215413e4a0ddd1675c650ba3225f Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Sun, 25 Jun 2006 11:49:32 +0200 Subject: implement various helper methods --- src/Stitch.cxx | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'src/Stitch.cxx') diff --git a/src/Stitch.cxx b/src/Stitch.cxx index 0cfa4b5..ca63ed3 100644 --- a/src/Stitch.cxx +++ b/src/Stitch.cxx @@ -27,17 +27,39 @@ #include "Stitch.H" Stitch::Stitch() { - - + for (int i=0; iload_image(file); + break; + } + } + +} int -Stitch::resample(Fl_Stitch_Display * +Stitch::resample(DataImage *img, + double view_start, double view_end, + double nick_start, double nick_end) { + } -- cgit v1.2.3 From bf376cf0a996b08c39f22d46ba68be4e7957777f Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Sun, 25 Jun 2006 13:02:31 +0200 Subject: first working version --- src/Stitch.cxx | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'src/Stitch.cxx') diff --git a/src/Stitch.cxx b/src/Stitch.cxx index ca63ed3..9080259 100644 --- a/src/Stitch.cxx +++ b/src/Stitch.cxx @@ -58,8 +58,26 @@ Stitch::load_image(char *file) { int Stitch::resample(DataImage *img, - double view_start, double view_end, - double nick_start, double nick_end) { + double view_start, double view_end) { + double step_view = (view_end - view_start) / img->w(); + char r, g, b; + int y_off = img->h() / 2; + for (int x=0; xw(); x++) { + for (int y=0; yh(); y++) { + double a_view, a_nick; + a_view = x * step_view; + a_nick = (y_off - y) * step_view; + + for (int i=0; iget_pixel(a_view, a_nick, &r, &g, &b)==0) { + img->set_pixel(x, y, r, g, b); + break; + } + } + } + } } -- cgit v1.2.3 From 88555db930fc170f97ebbca6c17802392a5b5f25 Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Sun, 25 Jun 2006 13:51:38 +0200 Subject: show stitching online --- src/Stitch.cxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/Stitch.cxx') diff --git a/src/Stitch.cxx b/src/Stitch.cxx index 9080259..21b0ba7 100644 --- a/src/Stitch.cxx +++ b/src/Stitch.cxx @@ -24,6 +24,8 @@ #include #include +#include + #include "Stitch.H" Stitch::Stitch() { @@ -66,8 +68,7 @@ Stitch::resample(DataImage *img, for (int x=0; xw(); x++) { for (int y=0; yh(); y++) { double a_view, a_nick; - - a_view = x * step_view; + a_view = view_start + x * step_view; a_nick = (y_off - y) * step_view; for (int i=0; iredraw(); + Fl::check(); } } -- cgit v1.2.3 From 5e188fda3b5d539b299a7c7ce63f98264fa8c229 Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Sun, 25 Jun 2006 19:31:08 +0200 Subject: adjust parameters --- src/Stitch.cxx | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'src/Stitch.cxx') diff --git a/src/Stitch.cxx b/src/Stitch.cxx index 21b0ba7..ae3158d 100644 --- a/src/Stitch.cxx +++ b/src/Stitch.cxx @@ -50,7 +50,10 @@ Stitch::load_image(char *file) { for (int i=0; iload_image(file); + if (gipf[i]->load_image(file) != 0) { + delete gipf[i]; + gipf[i] = NULL; + } break; } } @@ -65,11 +68,12 @@ Stitch::resample(DataImage *img, char r, g, b; int y_off = img->h() / 2; - for (int x=0; xw(); x++) { - for (int y=0; yh(); y++) { - double a_view, a_nick; + for (int y=0; yh(); y++) { + double a_nick = atan(((double)(y_off - y)/(double)img->h())); + + for (int x=0; xw(); x++) { + double a_view; a_view = view_start + x * step_view; - a_nick = (y_off - y) * step_view; for (int i=0; iredraw(); - Fl::check(); + + if (y % (img->h() / 200) == 0) { + img->redraw(); + Fl::check(); + } } } -- cgit v1.2.3 From 98c1c1890e91962876e53c026f5f3c502562d8b0 Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Sun, 25 Jun 2006 23:59:12 +0200 Subject: correct height width ratio --- src/Stitch.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/Stitch.cxx') diff --git a/src/Stitch.cxx b/src/Stitch.cxx index ae3158d..6bd29d2 100644 --- a/src/Stitch.cxx +++ b/src/Stitch.cxx @@ -28,6 +28,8 @@ #include "Stitch.H" +static double pi_d = asin(1.0) * 2.0; + Stitch::Stitch() { for (int i=0; iw(); char r, g, b; int y_off = img->h() / 2; + double radius = (double) img->w() / (view_end -view_start); for (int y=0; yh(); y++) { - double a_nick = atan(((double)(y_off - y)/(double)img->h())); + double a_nick = atan((double)(y_off - y)/radius); for (int x=0; xw(); x++) { double a_view; -- cgit v1.2.3 From 3ad29069b15a21d1b9f3d965d70cecce8c650c4c Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Thu, 29 Jun 2006 21:19:03 +0200 Subject: fix core with small image heights --- src/Stitch.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Stitch.cxx') diff --git a/src/Stitch.cxx b/src/Stitch.cxx index 6bd29d2..535995f 100644 --- a/src/Stitch.cxx +++ b/src/Stitch.cxx @@ -88,7 +88,7 @@ Stitch::resample(DataImage *img, } } - if (y % (img->h() / 200) == 0) { + if (y % (img->h() / 100 + 1) == 0) { img->redraw(); Fl::check(); } -- cgit v1.2.3 From 52669d81a766eacc1b4e60d0cf477e35b598fcbe Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Wed, 2 Aug 2006 17:12:55 +0200 Subject: change Stitch to use OutputImage instead of DataImage --- src/Stitch.cxx | 79 +++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 67 insertions(+), 12 deletions(-) (limited to 'src/Stitch.cxx') diff --git a/src/Stitch.cxx b/src/Stitch.cxx index 535995f..1fe3d88 100644 --- a/src/Stitch.cxx +++ b/src/Stitch.cxx @@ -26,6 +26,7 @@ #include +#include "OutputImage.H" #include "Stitch.H" static double pi_d = asin(1.0) * 2.0; @@ -33,7 +34,9 @@ static double pi_d = asin(1.0) * 2.0; Stitch::Stitch() { for (int i=0; iget_image_filename(); + if (img_file && strcmp(file, img_file) == 0) { + ret = single_images[i]; + single_images[i] = img; + break; + } + } + } + + return ret; +} + int -Stitch::resample(DataImage *img, +Stitch::resample(int w, int h, double view_start, double view_end) { - double step_view = (view_end - view_start) / img->w(); + double step_view = (view_end - view_start) / w; char r, g, b; - int y_off = img->h() / 2; - double radius = (double) img->w() / (view_end -view_start); + int y_off = h / 2; + int merged_pixel_set; + double radius = (double) w / (view_end -view_start); - for (int y=0; yh(); y++) { + if (merged_image) { + merged_image->init(w, h); + } + for (int i=0; iinit(w, h); + } + } + + for (int y=0; yw(); x++) { + for (int x=0; xget_pixel(a_view, a_nick, &r, &g, &b)==0) { - img->set_pixel(x, y, r, g, b); - break; + if (single_images[i]) { + single_images[i]->set_pixel(x, r, g, b); + } + if (!merged_pixel_set && merged_image) { + merged_image->set_pixel(x, r, g, b); + merged_pixel_set++; + } } } } + if (merged_image) { + merged_image->next_line(); + } + for (int i=0; inext_line(); + } + } + } - if (y % (img->h() / 100 + 1) == 0) { - img->redraw(); - Fl::check(); + if (merged_image) { + merged_image->done(); + } + for (int i=0; idone(); } } } -- cgit v1.2.3