Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Tuesday, March 21, 2006 9:55:05 AM(UTC)

AlPrice  
AlPrice

Groups: Registered
Posts: 3


i would like to crop an image using an interactive selected rectangle.

i can get the rectangle to display using

TabPage tp = tabControl1.SelectedTab;
RasterImageViewer riv = (RasterImageViewer)tp.Controls[0];
_viewer = riv;
_viewer.InteractiveMode =
RasterViewerInteractiveMode.Region;
_viewer.InteractiveRegionType =
RasterViewerInteractiveRegionType.Rectangle;

i also have an event handler to handle when the rectangle is finished drawing;

I would like to use the rectangle to give the parameters to the crop command but dont have a clue how to do it

 

help!

 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Thursday, March 23, 2006 2:58:39 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

Was thanked: 1 time(s) in 1 post(s)

Hello,

I am attaching a small VB.Net project that shows how to draw a rectangle region on the image in the Region InteractiveMode. And then how to zoom in the rectangle and crop the result using the Leadtools.ImageProcessing.CropCommand.

Please check the attached project and let me know if this helps.

Note: using the attached project, you can change the viewer size mode on the mouse R-click.

Thanks,
Maen Badwan
LEADTOOLS Technical Support
File Attachment(s):
CropCommand.zip (10kb) downloaded 127 time(s).
 
#3 Posted : Friday, March 24, 2006 4:10:35 AM(UTC)

AlPrice  
AlPrice

Groups: Registered
Posts: 3


Maen,

After converting the project to C#, It did exactly what i wanted.

 

Thanks you very much for your prompt and accurate information.

 

Thanks again,

Al Price

 
#4 Posted : Wednesday, July 19, 2006 6:09:54 PM(UTC)

quacka  
quacka

Groups: Registered
Posts: 4


I was wondering if we can pre-draw the rectangle beforehand instead of the user have to draw it with the mouse. I think this makes things easier like:
http://demo.aurigma.com/PhotoEditor/

also I like the grey area outside of it. I think the way you adjust it should be the dot on the sides instead of corners.

 

Anyway to do this?

 
#5 Posted : Sunday, July 23, 2006 4:59:40 AM(UTC)

Bashar  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

To pre-draw the rectangle, you can simply call AddRectangleToRegion to create the region programmatically.

 
#6 Posted : Sunday, July 23, 2006 5:02:47 AM(UTC)

quacka  
quacka

Groups: Registered
Posts: 4


What I want to know is how to make the rectangle adjustable by dragging the borders and also how to grey out the area outside of it.
 
#7 Posted : Wednesday, July 26, 2006 9:07:47 AM(UTC)

Bashar  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

The best way to make the region adjustable is by using
annotations.  With annotations, you can create shapes of various
types (e.g. rectangle, circle, etc.) and adjust it using the mouse
without any code.  This feature is part of Document Imaging.  The only other solution is to implement this using mouse events.


As for graying the are outside the region, this is not straight forward
because the GrayScaleCommand changes the whole image, not just the region.  One way to implement this is as follows:


Create a  copy of the original image (without the region) and
convert it to grayscale using GrayScaleCommand, then convert it back to
24-bits using ColorResolutionCommand.  Then use the Combine method to copy/paste the region from the original image to the grayscale one.


If this is too much overhead for you, then you can just change the
intensity of the region using ChangeIntensityCommand to make it stand out.  This command works on the region only.

Hope this helps.

 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.218 seconds.