Hi again,
I have been working on an app that is 98% complete in vb .net. If I knew what I was getting into using vb for image processing I would have used C# but I am way down the road and I think/hope this is my last issue.
Again many thanks to all those who have posted filters,quantizers, and miscellaneous image functions, etc. Translating c,c++ and c# to vb .net has been a challenge but doable. Why do I use vb .net? Well as a consultant who codes and does business analysis for many years I have seen quite a bit of code. There is no doubt hands down that VB is the most legible. Those of you old enough to remember APL I have to tell you that many times I have found C++ and C# as dense as APL. The other thing is over time speed matters less and less for the type of applications I have worked on. So nanoseconds never mattered to me.
Enough chattter and excuses, my problem is this:
Working in VB its easy to use Byte() to memorystream and back. But in translating some old c code I see UShort()(,) used for memory streams. VB lacks ushorts of this type.
When I try to convert stream()(,) to byte arrays there is a major issue that the byte array is not indexed. One can convert a byte easily
Dim vIn As UShort = 0
Dim vOut As Byte() = BitConverter.GetBytes(vIn)
but that doesn't help with the index and array in the ushort()(,) format.
So an example of the problem code is:
The following line of code comes from
Copyright © 2007 by Libor Tinka Resampling project. Thanks Libor.
intensity = (intensity + (input(c)(contrib(i).p(j).pixel, k) * weight))
input was declared as ()(,)
You get a: "Structure byte cannot be indexed because it has no default property.
I also wanted to create little function that can handle Byte()(,) to values (24 bit so 3 values for RGB and back again to make conversion easier.
Larry
What I have tried:
Public Function Resample(ByVal input As Byte(), ...) As Byte()(,)
For c = 0 To planes - 1
work(c)(,) = Byte(outWidth, inHeight) 'UShort(outWidth - 1, height - 1) {}
output(c) = New UShort(outWidth - 1, outHeight - 1) {}
Next
work(c)(i, k) = CType(Math.Min(Math.Max((intensity / contrib(i).wsum), UInt16.MinValue), UInt16.MaxValue), System.UInt16)