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 : Wednesday, May 31, 2006 8:50:07 PM(UTC)

manju  
manju

Groups: Registered
Posts: 49


Hi,

I'am using Leadtools 13.0 version.I know that there is an method through which which we can select a region of an image. I want to confirm that if i select a region of an image is it possible to save that part of image which comes the region.

Also i want to know that is it possible to get other properties applied to the image which is selected like gray scale and sepia an all?

Thanks in advance

-Manju

 

 

 

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 : Sunday, June 4, 2006 11:03:09 PM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,328

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

Hello,

About creating a region and save it, the details depend on the programming interface (COM, API, OCX, etc.) that you use. What is the programming interface?
For example, if you are using LEADTOOLS COM programming interface, you can do it by using the following code:
+--------------------------------------+
Dim RasterIO As New LEADRasterIO
Dim X, Y, W, H As Integer
Dim RasterProc As New LEADRasterProcess
'The dimensions of the region
X = 50
Y = 50
W = 100
H = 100
'Load the image
RasterIO.Load LEADRasterView1.Raster, "c:\1.bmp", 0, 0, 1
'Set the type of the region frames
LEADRasterView1.RgnFrameType = RGNFRAME_ANIMATED
LEADRasterView2.RgnFrameType = RGNFRAME_ANIMATED
'Add region to the image
LEADRasterView1.Raster.SetRgnEllipse X, Y, W, H, L_RGN_SET
'Create a bitmap with the same dimentions of the region that you want to save
LEADRasterView2.Raster.CreateBitmap W, H, LEADRasterView1.Raster.BitmapBits
'Fill the created image
RasterProc.Fill LEADRasterView2.Raster, RGB(255, 255, 255) ' fill with white
'Combine the two images
RasterProc.CombineExt LEADRasterView2.Raster, 0, 0, W, H, LEADRasterView1.Raster, X, Y, CB_OP_ADD And CB_DST_0
'Save the new image
RasterIO.Save LEADRasterView2.Raster, "c:\test.bmp", FILE_BMP, LEADRasterView2.Raster.BitmapBits, 0, SAVE_OVERWRITE
+--------------------------------------+

About using LEADTOOLS functions with the region, do you mean that you want to use the functions with the region or with the new created image?
However, some functions are working with regions, such as RasterProc.Fill method. And some other functions apply to the entire image (regardless of the region) such as the RasterProc.Grayscale method. But since you created a new image from the region, you can use the different functions with the image with no problem.

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#3 Posted : Monday, June 5, 2006 8:22:24 PM(UTC)

manju  
manju

Groups: Registered
Posts: 49


hi,

Thanks it worked!!

One more query is there:-

If now you select a region of an image and when you apply grayscale color to it that should get applied to the rest of the image which is not there in the selected region of the image. And when you apply the color it should be possible to save that image with the color applied to it.

Also i'am using ocx component.

Thank you in advance

-Manju

 
#4 Posted : Monday, June 5, 2006 11:18:23 PM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,328

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

Hello,

When you select a region from an image, and then call the Lead1.Grayscale method, the Grayscale method affects the entire image (plus the region area). When you apply a color to your image, you should be able to save it with this color.

Please try it and let me know how it goes.

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#5 Posted : Tuesday, June 6, 2006 12:32:07 AM(UTC)

manju  
manju

Groups: Registered
Posts: 49


Hello,

I'll tell you whole scenario and what exactly i want.:-

We are having one colored image now in that image i select particular region.Now I want to apply grayScale color to the rest of the image that means the image which is there in the region should have the original color not the grayscale.And when we apply this effect i want to save the image in which region of image will have original image color and the rest of image will have grayscale color.

In this whole thing i'am able to get this effect but i'am not able to sav ethe image with the thing i said before.So,please let me know how to save this image with all the effects applied to it.

I'am using Leadtools 13.0 and a OCX  interface.

I'am sending you 1 images so you can get what i want.

I want to save this image how this can be achieved?

Please  reply as soon as possible!

Thank you in advance.

- Manju

 

 

 

 
#6 Posted : Tuesday, June 6, 2006 10:21:43 PM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,328

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

Hello Manju,

You need to save the region data in a different bitmap before changing the color of the main image.
Then, you can apply the grayscale effect on the original image, and then you need to combine the region data with the original data. The code will be something as follows:
+--------------------+
LEAD1.Load "c:\1.bmp", 0, 0, 1
LEAD1.RgnFrameType = RGNFRAME_ANIMATED
LEAD1.SetRgnRect 50, 50, 150, 150, L_RGN_SET

LEAD2.CreateBitmap LEAD1.RgnWidth, LEAD1.RgnHeight, LEAD1.BitmapBits
LEAD2.Fill RGB(255, 255, 255) ' fill with white
LEAD2.CombineExt 0, 0, LEAD1.RgnWidth, LEAD1.RgnHeight, LEAD1.Bitmap, LEAD1.RgnLeft, LEAD1.RgnTop, CB_OP_ADD And CB_DST_0
LEAD2.RgnFrameType = RGNFRAME_ANIMATED
LEAD2.SetRgnRect 0, 0, LEAD1.RgnWidth, LEAD1.RgnHeight, L_RGN_SET

LEAD1.Grayscale 16
LEAD1.ColorRes 24, 0, 0, 0
LEAD1.CombineExt LEAD1.RgnLeft, LEAD1.RgnTop, LEAD1.RgnWidth, LEAD1.RgnHeight, LEAD2.Bitmap, 0, 0, CB_DST_0 And CB_OP_AVG
LEAD1.Save "c:\test.bmp", FILE_BMP, 24, 2, SAVE_OVERWRITE
+--------------------+

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#7 Posted : Wednesday, June 7, 2006 1:18:47 AM(UTC)

manju  
manju

Groups: Registered
Posts: 49


Hello,

Thanxs a tone!!!

It is working but one more thing is there.

It saves the image with proper color and all but in the main control display the color of the region gets changed to some other color. Please let me know what can be done.

Thank you in advance.

- Manju

 
#8 Posted : Thursday, June 8, 2006 12:31:22 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,328

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

Hello,

The problem might be related to BGR or RGB issue.
Please try to change the code as follows:
+---------------------------------------+
LEAD1.Load "c:\1.bmp", 0, 0, 1
LEAD1.RgnFrameType = RGNFRAME_ANIMATED
LEAD1.SetRgnRect 50, 50, 150, 150, L_RGN_SET
LEAD2.CreateBitmap LEAD1.RgnWidth, LEAD1.RgnHeight, LEAD1.BitmapBits
LEAD2.Fill RGB(255, 255, 255) ' fill with white
LEAD2.CombineExt 0, 0, LEAD1.RgnWidth, LEAD1.RgnHeight, LEAD1.Bitmap, LEAD1.RgnLeft, LEAD1.RgnTop, CB_OP_ADD And CB_DST_0
LEAD2.RgnFrameType = RGNFRAME_ANIMATED
LEAD2.SetRgnRect 0, 0, LEAD1.RgnWidth, LEAD1.RgnHeight, L_RGN_SET
LEAD1.Grayscale 16
LEAD1.ColorRes 24, CRP_BYTEORDERBGR, CRD_NODITHERING, 0
LEAD1.CombineExt LEAD1.RgnLeft, LEAD1.RgnTop, LEAD1.RgnWidth, LEAD1.RgnHeight, LEAD2.Bitmap, 0, 0, CB_OP_ADD + CB_DST_0
LEAD1.Save "c:\test.bmp", FILE_BMP, 24, 2, SAVE_OVERWRITE
+---------------------------------------+

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#9 Posted : Thursday, June 8, 2006 8:58:02 PM(UTC)

manju  
manju

Groups: Registered
Posts: 49


hello,

Thanks a ton...it is working!!

- Manju

 
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-2020, Yet Another Forum.NET
This page was generated in 0.218 seconds.