Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
keesjalink  
#1 Posted : Friday, August 06, 2004 6:31:00 AM(UTC)
keesjalink

Rank: Member

Groups: Member
Joined: 3/22/2004(UTC)
Posts: 18

Dear all,

what is the fastest way to perform the 3 following tasks on 8bpp grey images in GM using VB6?
1) subtract an integer value (e.g. 12) from all grey values in the image (effectively resulting in background subtraction), with resulting negatives being set to 0?
I can do it with low-level data access methods (copyMemory etc) but is there a build-in function that will do this?

2) make a digital mask of a picture where all pixels smaller than an indicated minimum (e.g., <12) is="" set="" to="" 0="" and="" all="" other="" pixels="" are="" set="" to="" 0?="">

3) set all pixels smaller than a given value to 0, and keep the other pixels unchanged (background suppresion, rather than subtraction)

Thanks, Kees
Fedor  
#2 Posted : Saturday, August 07, 2004 1:53:00 AM(UTC)
Fedor

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 7/28/2003(UTC)
Posts: 1,537

Thanks: 4 times
Was thanked: 56 time(s) in 55 post(s)
1) subtract an integer value (e.g. 12) from all grey values in the image (effectively resulting in background subtraction), with resulting negatives being set to 0?
I can do it with low-level data access methods (copyMemory etc) but is there a build-in function that will do this?


The Brightness effect works by adding/substracting specified value to all channels. So way to substract 12 you should use Brightness effect with following code:

Code:
BitmapViewer1.Bitmap.ColorAdjustment.Brightness -12


You can also use ChannelBalance method for the same purposes.

2) ... is set to 0 and all other pixels are set to 0?

Sorry, what do you mean here?

3) set all pixels smaller than a given value to 0, and keep the other pixels unchanged (background suppresion, rather than subtraction)

As for last I will think and post here sample in the nearest time.

Edited by user Tuesday, December 15, 2009 10:22:04 AM(UTC)  | Reason: Not specified

Best regards,
Fedor Skvortsov
keesjalink  
#3 Posted : Saturday, August 07, 2004 4:13:00 AM(UTC)
keesjalink

Rank: Member

Groups: Member
Joined: 3/22/2004(UTC)
Posts: 18

concerning my question 2:

Oops, that is a typo. I mean:
...is set to 0 and all other pixels are set to 1 (ONE)!!

The idea is to make a digital mask with zero's for low-level pixels, and with 1 for higher levels. That is because I want to perform arithmatic between pixel values from different images, that are taken at extremely low light levels. In these images, a gray level of e.g. 9 is based on collection of only 9 photons for that pixel. The natural variation in this type of low light images is + 2 * sqrt(9) to - 2* sqrt(9), meaning that actual values may change from 9+6 to 9-6, so from 15 to 3. This causes enormous errors in my arithmatic, therefore I wish to exclude these pixels from the calculations using the digital mask.


keesjalink  
#4 Posted : Saturday, August 07, 2004 5:02:00 AM(UTC)
keesjalink

Rank: Member

Groups: Member
Joined: 3/22/2004(UTC)
Posts: 18

This seems to do the digital masking (Q2) with e.g. graylevel 12 as cut-off:

BitmapViewer1.Bitmap.ColorAdjustment.Brightness (127-12)
'adjust brightness with 12 less than mid-range
BitmapViewer1.Bitmap.ColorAdjustment.Contrast (100)
'2-level posterization around that image in effect causes two-level posterization around '12'
'in the original picture
BitmapViewer1.Bitmap.Data.ConvertTo1bppIndexed

any problems with that?
Kees
Andrew  
#5 Posted : Sunday, August 15, 2004 8:36:00 PM(UTC)
Andrew

Rank: Advanced Member

Groups: Member, Administration
Joined: 8/2/2003(UTC)
Posts: 866

Thanks: 2 times
Was thanked: 26 time(s) in 26 post(s)
It seems to be a good solution for problem 2. As for problem 3, the simplest way is to use the mask you get as an alpha channel and blend it with totally black image of the same size as your one. Please let me know if you need a code sample.
Users browsing this topic
Forum Jump  
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.