Fuzzy gradient Lines and line smearing
Fuzzy gradient Lines and line smearing
Fuzzy gradient Lines and line smearing
Fuzzy gradient Lines and line smearing
Fuzzy gradient Lines and line smearing
Fuzzy gradient Lines and line smearing Fuzzy gradient Lines and line smearing Fuzzy gradient Lines and line smearing Fuzzy gradient Lines and line smearing Fuzzy gradient Lines and line smearing Fuzzy gradient Lines and line smearing Fuzzy gradient Lines and line smearing Fuzzy gradient Lines and line smearing
Fuzzy gradient Lines and line smearing Fuzzy gradient Lines and line smearing
Fuzzy gradient Lines and line smearing
Go Back  Xtreme Visual Basic Talk > > > Fuzzy gradient Lines and line smearing


Reply
 
Thread Tools Display Modes
  #21  
Old 05-11-2012, 11:20 AM
passel's Avatar
passelFuzzy gradient Lines and line smearing passel is offline
Sinecure Expert

Super Moderator
* Guru *
 
Join Date: Jun 2003
Location: Upstate New York, usa
Posts: 8,024
Default


Quote:
Originally Posted by surfR2911 View Post
...What I'm hoping is that variables (like X1 thru X17..or an array of variables) could be
substituted for the numerical values in Color Matrix creation code like:
Code:
      Dim cMatrix As New ColorMatrix(New Single()() _
       {New Single() {0.299, 0.299, 0.299, transp, 0}, _
       New Single() {0.587, 0.587, 0.587, 0, 0}, _
        New Single() {0.114, 0.114, 0.114, 0, 0}, _
        New Single() {0, 0, 0, 0, 0}, _
        New Single() {0, 0, 0, 0, 1}})
so that a code sequence of
different "If..Then" structures could test for different booleans like
blnAddAlphaAdjust, blnAddSinusoidalConvolution, blnAddGaussianBlur, etc,
and perform the relevant cumulative additive adjusts on the X1 thru X17 variable number values that are used (in turn) to generate the color matrix.
...
So, are you proposing updating the color matrix (through the use of the variables) for each pixel being drawn (i.e. draw pixel, modify matrix, draw pixel, modify matrix, ...)?

A color matrix can only self-reference one pixel's components, transform them to other values based on the contents of the matrix, and then return the resulting color. One color in, one color out.
The rendering of the pixel (how the resulting color is combined with the destination pixel) is still the simple alpha based combination of the two colors inherent in ARGB bitmap drawing which takes place after the source color has been transformed.

Most of your filters and noise generators are going to involve more than one pixel.
The color matrix can't be used to take one bitmap as a reference to modify another.

The texturing example you have is not merging pixels from the two bitmaps. It is transforming the source pixel on the fly to grayscale and using the grayscale value to modify the alpha as well. The resulting pixel color is then just normal ARGB'ly combined with the destination pixel.
__________________
There Is An Island Of Opportunity In The Middle of Every Difficulty.
Miss That, Though, And You're Pretty Much Doomed.
Reply With Quote
  #22  
Old 05-12-2012, 12:25 PM
surfR2911 surfR2911 is offline
Contributor
 
Join Date: Oct 2009
Posts: 719
Default Colormatrix limitations for pixel modification

Quote:
So, are you proposing updating the color matrix (through the use of the variables) for each pixel being drawn (i.e. draw pixel, modify matrix, draw pixel, modify matrix, ...)?
It wasn't necessarily something I was going to try, but I did wonder if something like that might be possible..
Quote:
Most of your filters and noise generators are going to involve more than one pixel.
The color matrix can't be used to take one bitmap as a reference to modify another.
That was I was afraid of..I wanted to be able to use a color matrix for effects whenever I can
but this is obvious the "wall" that is going to limit the use of a color matrix in some cases.

That is why I'm going to keep working with the FastPix library.
It makes a good wrapper for Lock/UnLock bits,
and there are still a lot of VB.Net code examples I have found on the internet
that rely on GetPixel/SetPixel.
Using the FastPix code makes for an easy substitution.
Reply With Quote
  #23  
Old 05-23-2012, 03:18 AM
surfR2911 surfR2911 is offline
Contributor
 
Join Date: Oct 2009
Posts: 719
Default A little progress - towards a pixel differentiator and adjusting framework

The attached code works well in detecting the differences between the
background-only picturebox image and the
background with fuzzy lines overlay picturebox image.

That's the good part.

The bad (ugly) part is what happens when the code tries to create an alpha mask.
Its creates something..I just don't think its really a true (real) alpha mask.

I should be able to change this line
Code:
'bytDifference represents a changing alpha value determined at runtime
Dim newColor3 As Color = Color.FromArgb((bytDifference), 128, 128, 128)
to use white instead of grey:
Code:
'bytDifference represents a changing alpha value determined at runtime
Dim newColor3 As Color = Color.FromArgb((bytDifference), 255, 255, 255)
..and have some assemblance of greyscale gradients (using varying alpha values),
but it just ends up creating a jagged (ragged) group of pure colored pixels.

Anyway, at this point I'm having more of a conceptual (rather than a coding) breakdown.

What I'm trying to develop (evolve) is the code to create is a fuzzy lines shaped mask
that I can use not just with a pure color (like white),
but as a more general alpha opacity per pixel gradient mask,
in conjunction with a texture graphic,
(like a stone texture, wood grain, or parchment).

There aren't any internet samples of making up a per pixel alpha mask by determining
differences between two pics that I have been able to find,
so I'm just trial and error coding at this point
(don't ask what happened with versions 1-6).

any ideas, suggestions welcome..
Attached Images
File Type: jpg screenshot-pixel_differences-n-alpha_mask_creator7b.JPG (212.4 KB, 10 views)
Attached Files
File Type: zip PixelDifferences-n-AlphaMaskCreator7.zip (1.32 MB, 4 views)

Last edited by surfR2911; 05-23-2012 at 03:27 AM.
Reply With Quote
  #24  
Old 05-27-2012, 05:00 PM
surfR2911 surfR2911 is offline
Contributor
 
Join Date: Oct 2009
Posts: 719
Default Alpha mask creation for pixel splattered multi-level transprency lines

Well it's been a few days and it doesn't look like anyone is interested in viewing the attachment from my last post.

Maybe everyone (including passel) thinks this thread is dead but it is not.

I'm wondering if doing a colormatrix greyscaling before trying to create the mask would help things out any..

Quote:
edit: I'm also thinking that the alpha value should remain steady at 255 while
the individual RGB values should each reflect pixel color value differences.
So using the blue "channel" to create a greyscale mask,
the code might look like:

'Excerpted from inside x,y looping (using multiple FastPix LockBits wrappers)
'Assigning images..
image1 = New Bitmap(CType(PictureBox1.Image, Bitmap))
image2 = New Bitmap(CType(PictureBox2.Image, Bitmap))
bmpMask = New Bitmap(CType(picMask.Image, Bitmap))
Dim x, y As Integer
Using fp1 As New FastPix(image1)
Using fp2 As New FastPix(image2)
Using fp3 As New FastPix(bmpMask)
'Calculating blue color difference
Dim bytDifference As Byte, bytBlue1 As Byte, bytBlue2 As Byte
bytBlue1 = pixelColor1.B
bytBlue2 = pixelColor2.B
If bytBlue1 > bytBlue2 Then
bytDifference = (bytBlue1 - bytBlue2)
Else
bytDifference = (bytBlue2 - bytBlue1)
End If
'Setting mask pixels
Dim newColor3 As Color = Color.FromArgb(255, bytDifference, bytDifference, bytDifference)
fp3.SetPixel(x, y, newColor3)
End Using
End Using
End Using

I have to try this once I get the color matrix greyscaling module added on..

Last edited by surfR2911; 05-27-2012 at 06:04 PM.
Reply With Quote
  #25  
Old 06-04-2012, 11:35 PM
surfR2911 surfR2911 is offline
Contributor
 
Join Date: Oct 2009
Posts: 719
Default Thread resolved - with an example of applying a procedurally created alpha mask

Well, its been over a week and my last attachment got one view,
(hopefully it was passel).

The secret wasn't greyscaling but using the manipulating the rgb values directly instead
of using the greyscale value as the alpha value of the bitmap's ARGB pixel values.

Anyway, check out the two screenshots.
One is using an alpha mask to create a tint with a single color
(the tinting color can be adjusted at runtime).
The other shows doing per pixel alpha blending of a procedurally generated texture (random pixels).

Using the FastPix code as a lock / unlock bits wrapper for GetPixe / SetPixel)
the speed is such that one could even imagine
doing a real time animation with double alpha masking.

The best non-DMA example of per pixel alphablending using VB6 is
vbAccelerator - Alpha DIBSections
The same site has a sample creating an alpha mask image using VB6
Alpha Image Creator

The attached code represents the closest I have been able to come up with
toward replicating the same functionalities using VB.Net.

Besides the demo for the real time double alpha masking,
I have also developed a nice set of routines for creating different types of
"splatter" pixel graphics, but I guess I'll just end this thread here.
If passel isn't interested in posting anymore (as much as he is interested in graphics)
than the subject of this thread is probably a bit to esoteric for anyone else
(too bad).

I believe the ability to do sophisticated per pixel manipulation has the potential
to achieve some very interesting animated graphic effects achievable in no other way.

However the system.drawing,drawing.drawing2d class has very few built-in
code routines
for doing different types of per pixel effects, so it looks like non-Micorosft employees,
(i.e. members of the VB.Net community-at-large),
will have to "patch" the .Net framework and create their own such code routines.
Attached Images
File Type: jpg Screenshot1_PerPixel_AlphaMaskCreator-n-Testor.JPG (106.1 KB, 6 views)
File Type: jpg Screenshot2_PerPixel_AlphaMaskCreator-n-Testor.JPG (108.4 KB, 8 views)
Attached Files
File Type: zip PixelDifferences_MaskCreator5.zip (498.8 KB, 6 views)

Last edited by surfR2911; 06-04-2012 at 11:53 PM.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Fuzzy gradient Lines and line smearing
Fuzzy gradient Lines and line smearing
Fuzzy gradient Lines and line smearing Fuzzy gradient Lines and line smearing
Fuzzy gradient Lines and line smearing
Fuzzy gradient Lines and line smearing
Fuzzy gradient Lines and line smearing Fuzzy gradient Lines and line smearing Fuzzy gradient Lines and line smearing Fuzzy gradient Lines and line smearing Fuzzy gradient Lines and line smearing Fuzzy gradient Lines and line smearing Fuzzy gradient Lines and line smearing
Fuzzy gradient Lines and line smearing
Fuzzy gradient Lines and line smearing
 
Fuzzy gradient Lines and line smearing
Fuzzy gradient Lines and line smearing
 
-->