unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: Drawing in images?
@ 2009-09-29  0:31 MON KEY
  2009-09-29  5:29 ` martin rudalics
  0 siblings, 1 reply; 28+ messages in thread
From: MON KEY @ 2009-09-29  0:31 UTC (permalink / raw)
  To: emacs-devel

While examining dragbox2.el it occurred to me that an alternative way to
set a crop would be to use emacs window... er actually 5 windows!

                                                                 68.
  _________________________________________________________________
 |                             !                     |             |
 | window1                     !                     |    window4  |
 |                             !                     |             |
 |                             !                     |             |
 |                            \|/                    |             |
 |---------------------------------------------------|             |
 |           |                /!\                    |             |
 |           |                 !                     |             |
 |           |          Y-axis !                     |             |
 |           |                 !                     |             |
 |           |                 !                     |             |
 |           |                 !                     |             |
 |           |                 !                     |             |
 |           |                 !                     |             |
 |           |        window5  !                     |             |
 |~~~~~~~~~~>|<~~~~~~~~~~~~~~~~+~~~~~~~~~~~~~~~~~~~~>|<~~~~~~~~~~~~|
 |           |                 !       X-axis        |             |
 |           |                 !                     |             |
 |           |                 !                     |             |
 |           |                 !                     |             |
 |           |                 !                     |             |
 |           |                 !                     |             |
 |           |                 !                     |             |
 |           |                 !                     |             |
 |           |                 !                     |             |
 |           |                \!/                    |             |
 |           |-----------------------------------------------------|
 |           |                /!\                          window3 |
 |           |                 !                                   |
 |           |                 !                                   |
 |           |                 !                                   |
 |   window2 |                 !                                   |
 |___________|_________________|___________________________________|
                                                                 68^


* Assume that the image to be cropped/bounded is in window5.

* Assume that all windows have a ~1-3 pixel border.

* Assume that window1, window2, window3, window4 can _only_ be
expanded contracted
  on the axis indicated.

* Assume that window 5 is the only window that can be
expanded/contracted on both axis.

* Assume use of a library such as Drew Adams' DoReMi or equivalent.

* Assume Y-axis -> Up/Down expansion/contraction

* Assume X-axis -> Left/Right expansion/contraction

Window1 can expand/contract only along the Y-axis
Window2 can expand/contract only along the X-axis
Window3 can expand/contract only along the y-axis
Window4 can expand/contract only along the X-axis

Window5 can expand/contract along both the X-axis and Y-axis.
Window5 can recenter/reset the image along both the X-axis and Y-axis.

Shouldn't `posn-object-width-height', `posn-window', `posn-area' etc.
get one reasonably accurate pixel coardinates for a crop?

If so, doesn't this give us visual feedback without need of external calls, SVG
overlays, GTK wonkery etc.?

Also, a novel idea for doing image rotation using artist.el
as influenced by Unpaper's "Virtual Bar":
(URL `http://unpaper.berlios.de/img/deskew-detail1.png')
(URL `http://unpaper.berlios.de/img/deskew-detail2.png')

Which skews an image against a "Virtual Line" by calculating the skew against
some baseline (x-axis, y-axis, both) i.e. the radian as the virtual line's
deviation from "square".

    Emacs window (preferably in a dedicated frame)
 +--------------------------------------------------------60.
 |                                                         |
 |    +-----------------------------------------------+    |
 |    |                     .                         |    |
 |    |                    /                          |    |
 |    |                   /                           |    |
 |    |                  /                            |    |
 |    |                 /                             |    |
 |    |                /                              |    |
 |    |               /                               |    |
 |    |              /                                |    |
 |    |             / <-Virtual Line                  |    |
 |    |            /                                  |    |
 |    |           /                                   |    |
 |    |          /                                    |    |
 |    |         /                                     |    |
 |    |        /                                      |    |
 |    |       /                                       |    |
 |    |      /                                        |    |
 |    |     /                                         |    |
 |    |    /                                          |    |
 |    |   /                                           |    |
 |    |  .                                            |    |
 |    |                                               |    |
 |    |                                               |    |
 |    |                                               |    |
 |    |                                               |    |
 |    |                                               |    |
 |    |                                               |    |
 |  Y |                                               |    |
 |    |       A Skewed Image (needs rotating)         |    |
 |    +-----------------------------------------------+    |
 |      X                                                  |
 +--------------------------------------------------------60.

s_P




^ permalink raw reply	[flat|nested] 28+ messages in thread
* Re: Drawing in images?
@ 2009-08-27  0:52 MON KEY
  2009-08-27  6:31 ` joakim
  0 siblings, 1 reply; 28+ messages in thread
From: MON KEY @ 2009-08-27  0:52 UTC (permalink / raw)
  To: joakim; +Cc: emacs-devel

> a) use clever already existing way, unknown to me, or

Could parts of ../lisp/textmodes/artist.el be used?

The rectangling feature is usable for setting reasonable rhombus'
At the very least the heuristics of its rubber-banding are already available.

BTW: This would be a _killer-feature_  if the bounding box could be rotated.
Moreso, with key commands e.g. rotate-box-left/right..  :=]

Few image editors do this well if at all (including imagemagick).

elisp certainly has fast enough routines available with `asin' `atan' et al.
If you should happen to find a way to make the box happen please
consider leaving room for rotations - design constraints permitting of
course.

FWIW the ability to rotate/skew boxes in OCR apps is one of the
aspects of that task that is lacking in nearly all commercial products
(the free counterparts all seem to be based on the same legacy HP code
as the commercial derivatives) and it seriously hinders the viability
of the output.

If a bounding box could be implemented as a working part of Emacs
there are some really amazing applications for applying
annotations/text-properties/alist lookups on 'regions' of processed
text/images...

s_P




^ permalink raw reply	[flat|nested] 28+ messages in thread
* Drawing in images?
@ 2009-08-25 22:57 joakim
  2009-08-26  1:07 ` Stefan Monnier
  2009-08-28  0:49 ` YAMAMOTO Mitsuharu
  0 siblings, 2 replies; 28+ messages in thread
From: joakim @ 2009-08-25 22:57 UTC (permalink / raw)
  To: Emacs Development

I would like to draw a bounding box inside an image displayed in emacs.

Do I:

 a) use clever already existing way, unknown to me, or

 b) patch my imagemagic patch to support drawing operations within
 images displayed in Emacs, or

 c) non-existing way likelier to be accepted in Emacs, than b)?

The use-case is displaying a scanned image and selecting a region for
OCR, which will result in text that will later be processed in Emacs.
 
-- 
Joakim Verona




^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2009-09-29 20:25 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-29  0:31 Drawing in images? MON KEY
2009-09-29  5:29 ` martin rudalics
2009-09-29 20:25   ` MON KEY
  -- strict thread matches above, loose matches on Subject: below --
2009-08-27  0:52 MON KEY
2009-08-27  6:31 ` joakim
2009-08-27 18:07   ` MON KEY
2009-08-27 19:05     ` joakim
2009-08-28 16:22       ` MON KEY
2009-08-27 22:21   ` Chong Yidong
2009-08-27 23:51     ` joakim
2009-09-16 19:04     ` joakim
2009-09-17 19:13       ` MON KEY
2009-09-17 21:04         ` Lennart Borgman
2009-09-17 21:08           ` Lennart Borgman
2009-09-17 23:00           ` Jason Rumney
2009-09-17 23:09             ` Lennart Borgman
2009-09-17 21:46         ` joakim
2009-09-17 22:09           ` Lennart Borgman
2009-09-17 22:46             ` Juanma Barranquero
2009-09-17 22:56               ` Lennart Borgman
2009-09-17 22:56         ` Jason Rumney
2009-09-17 22:59           ` Lennart Borgman
2009-08-25 22:57 joakim
2009-08-26  1:07 ` Stefan Monnier
2009-08-26  5:58   ` joakim
2009-08-26 14:45     ` Stefan Monnier
2009-08-26  9:05   ` Jason Rumney
2009-08-28  0:49 ` YAMAMOTO Mitsuharu

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).