Skip to content

Commit

Permalink
0.4
Browse files Browse the repository at this point in the history
Scaling filter
  • Loading branch information
zvezdochiot committed Oct 3, 2018
1 parent 9008b51 commit be793c7
Show file tree
Hide file tree
Showing 42 changed files with 2,266 additions and 121 deletions.
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
YASW
----
YASW (Yet Another Scan Wizard) is an application used to correct images taken
with a camera while scanning a book. See http://http://www.diybookscanner.org/
for full information on how to scan with digital cameras.

LICENSE
-------
yasw is licenced under GPLv3.
=> See documentation/gpl.txt for details.

yasw uses icons fron the Tango Theme, which are in the public domain.
=> See src/icons/tango-icon-theme/copyright.txt for details:
The icons in this folder are taken from the Tango Icon Theme Version 0.8.90.
It can be downloaded from http://tango.freedesktop.org/releases

The icons in the Tango Icon Theme are released under the Public Domain, as stated by the COPYING file in the original tarball:
"The icons in this repository are herefore released into the Public Domain."


DOWNLOAD
--------
You can download yasw from https://sourceforge.net/projects/yascanw/
67 changes: 58 additions & 9 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,70 @@
ToDo / Roadmap
- About menu/window with authors, licence...
- It may make sense to apply the changes from the Scaling Filter to all (left/right) images. Maybe
a button "apply to all images" in the filter wiget ?
- I'm not happy with "apply to all". This applies every filter settings to al slides.
This may be dangerous!
- optimise YASW: selecting another (big) image lasts 1 second.
- improve pdf output: compression level, page size...
- scaling filter: add padding sizes and/or page size
- Filter to fix image color / convert to black & white...
o add filter for color manipulation_/adjustment
o point to white pixel (or many white pixels)
- BUG: png images can't export to jpg!
- open -> recent projects
- png images do not scale well
- handle empty images (placeholder) differently
- Load images for Icons in background
- Implement disable filter
- Add ability to scale resulting images after cropping
* Set image size, use it in pdf export.
o Set image size, use it in pdf export.
o disabling a filter (UI) should disable the rendering.
- progress dialog while exporting / loading
- Display page preview instead of original image in image list
- drag and drop in the image list
- Filter to fix image color / convert to black & white...
- error message on console: kfilemodule(5761)/kio (KDirModel) KDirModelPrivate::_k_slotDeleteItems: No node found for item that was just removed: KUrl("file:(((...")
- application icon
- error message on console: kfilemodule(5761)/kio (KDirModel)
KDirModelPrivate::_k_slotDeleteItems: No node found for item that was just
removed: KUrl("file:(((...")
- windows port: security credentials (producer...)
- png images do not scale well
- add a placeholder at the end of the imagetablewidget, so that can insert an image at the end and insert an image on the right when there is no image in the list.
- add a placeholder at the end of the imagetablewidget, so that can insert an image at the end and
insert an image on the right when there is no image in the list.
- Application Icon for YASW
- autocalibration with a printed grid (line detection)
o have a look at ppmunwarp http://diybookscanner.org/forum/viewtopic.php?f=19&t=2589
- move image from left ro right
- centralized .h header with includes and default values.
- QPixmap::scaled: Pixmap is a null pixmap while loading
User requests:
- Add the ability to take a checkerboard pattern as input to the de-warping stage.
- A way to measure DPI in-situ. Allow the user to draw a line on the pic and inform yasw that the
actual physical length of this line is x. You could then compute DPI by measuring the length of
the drawn line in pixels and divide by length input.
o I assume you would calculate DPI on the cropped image. In that case, use the DPI to also
calculate and display the physical dimensions of the page or a sub-set of the page as selected
by a user-defined bounding box.
- Under rotation filter, allow user to draw a line to indicate what is 'horizontal' - (maybe even
use 'Shift' key to force a horizontal line, i.e. deltaY = 0) Use the drawn line to calculate a
finer rotation angle to straighten the page. (maybe name the two filters 'orientation' and 'rotation'
to distinguish between them).
-- when I rotate the page, seeing the thumbnail rotated as well.
-- being able to "arrow down" through the pages quickly, viewing previews.
-- When I exported to PDF, though, the app exported all the Left images, followed by (most of) the
"right" images. It should alternate L/R, obviously. Also, I'm getting a white border on the top
and the left of the images; I don't know if that's intentional or not, but I'd like to be able
to turn it off.

201306xx; YASW 0.4
- Fixed Ticket #2 (Image order not retained when project is reloaded.)
- Fixed Ticket #1 (Display FileName instead of BaseName in the image list)
- Fixed Ticket #3 (Propagate settings to all images for one side)
- Added a background color (configurable) for the filter widgets.
- Fixed Ticket #11 (Do not interleave pages in PDF Export)
- Scaling filter
- Improve PDF Export (a lot!)

20130525; YASW 0.3 "yasw has reached one (1) user!"
- About dialog
- open -> recent projects
- change selection color for dekeystoning and cropping
- move all corners (dekeystonig, cropping) when pressing "control" while draging one of the corners


20121118; YASW 0.2
- export to pdf
Expand Down
13 changes: 1 addition & 12 deletions documentation/doxygen-mainpage.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,12 @@ This is YASW (Yet Another Scan Wizard) documentation.
In order develop your own filter, you have to create a class that inherits from BaseFilter and reimplement
- AbstractFilterWidget* getWidget();
- QString getName();
- QString getIdentifier();
- void recalculate(); as a public slot

Each Filter should be placed in its own folder under the filter folder. Don't forget to
modifiy hte INCLUDEPATH in yasw.pro.

Have a look at the Rotation class (folder filter/rotation) for a simple filter example.

\section todo
\todo: disabling a filter (UI) should disable the rendering.
\todo: project handling of a project:
- choose and sort source images
- load and save parameters from filters
- load and save projects
\todo: handling of output
-jpg
-pdf
\todo: (later) autocalibration with a printed grid (line detection)
\todo: (later) add filter for color manipulation_/adjustment

*/
17 changes: 13 additions & 4 deletions install.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ How to Release
# Prepare Release
#######################
- edit changelog
- update version in yasw.pro
- make distclean working repository, rebuild in release, extensive test
- insert images left and right
- move images
Expand All @@ -51,9 +52,10 @@ How to Release
# Build source tarball
#######################
# Tag the git repository
git tag -a yasw_0.1 -m 'YASW version 0.1'
VERSION=0.4
git tag -a yasw_${VERSION} -m "YASW version ${VERSION}"
# build the tarball (note: it contains files like .gitignore...)
git archive --prefix=yasw_0.1/ yasw_0.1 | gzip > ../yasw_0.1.tgz
git archive --prefix=yasw_${VERSION}/ yasw_${VERSION} | gzip > ../yasw_${VERSION}.tgz
# test archive (tar xvzf, qmake, make, ./yasw, play around)
# publish the tag on github:
git push --tags
Expand All @@ -68,7 +70,14 @@ make qt
export PATH=/where MXE is installed/usr/bin:$PATH
# Cross-compile YASW:
cd <path to yasw root folder>
make windows-build
cd yasw\windows-build
mkdir windows-build
cd windows-build
i686-pc-mingw32-qmake ../src/yasw.pro CONFIG+=static
make
# build archive
VERSION=0.3
mkdir yasw_${VERSION}_Windows
cp release/yasw.exe yasw_${VERSION}_Windows/
cp ../README yasw_${VERSION}_Windows/
cp ../documentation/gpl.txt yasw_${VERSION}_Windows/
zip -r yasw_${VERSION}_Windows.zip yasw_${VERSION}_Windows/
10 changes: 9 additions & 1 deletion src/filter/cropping/cropping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,19 @@
#include "cropping.h"

//TODO: add a settings box to set size of resulting image.
Cropping::Cropping()
Cropping::Cropping(QObject *parent)
{
widget = new CroppingWidget();
filterWidget = widget;
connect(widget, SIGNAL(rectangleChanged()), this, SLOT(recalculate()));

if (parent) {
/* Connect slots to the filtercontainer */
connect(parent, SIGNAL(selectionColorChanged(QColor)),
widget, SLOT(setSelectionColor(QColor)));
connect(parent, SIGNAL(backgroundColorChanged(QColor)),
widget, SLOT(setBackgroundColor(QColor)));
}
}

void Cropping::recalculate() {
Expand Down
6 changes: 4 additions & 2 deletions src/filter/cropping/cropping.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@

class Cropping : public BaseFilter
{
Q_OBJECT
public:
Cropping();
Cropping(QObject * parent = 0);
AbstractFilterWidget* getWidget();
QString getIdentifier();
QString getName();
QMap<QString, QVariant> getSettings();
void setSettings(QMap <QString, QVariant> settings);private:
void setSettings(QMap <QString, QVariant> settings);
private:
CroppingWidget *widget;
public slots:
void recalculate();
Expand Down
24 changes: 23 additions & 1 deletion src/filter/cropping/croppingcorner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

#include "croppingcorner.h"
#include <QApplication>

/*! \class CroppingCorner
Expand All @@ -36,6 +37,7 @@ CroppingCorner::CroppingCorner(QPoint position)
{
setRect(-diameter/2, -diameter/2, diameter, diameter);
setPos(position);
lastPosition = pos();
setZValue(100);
setFlags(ItemIsMovable |
ItemIgnoresTransformations |
Expand All @@ -56,9 +58,29 @@ void CroppingCorner::resetCornerMoved()
QVariant CroppingCorner::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value)
{
if (change == ItemPositionHasChanged) {
Qt::KeyboardModifiers keyMod = QApplication::keyboardModifiers ();
if (keyMod.testFlag(Qt::ControlModifier)) {
QPointF positionDelta = pos() - lastPosition;
emit moveOtherCorner(positionDelta);
}
cornerMoved = true;
// moveRectangle();
emit signalCornerMoved();
lastPosition = pos();
}
return QGraphicsEllipseItem::itemChange(change, value);
}


void CroppingCorner::moveCorner(QPointF delta)
{
/* deativate change notifications */
setFlag(ItemSendsGeometryChanges, false);
/* move the Corner */
setPos(pos() + delta);
/* Update cornerMoved, lastPosition and rectangle */
cornerMoved = true;
emit signalCornerMoved();
lastPosition = pos();
/* reactivate change notifications */
setFlag(ItemSendsGeometryChanges, true);
}
16 changes: 16 additions & 0 deletions src/filter/cropping/croppingcorner.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#define CROPPINGCORNER_H

#include <QGraphicsEllipseItem>
#include <QPointF>

enum CornerType { TopLeftCorner, BottomRightCorner };

Expand All @@ -38,8 +39,23 @@ class CroppingCorner : public QObject, public QGraphicsEllipseItem
QRect *rectangle;
bool cornerMoved;
const int diameter = 8;
QPointF lastPosition;

signals:
/** \brief signal emited when a corner was moved.
This signal is connected to the parent class CroppingGraphicsView::moveRectangle()
*/
void signalCornerMoved();

/** \brief signal emited when a corner was moved and other corner have to change their position.
This signal is connected to the slot DekeystoningCorner::moveCorner() of the three other
coners. The connection is handeld in the constructor of DekeystoningGraphicsView.
*/
void moveOtherCorner(QPointF delta);
public slots:
void moveCorner(QPointF delta);
};

#endif // CROPPINGCORNER_H
15 changes: 15 additions & 0 deletions src/filter/cropping/croppinggraphicsview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ CroppingGraphicsView::CroppingGraphicsView(QWidget *parent) :
connect(topLeftCorner, SIGNAL(signalCornerMoved()), this, SLOT(moveRectangle()));
connect(bottomRightCorner, SIGNAL(signalCornerMoved()), this, SLOT(moveRectangle()));
moveRectangle();

/* connect the corners together so they can move each other when Control is pressed */
connect(topLeftCorner, SIGNAL(moveOtherCorner(QPointF)),
bottomRightCorner, SLOT(moveCorner(QPointF)));
connect(bottomRightCorner, SIGNAL(moveOtherCorner(QPointF)),
topLeftCorner, SLOT(moveCorner(QPointF)));
}

CroppingGraphicsView::~CroppingGraphicsView()
Expand Down Expand Up @@ -110,3 +116,12 @@ void CroppingGraphicsView::setSettings(QMap<QString, QVariant> settings)
}
}

void CroppingGraphicsView::setSelectionColor(QColor color)
{
QPen pen = QPen(color);

topLeftCorner->setPen(pen);
bottomRightCorner->setPen(pen);
rectangle->setPen(pen);
}

2 changes: 2 additions & 0 deletions src/filter/cropping/croppinggraphicsview.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class CroppingGraphicsView : public BaseFilterGraphicsView
void resetRectangleMoved();
QMap<QString, QVariant> getSettings();
void setSettings(QMap <QString, QVariant> settings);
void setSelectionColor(QColor color);

public slots:
void hideRectangle(bool hide);
void moveRectangle();
Expand Down
15 changes: 15 additions & 0 deletions src/filter/cropping/croppingwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,18 @@ void CroppingWidget::setSettings(QMap<QString, QVariant> settings)
{
ui->view->setSettings(settings);
}

/** \brief Sets new Selection Color
This does only forward the information, as this widget ist the only one able to call
members functions of ui->view.
*/
void CroppingWidget::setSelectionColor(QColor color)
{
ui->view->setSelectionColor(color);
}

void CroppingWidget::setBackgroundColor(QColor color)
{
ui->view->setBackgroundBrush(QBrush(color));
}
4 changes: 4 additions & 0 deletions src/filter/cropping/croppingwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ class CroppingWidget : public AbstractFilterWidget
QMap<QString, QVariant> getSettings();
void setSettings(QMap <QString, QVariant> settings);

public slots:
void setSelectionColor(QColor color);
void setBackgroundColor(QColor color);

private:
Ui::CroppingWidget *ui;

Expand Down
13 changes: 12 additions & 1 deletion src/filter/dekeystoning/dekeystoning.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,23 @@
*/
#include "dekeystoning.h"
#include <QDebug>
#include <QColor>

Dekeystoning::Dekeystoning()
Dekeystoning::Dekeystoning(QObject *parent)
{
widget = new DekeystoningWidget();
filterWidget = widget;
connect(widget, SIGNAL(polygonChanged()), this, SLOT(recalculate()));


if (parent) {
/* Connect slots to the filtercontainer */
connect(parent, SIGNAL(selectionColorChanged(QColor)),
widget, SLOT(setSelectionColor(QColor)));
connect(parent, SIGNAL(backgroundColorChanged(QColor)),
widget, SLOT(setBackgroundColor(QColor)));

}
}

/** \brief Returns a universal name for this filter.
Expand Down
2 changes: 1 addition & 1 deletion src/filter/dekeystoning/dekeystoning.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Dekeystoning : public BaseFilter
{
Q_OBJECT
public:
Dekeystoning();
Dekeystoning(QObject * parent = 0);
AbstractFilterWidget* getWidget();
QString getIdentifier();
QString getName();
Expand Down
Loading

0 comments on commit be793c7

Please sign in to comment.