Unsharp Mask doesn't work?

Discussions about image processing and document imaging.
Post Reply
felix
Posts: 20
Joined: Mon Apr 19, 2010 2:54 pm

Unsharp Mask doesn't work?

Post by felix » Fri Jun 28, 2013 11:54 am

Good Day, everyone.

I tried to use the fxUnsharpMask effect on my image. But I am not able to see any difference with and without the effect.

Call:
gdStat = m_GdImage.FxUnsharpMask(iGdImgPage, 5, 5, 10);

^- the above values are that bad that you really should see a difference.

After using the FxUnsharpMask function, I set some metadata and save the image as TIF:
gdStat = m_GdImage.SaveAsTIFF(iGdImgPage, str_Name, pDataSource.GdTifCompression);

You can find examples on my FTP-Server: ftp://gdpicture:gd*p1c7@ftp.walternagel ... p_mask.zip
(Files are too big for your upload system)

Please try to reproduce my problem and give me some feedback about how I could get it running. Thanks in advance.

Cheers,
Felix

SamiKharma
Posts: 352
Joined: Tue Sep 27, 2011 11:47 am

Re: Unsharp Mask doesn't work?

Post by SamiKharma » Sun Jun 30, 2013 9:40 am

Hi,

The reason is simple, your image is too big for those values (dimensions wise). You are basically producing too little amount.
You need to:
1. Slightly increase the radius
2. Extremely increase the amount, probably >400 for your image
3. Reduce the threshold.

You can play with those values to produce the desired amount.

Best,
Sami

felix
Posts: 20
Joined: Mon Apr 19, 2010 2:54 pm

Re: Unsharp Mask doesn't work?

Post by felix » Tue Jul 02, 2013 12:59 pm

Hi Sami,

unfortunately other values didn't change the result. I tried radius 10, amunt 500 and threshold 5. And I tried radius 20, amount 800 and threshold 3. But the image still looked the same.

To check the values I tried the unsharp mask from GIMP 2.8 on my saved TIF image - result is massive visible. Even with the first values I tried (5, 5, 10).

Do you have another idea? Could it be the order of the functions I call?

FxUnsharpMask -> SetHorizontalResolution -> SetVerticalResolution -> 4x TagSetValueString (TagSoftwareUsed, TagArtist, TagCopyright, TagEquipModel) -> SaveAsTIFF

Best,
Felix

SamiKharma
Posts: 352
Joined: Tue Sep 27, 2011 11:47 am

Re: Unsharp Mask doesn't work?

Post by SamiKharma » Tue Jul 02, 2013 1:48 pm

Hi,

I tried the values you talked about (10, 500, 5) with our latest release and I can definitely see a difference. Could you please try it and see.

Best,
Sami

felix
Posts: 20
Joined: Mon Apr 19, 2010 2:54 pm

Re: Unsharp Mask doesn't work?

Post by felix » Tue Jul 02, 2013 3:17 pm

Dear Sami,

would it be possible to get an example from you where I could see the difference you get?

Best,
Felix

SamiKharma
Posts: 352
Joined: Tue Sep 27, 2011 11:47 am

Re: Unsharp Mask doesn't work?

Post by SamiKharma » Wed Jul 03, 2013 1:19 pm

Hi,

Here is your image with the parameters you indicated (10, 500, 5). It is jpg just for size matters:
123.jpg
The more radius you add, the more sharpening you will get.

Best,
Sami

felix
Posts: 20
Joined: Mon Apr 19, 2010 2:54 pm

Re: Unsharp Mask doesn't work?

Post by felix » Wed Jul 03, 2013 1:58 pm

Thanks, Sami.

I just checked again. And by a fortunate coincidence I had to choose another camera to capture the image.
Result: If I get the image from a Canon EOS 450D the result is more than visible - it is extreme. If I get the image from a Canon EOS 5D Mark II I don't get any results.

Both times the camera captured a RAW file, the eos sdk was used to get the image and after that a gdpicture was created (CreateGdPictureImageFromByteArray). After that the things I posted earlier including the FxUnsharpMask.

Do you have an idea what could cause that? EOS 450D has 12 Million pixel and the 5D Mark II has 21 Million pixel - might that be a problem?
Even with values like 20, 1000, 2 I cannot see a difference on the image from the 5D Mark II.

See example:
comp.jpg
Best,
Felix

SamiKharma
Posts: 352
Joined: Tue Sep 27, 2011 11:47 am

Re: Unsharp Mask doesn't work?

Post by SamiKharma » Wed Jul 03, 2013 5:48 pm

Hi,

I cannot tell without seeing the images. Please do the following:
1. Make sure you have the latest (we have made some internal changes to unsharp mask a short while back).
2. Try again. If the problem persists, check if the methods returns an error.
3. If no error is returned, please do attach the image.

Best,
Sami

felix
Posts: 20
Joined: Mon Apr 19, 2010 2:54 pm

Re: Unsharp Mask doesn't work?

Post by felix » Tue Jul 30, 2013 11:07 am

Hi,

we are still on it and testing it with different images.

1. We do have the latest version.
2. My colleague just checked again: With an image from the bigger camera (5d mark ii) the function returns "out of memory".

That means: The function works. And it works with "normal" values like 5, 0.5, 40.

SamiKharma
Posts: 352
Joined: Tue Sep 27, 2011 11:47 am

Re: Unsharp Mask doesn't work?

Post by SamiKharma » Tue Jul 30, 2013 11:54 am

Hi,

Im not sure I understand.
If it returns an OutOfMemory Error, please attach the image, the parameters used, and what the version you are using.
Also, please indicate how much RAM you have on your machine, and whether you are running under 64 bits or 32.

Best,
Sami

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests